Mon, Dec 23, 1:04 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 and OnOff?


fretshredder ( ) posted Thu, 13 February 2003 at 12:09 PM · edited Fri, 19 July 2024 at 5:18 PM

I am trying to work with a python script and lights and have the following question: Why is it that when using OnOff (which the docs clearly state that it would return 1 if the light is ON and 0 if it is OFF) would actually return 1 if the light is VISIBLE or 0 if INvisible? On the same token SetOnOff(int) either makes a light visible, or invisible rather than setting some bit to turn the light ON or OFF? I need to write a script that will remove all lights that are visible, but off and have not found a way to do it. any ideas TIA


ockham ( ) posted Thu, 13 February 2003 at 3:13 PM

SetOnOff refers to the visibility of the "thing" itself. For a figure or a prop, this is clear: visible only has one possible meaning. But for a light, it's less obvious, because the "thing" representing the light can be visible or invisible, and the light itself can also be emitting rays or not emitting rays. Both of these actions loosely fall into the word "visibility", but they are not the same. SetOnOff always refers to the visibility of the "thing" (more specifically the OBJ or mesh). But in this case the "thing" or OBJ is the outline that shows up on screen in Preview mode. For infinite lights, the "thing" is that set of arrows and curves that shows you where the light goes; for spotlights, the "thing" is that outline shape that looks like a spotlight. Setting the Light to emit rays or not is a completely separate matter; just set the Intensity parameter to 0 to turn it off. So, to do what you're thinking of, you'd want code something like this (untested): Intensity = ThisLight.Parameter("Intensity").Value() Visibility = ThisLight.OnOff() if (Visibility==1) and (Intensity == 0.0): ~scene.SelectActor(ThisLight) ~scene.DeleteActor()

My python page
My ShareCG freebies


fretshredder ( ) posted Thu, 13 February 2003 at 4:15 PM

nice! I hadn't even thought to test the intensity. I will try that .. thanks ockham!!


fretshredder ( ) posted Fri, 14 February 2003 at 10:32 PM

Unfortunately I tried your suggestion ... and even though the light is OFF, its intensity came back as 1.0, not 0.0


fretshredder ( ) posted Fri, 14 February 2003 at 11:00 PM

tried some other things as well... no dice :-( It seems to me that when using p4 lighsets in p5 that have OFF lights it chokes. I would hate to have to remove the offending lights one by one by HAND no less...


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.