I'm working on a script that will render several still images at a time. Most of the time it'll be using an alpha background, but I was thinking that if I could include settings for Dynamic Sky in the script, it'd be nice to quickly change, with one check box, from using alpha to using Dynamic Sky in the background. (Or maybe, when it's rendering a series of images, to render some with an alpha background and some with a sky background or, in some cases, to do both for some images.)

Is there a way I can have my Python script check if Dynamic Sky is installed and, if so, interact with it? I haven't been able to find a good reference showing me how I can pass data to Dynamic Sky (or activate it) from a script.

If there are other ways to easily use a sky background, I'd be interested in that as well. If it involves using external files, I'd need to know how the script can load those files into the current project.


I'd recommend enable Developer Extras in the Preferences to get the actual operator (button) call. Once enabled, this is going to add a new Edit Source entry to the RMB context menu which allows to inspect the associated code coming from the the add-on in the Text Editor:

enter image description here enter image description here

Turns out to be a pretty simple add-on, just creates a certain world node tree and allows to control its contents using a panel. The code itself consists of only one sky.dyn() operator, one scene property Scene.dynamic_sky_name storing the name of the current data-block and the panel of course.

Proof using the python console on how to create a 'Dynamic Sky', get the reference, assign it to the world data-block and set the brightness to 2:

# Call the operator
>>> bpy.ops.sky.dyn()

# Get the created world data block
>>> dyn_sky = D.worlds.get(C.scene.dynamic_sky_name)
>>> dyn_sky

# Assign the data-block to scene world
>>> C.scene.world = dyn_sky

# Get the Scene_Brightness node 
>>> scene_brightness = C.scene.world.node_tree.nodes.get("Scene_Brightness")
>>> scene_brightness

# Set the strength to 2
>>> scene_brightness.inputs['Strength'].default_value = 2

How to enable a certain add-on is nicely explained in the following Q&A:

How to enable and disable Add-ons via Python?

  • $\begingroup$ That's a lot easier than I expected it to be. I'm still getting it in my head that I can easily access other addons. Obvious, I know, if you're used to Blender, but this is a completely different environment than what I'm used to. Thanks! $\endgroup$ – Tango Mar 28 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.