fretshredder opened this issue on Feb 13, 2003 ยท 5 posts
fretshredder posted Thu, 13 February 2003 at 12:09 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()
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...