RGUS opened this issue on May 15, 2005 · 11 posts
RGUS posted Sun, 15 May 2005 at 5:10 PM
Ok you Python guru's, I constantly load preset light sets to see effects in my scene, but after a while I have all these lights that I've turned off and don't need them cluttering up the scene. Is there a python script out there that will delete all lights in a scene that are turned "OFF"? I've got scripts to delete all lights no matter what and delete lights below a certain intensity, but these don't allow selection of lights turned "OFF" Thanks you guys that write this stuff... I thought "Python" was part of the "Monty Flying Circus" series... LOL
nruddock posted Sun, 15 May 2005 at 5:30 PM
What version of Poser is it for ?
RGUS posted Sun, 15 May 2005 at 5:41 PM
Poser 6, if that helps... thanks
Acadia posted Sun, 15 May 2005 at 5:51 PM
Attached Link: http://www.renderosity.com/messages.ez?Form.ShowMessage=2157525
Hmmm, there is one in the free stuff, but I can't remember who made it. EDIT: I dug up the thread where I asked about the same thing. There is a link in there to a script or utilityMessage edited on: 05/15/2005 17:57
"It is good to see ourselves as
others see us. Try as we may, we are never
able to know ourselves fully as we
are, especially the evil side of us.
This we can do only if we are not
angry with our critics but will take in good
heart whatever they might have to
say." - Ghandi
nruddock posted Sun, 15 May 2005 at 6:30 PM
Attached Link: http://www.renderosity.com/messages.ez?ForumID=12390&Form.ShowMessage=2261347
Your in luck then, as there's now an Actor method to detect whether a light is on or off (link is to Poser Python forum).zulu9812 posted Sun, 15 May 2005 at 6:54 PM
Didn't Ockham do something for this? I believe it's in his free stuff section, and it's called Light Panel
RGUS posted Sun, 15 May 2005 at 8:17 PM
Thanks everyone, this is great to see the feedback... "nruddock", I went to you link, but couldn't get the script to work, I'm sure I'm missing something...
RGUS posted Sun, 15 May 2005 at 8:25 PM
Again thanks everybody... I don't know why, because I don't write Python code, but being a hacker from way back, I decided to have a go at mixing code and seeing what happens.... It works... don't know why or how, but this little bit of Python, deletes all lights in a scene that are switched off. This makes it easier to work with only the lights you want and not have to manually delete the ones you don't want. [Code starts:] import poser scene=poser.Scene() lights=scene.Lights() for lig in scene.Lights(): if not lig.LightOn(): lig.Delete() [Code Ends:] Just say it as "DelOFFLights.py" or anything else you like and run it to delete "OFF" lights
Eternl_Knight posted Sun, 15 May 2005 at 9:43 PM
Remember to actually put the spaces/tabs into the code!
For example - the code should be something like the following:
[Code starts:]
import poser
scene=poser.Scene()
lights=scene.Lights()
for lig in scene.Lights():
if not lig.LightOn():
lig.Delete()
[Code Ends:]
Message edited on: 05/15/2005 21:43
nruddock posted Mon, 16 May 2005 at 12:42 PM
Strange, it works for me without the "import poser" line. I've been including it in previous P6 scripts as it did seem to need it.
DocMatter posted Mon, 16 May 2005 at 1:24 PM
bookmark