2
$\begingroup$

I want to setup basic node tree using Python operator and I cannot use compositor context. Hint over node values pointed to this data path:

bpy.data.node_groups["Compositing Nodetree"].nodes["Alpha Over"].premul

but this collection: bpy.data.node_groups includes only custom node groups.

$\endgroup$
3
$\begingroup$

This bug report: https://developer.blender.org/T35720 pointed me to right right data path. When you want to modify node tree in compositor, then you have to use following path:

bpy.data.scenes['Scene'].node_tree.nodes['Alpha Over'].premul

or you can use following syntax to avoid hard-coded name of scene (current scene will be used):

bpy.context.scene.node_tree.nodes.['Alpha Over'].premul

and it just works. :-)

$\endgroup$
  • $\begingroup$ You can also use bpy.context.scene.node_tree.nodes to avoid hardcoding the name for the scene. $\endgroup$ – JakeD Sep 9 '16 at 14:58
  • $\begingroup$ @pycoder you are right. Thanks for reminder. I will update answer. $\endgroup$ – JiriHnidek Sep 12 '16 at 7:45

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.