Set composite node as active for output via Python script

Hello,

I have a problem with making specific composite node an active one for rendering/output (Compositer). Specifically I have more Composite nodes in the scene and I want to set one of them as active with python. Like I can make them active with the code

bpy.context.scene.node_tree.nodes.active

but the composite node is still not active for rendering/output (name of node highlighted with red in active as output render)
obrazek

Pls help! :slight_smile:

I also found this note in the documentation, but it seems it behaves this way only when selected by mouse.
obrazek

Thank you

To answer myself…so far I found one workaround, which is first “un-muting” all composite nodes (so I am sure none is muted by any chance) and then muting those I don’t want as the output. Pretty ugly solution, but it works :neutral_face:

bpy.context.scene.node_tree.nodes["com_albedo"].mute = False
bpy.context.scene.node_tree.nodes["com_normal"].mute = False
bpy.context.scene.node_tree.nodes["com_opacity"].mute = False

bpy.context.scene.node_tree.nodes["com_albedo"].mute = True
bpy.context.scene.node_tree.nodes["com_normal"].mute = True
1 Like