Profile Picture

Free Python Script - Turn All Lights On or Off

Posted By Data Juggler 5 Years Ago
You don't have permission to rate!
Author
Message
Data Juggler
Data Juggler
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 1.8K, Visits: 5.6K
I wrote a Python Script that lets you find all lights in a scene, and you can set them to active or inactive.

Light Controller
https://github.com/DataJuggler/PythonScripts/blob/main/LightController.py

Here is a short video that shows its usage and goes over the code:


This is the same thing as going to the Scene and selecting all your lights and activating or deactivating them, but IClone crashed on me when the number of lights was near 600 in my scene.

The one disappointing thing is I can't animate this. If I turn all the lights off on Frame 600, the lights are off on frame 1.

Still neat though. You can also set light colors and other things that could be useful for certain scenes.

If me posting here bothers anyone, I will stick to just the Python forum, but that forum doesn't get very many visitors.










Creator of the free website:
PixelDatabase.Net
A Free Online Text Based Image Editor
https://forum.reallusion.com/uploads/images/6e6663e2-0ecf-447a-ab3d-d49d.png

charly Rama
charly Rama
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)Distinguished Member (8.1K reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 1.9K, Visits: 17.3K
Thank you for this.thank you for all who spend times to search and share it. Thank you guys for your generosity. God bless you


     


wires
wires
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)Distinguished Member (15.4K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 5.7K, Visits: 26.5K
Interesting feature for lights, but one question regarding your particular scene, Why are you using so many lights?

It is possible to accomplish what you have done using GI Emissive Plane_Round prop supplied with iClone.

In the scene below I have 4 items on stands and each one has an Emissive Plane placed above it and set as a Dummy, the scene lights are switched off:

https://forum.reallusion.com/uploads/images/a4887c95-ef1b-417e-a184-a055.png


Global Illumination is also off:

https://forum.reallusion.com/uploads/images/cc6796c8-8d11-4636-9927-929f.png


With GI active, lights still off, all of the props are illuminated:

https://forum.reallusion.com/uploads/images/8197f044-6445-4839-baa2-5990.png


Using the GI settings in the prop modify panel it is also possible to control each individual "light source" above the display items:

https://forum.reallusion.com/uploads/images/448718eb-aa4c-47ba-a993-aed8.png

The nice thing about this setup is, IMHO, the ability to turn all the display lights on or off with one mouse click in the visuals tab, but still offering control over each and every display "Light" if required.

Please don't get me wrong, I'm not knocking your script as I can imagine that there are indeed scenes requiring a selection of different light sources that could be controlled simultaneously, and if you can figure out how to get keyframes set for them all at once it would be a real winner. :):cool::smooooth:  

Gerry



System: Win 10 Pro (21H2), Asus X99-E WS, CPU i7-5930K -3,5 GHz, 32 GB DDR4 2666-16 RAM, NVidia GTX 1080 Ti GPU - 11 GB VRAM(Driver Studio-536.99), Samsung 850 Pro 512 GB SSD, 6 TB HD storage.


Data Juggler
Data Juggler
Posted 5 Years Ago
View Quick Profile
Distinguished Member

Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)Distinguished Member (13.9K reputation)

Group: Forum Members
Last Active: Last Year
Posts: 1.8K, Visits: 5.6K
I have tried using the Emissive lights before ad never got that much light out of them. I am sure I don't know how to use them the way you did.

I have 9 shoes stores, and each shoe store has 12 shoes, each shoe has 5 lights is why.

At this point I am done with my scene, so no reason to change it now, but I will keep that in mind for next time.

When I wrote this I was hoping I could animate the active status of a light, but I haven't been able to find a way to do that yet, except for Color.





Creator of the free website:
PixelDatabase.Net
A Free Online Text Based Image Editor
https://forum.reallusion.com/uploads/images/6e6663e2-0ecf-447a-ab3d-d49d.png




Reading This Topic