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?
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.
Sign up to join this communityI 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?
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)