I’m new to Python, but I’ve made my first Blender addon.
It’s called Blender-QLE (Quick Lighting Environment), and it drops three area lights into a new collection in a scene. You can add/remove the collection as many times as you like.
I hacked it together from what I’ve gleaned from the built-in templates, YouTube tutorials, and threads on Stack Exchange, but I’m sure it could be improved.
I’d love to get some feedback, especially in regard to a bug I can’t seem to get a handle on: If I manually delete one of the lights, then it breaks the add/remove collection function.
I’m thinking that I might need to purge all three area lights from the file before re-adding the collection, or maybe I just need to move the existing objects back to the scene and reconnect them. Or maybe it’s an issue with how I’m instancing the objects in the first place? As I said, I’m new to Python and coding Blender, so perhaps I’m missing something obvious.
Anyway, I’d love some feedback, and if anyone has any suggestions for improving or optimizing it, or an idea on how to fix the add/remove bug, I’d be grateful for your help.
Good point. I don’t consider this a replacement for Tri-Lighting, but I was regularly making a different lighting setup (similar to what I saw on Chris Prenninger’s Youtube), so I made this addon as a way to learn about using Python to manipulate Blender.
The main differences are:
The light intensity is much higher (300w vs 1.5w)
The shape of the lights are rectangular rather than square
The surface area is much larger
The color is set to “natural” light using a Blackbody node
They are constrained to a target, so moving (or animating) one target redirects all three lights.
They’re gathered in a Collection so showing/hiding them is one-click
One button click to clear the setup
I think Tri-Lighting positions the lights better, so I might eventually adopt those coords.
If you select one or more objects before adding the built-in Tri-Lighting lights, the lights will be targeted at the object selection with a TrackTo constraint.
Maybe you could add an option to QLE for a procedural softbox gradient texture, so the lights will not be unrealistically harsh in reflections.
It would also be great if you could select a light, then activate a function to click on an object and have the light positioned in a straight line towards the clicked spot, keeping the same distance.
I hadn’t dug into Tri-Lighting, so I took another look, and it’s pretty great. I can learn a lot from the code.
For example, I’m thinking I can put the common light settings into a variable and reduce the number of lines of code.
Road not take, but looking at that script, I wonder if forking Tri-Lighting and adding my features might have been a better path. Anyway…
“Procedural softbox gradient texture” is a new thing to me. Sound worth learning about, so I’ll do some googling.
And click-targeting is also an interesting idea. Once again, I think Tri-Lighiting has some code that I might be able to adapt for the function.
Thanks for the suggestions. I appreciate the feedback. I’ll add them to the roadmap, but my current task at hand is figuring out how to fix the error when re-adding a setup after deleting a single light.
I’m still dealing with the bug that hits when you manually delete a light and click Add Environment again.
Frustrating, but I see now that its an issue with how I’m creating collections. It works fine on a fresh scene, but if any of the previous objects exist, it errors out.
Still looking for help with that if anyone has any ideas
Bugfix: If you launch Blender and open a file with an existing QLE collection, deleting the collection sets the World to null, and causes an error when adding the collection again