Hi there
again, i don’t know what i’m doing…
the goal is to simply connect one or the other of these nodes inside the shader editor world context.
(obviously this script here does not work as intended at all)
You have to use the world tree specifically, not just the node_tree. See:
https://blender.stackexchange.com/questions/209584/using-python-to-add-an-hdri-to-world-node
1 Like
thanks for pointing that out!
this is it:
import bpy
C = bpy.context
scn = C.scene
node_tree = scn.world.node_tree
tree_nodes = node_tree.nodes
node_A = tree_nodes.get('b1')
node_output = tree_nodes.get('World Output')
links = node_tree.links
link = links.new(node_A.outputs['Background'], node_output.inputs['Surface'])
1 Like