Skip to content

Commit

Permalink
Add randomized backgrounds to StartUp screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Deledrius committed Jun 28, 2023
1 parent f8a144d commit 5c46d85
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Scripts/Python/stupStartUp.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@
launch start up sequence
"""

import random

from Plasma import *
from PlasmaTypes import *

# define the attributes that will be entered in max
Camera = ptAttribSceneobject(1, "Camera")
BGObj = ptAttribSceneobject(2, "Background Object")
BGLayer = ptAttribLayer(3, "Background Image Layer")

#====================================

Expand Down Expand Up @@ -104,3 +108,14 @@ def OnServerInitComplete(self):
PtShowDialog("GUIDialog04b")
else:
PtShowDialog("GUIDialog06")

self.randomizeBackground()


###########################
def randomizeBackground(self):
if ilmList := BGObj.sceneobject.getImageLibMods():
ilm = ptImageLibMod(ilmList[0])
bgChoice = random.choice(ilm.getNames())
if newImage := ilm.getImage(bgChoice):
BGLayer.layer.texture = newImage

0 comments on commit 5c46d85

Please sign in to comment.