From 16d6a712f0802bc5a17e5e76d185419e295e8ef6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 3 Aug 2001 16:11:22 +0000 Subject: [PATCH] update for new system without base.initialState --- direct/src/directtools/DirectLights.py | 15 +++++++-------- direct/src/tkpanels/DirectSessionPanel.py | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/direct/src/directtools/DirectLights.py b/direct/src/directtools/DirectLights.py index b41f47d100..d185c210f2 100644 --- a/direct/src/directtools/DirectLights.py +++ b/direct/src/directtools/DirectLights.py @@ -28,8 +28,8 @@ class DirectLights(NodePath): parent = direct.group # Create a node for the lights self.assign(parent.attachNewNode('DIRECT Lights')) - # Create a light attribute - self.la = LightAttribute() + # Create a light transition + self.lt = LightTransition() # Create a list of all active lights self.lightDict = {} # Counts of the various types of lights @@ -99,28 +99,27 @@ class DirectLights(NodePath): def allOn(self): """ Turn on all DIRECT lights """ - base.initialState.setAttribute(LightTransition.getClassType(), - self.la) + render.arc().setTransition(self.lt) # Make sure there is a default material render.setMaterial(Material()) def allOff(self): """ Turn off all DIRECT lights """ - base.initialState.clearAttribute(LightTransition.getClassType()) + render.arc().clearTransition(LightTransition.getClassType()) def toggle(self): """ Toggles light attribute, but doesn't toggle individual lights """ - if base.initialState.hasAttribute(LightTransition.getClassType()): + if render.arc().hasTransition(LightTransition.getClassType()): self.allOff() else: self.allOn() def setOn(self, directLight): """ setOn(directLight) """ - self.la.setOn(directLight.getLight()) + self.lt.setOn(directLight.getLight()) def setOff(self, directLight): """ setOff(directLight)""" - self.la.setOff(directLight.getLight()) + self.lt.setOff(directLight.getLight()) diff --git a/direct/src/tkpanels/DirectSessionPanel.py b/direct/src/tkpanels/DirectSessionPanel.py index 3e873e0104..b8328c661e 100644 --- a/direct/src/tkpanels/DirectSessionPanel.py +++ b/direct/src/tkpanels/DirectSessionPanel.py @@ -914,11 +914,11 @@ class DirectSessionPanel(AppShell): def updateLightInfo(self, page = None): # Set main lighting button self.enableLights.set( - base.initialState.hasAttribute(LightTransition.getClassType())) + render.arc().hasTransition(LightTransition.getClassType())) # Set light specific info if self.activeLight: l = self.activeLight.getLight() - self.lightActive.set(direct.lights.la.isOn(l)) + self.lightActive.set(direct.lights.lt.isOn(l)) lightColor = l.getColor() * 255.0 self.lightColor.set([lightColor[0], lightColor[1], lightColor[2], lightColor[3]], 0)