Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 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.
My python page
My ShareCG freebies
My python page
My ShareCG freebies
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
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!
My python page
My ShareCG freebies
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
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