Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 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
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 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