I'm trying to fix:
bpy.context.scene.world.light_settings.use_environment_light = True
bpy.context.scene.world.light_settings.environment_energy = energy
bpy.context.scene.world.light_settings.environment_color = 'PLAIN'
to make them work in blender 2.8. I read Setting up a Sky: bpy.context.world = None, but my bpy.context.scene.world.node_tree
is None. How would I set up a node tree and add the Background node?
It seems like the correct code should be something like bpy.context.scene.world.node_tree.nodes['Background'].inputs['Strength'].default_value = energy
, but I can't figure out how to make the node_tree
.
Any help would be greatly appreciated!