Sun, Dec 1, 2:51 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 29 7:57 am)



Subject: Python script to delete all lights that are turned OFF


RGUS ( ) posted Sun, 15 May 2005 at 5:10 PM · edited Sun, 01 December 2024 at 2:48 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 · edited Sun, 15 May 2005 at 5:57 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 utility

Message 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 · edited 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


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.