System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 497.29
Blender Version
Broken: version: 3.1.0, branch: master, commit date: 2022-03-08 18:16, hash: rBc77597cd0e15
Worked: 3.0
This changed in rB7e712b2d6a0d: Nodes: refactor node tree update handling
Short description of error
It seems to be (inconsistently) no longer possible to set the world/shader node tree's active output using python.
Running node.is_active_output = True in a fresh scene does anything. But if you (in the UI) click on one of the output nodes, setting it as the active output, then from that point onwards doing node.is_active_output = True will indeed work.
Exact steps for others to reproduce the error
- Starting from factory defaults
- In a python console editor, run: node = C.scene.world.node_tree.nodes.new('ShaderNodeOutputWorld') to create a new world output node. This node is named World Output.001. The original output node is named World Output.
- Check the current state of the active output node:
- C.scene.world.node_tree.nodes['World Output'].is_active_output - the result is True as this is the original node.
- C.scene.world.node_tree.nodes['World Output.001'].is_active_output - the result is False as this is the new node.
- Try set the new node as active output using C.scene.world.node_tree.nodes['World Output.001'].is_active_output = True. Nothing happens, the value remains False even after we set it.
- In the UI, click on the newly created node, setting it as the active output (verify this with the code above if needed, is_active_output is now True for the new node)
- Click on the original node to set that as the active output.
- Run C.scene.world.node_tree.nodes['World Output.001'].is_active_output = True again, this time it successfully changes the tree's active output to that node.
As a side note, is there some other workaround way I can consistently set the node tree's active output? I need to fix an add-on and can't wait for this to be patched.