1
$\begingroup$

I have a custom node tree called MyCustomTreeType. I know that there are scripts to add nodes to the composite and material node trees: Controling compositor by python

How can I use this with my custom tree?

$\endgroup$
2
$\begingroup$

The example of the custom PyNode tree includes information about how to add nodes to the menus via NodeCategory so i'm going to assume you've got menus working.

(if not: see TextEditor > Templates > Python > Custom Nodes )

If you want to add a node via python, it's the same as with shader trees or compositor trees, except you use data.node_groups.

ng = bpy.data.node_groups['MyNodeTree']
new_node = ng.nodes.new(your_nodes_bl_idname)
new_node.location = (20, 40)
$\endgroup$
  • $\begingroup$ I have thousands of objects for which I need to update their materials' nodes/links using Blender's Python API. I am pretty new to nodes stuff in Cycles and I haven't been able to wrap my head around how I can do that. I wonder, do you know how one can do that? If so, could you please take a look at my question here and see if you can offer a solution? $\endgroup$ – Amir Mar 8 '18 at 17:03

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.