update for new system without base.initialState

This commit is contained in:
David Rose 2001-08-03 16:11:22 +00:00
parent 9d5a0a521e
commit 16d6a712f0
2 changed files with 9 additions and 10 deletions

View File

@ -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())

View File

@ -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)