Forum: Poser Python Scripting


Subject: poserPython scripting qesution .. duh ;)

fretshredder opened this issue on Feb 25, 2003 ยท 5 posts


fretshredder posted Tue, 25 February 2003 at 5:49 PM

I am trying to determine if a given light in P5 is not only VISIBLE but ON as well. I have noticed that in P5 the OnOff() function if a bit different in its behavior than in previous versions. I am wanting to write a script that will delete all the lights that are OFF. I have tried looking at the intensity of each light but even when the light is OFF the intensity most often is 1.0. Since lights are a special type of actor in poser the OnOff is not sufficient to determine if the actor (light) is on or off, but can tell me if the light is visible or not. My code doesn't even report that 100% accurately.

In my print statements it will report that a light is OFF, when looking at my light controls it is clearly ON .. WTF

import poser

scene=poser.Scene()
scene.SetFrame(0)
lights=scene.Lights()

#start number of lights
print "number of scene lights: ", scene.NumLights()
for aLight in lights:
print aLight.Name(), " OnOff value: ", aLight.OnOff(), "intensity: ", aLight.Parameter("Intensity").Value

ending number of lights (after deletes)

print "number of scene lights: ", scene.NumLights()

Please forgive the formatting of the code if it wraps or generally looks unpleasant ... damned textboxes :-)

TIA