From 3cbdc4de389b1e54f2cf40b1a60cadcf2f558903 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Sat, 4 Mar 2023 23:43:56 -0800 Subject: [PATCH] Add randomized backgrounds to StartUp screen. --- Scripts/Python/stupStartUp.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Scripts/Python/stupStartUp.py b/Scripts/Python/stupStartUp.py index cbde12715b..29a1a9da9d 100644 --- a/Scripts/Python/stupStartUp.py +++ b/Scripts/Python/stupStartUp.py @@ -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") #==================================== @@ -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