Mon, Dec 23, 12:51 PM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: poserPython scripting qesution .. duh ;)


fretshredder ( ) posted Tue, 25 February 2003 at 5:49 PM · edited Sun, 21 July 2024 at 6:37 AM

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


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.

My python page
My ShareCG freebies


ockham ( ) posted Tue, 25 February 2003 at 11:14 PM

file_47648.jpg

All right, here's a version that works, but it's ridiculously complicated and requires all the lights to be numbered in the standard way. (light 1, light 2, etc.) If you have a set that's named in some other way, like NorthEastLight, SouthWestLight, etc., this will not work. I've attached the file here in TXT form. Rename it to P5DelOff.PY or something similar, and try it out. like

My python page
My ShareCG freebies


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!

My python page
My ShareCG freebies


Privacy Notice

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.