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
print "number of scene lights: ", scene.NumLights()
Please forgive the formatting of the code if it wraps or generally looks unpleasant ... damned textboxes :-)
TIA
ockham posted Tue, 25 February 2003 at 10:53 PM
I apologize: when you asked this question earlier, I gave you bad info. The "light off" choice is not the same as Intensity=0, though I think the net effect is the same. Problem is, "light off" can't be reached directly by Python. The only way to check it is to read the LT5 file, and then delete each light that has the keyline lightOn 0 in its paragraph of the LT5. I'm playing with this, and will post the result if it works.
ockham posted Tue, 25 February 2003 at 11:14 PM
fretshredder posted Fri, 07 March 2003 at 12:56 PM
ockham-- Sorry it took so long to get back to you. I tried your script, with mixed results. The script isn't too bad actually given the limitations of poser python. But I was unable to get the desired results. In a lightset I was testing there were about 15-20 OFF lights, after running the script there were 17. So, to say it worked would be wrong in my case. I am not sure what else to do about my situation other than craking open the files myself and removing them. The reason I am in such need to remove these lights is the now infamous P4 targetted spotlight problem in P5...it barfs and won't render... Oh well.... perhaps I will take another crack at the script. It sure would be nice if they could expose more of the POM (poser object model). PoserPython could be VERY powerful then ;-) Thanks again for your time
ockham posted Sat, 08 March 2003 at 4:06 PM
Well, as I said, the script depended on having all the naming conventions just right. If you could find a way around that, you'd probably have a more useful result!