User guide

158
example:
help( NodegraphAPI.CreateNode )
Referencing a Node
You can reference a node using the function GetNode(). For example, to reference a node called PrimitiveCreate
to the name node use:
node = NodegraphAPI.GetNode( 'PrimitiveCreate' )
Referencing a Parameter
Parameters are referenced in a similar way to nodes, using the function getParameter(). For example, to reference
the type parameter of a node called PrimitiveCreate, to the name nodeType use:
nodeType = NodegraphAPI.GetNode('PrimitiveCreate').getParameter( 'type' )
NOTE: Shift+middle-drag to the Python tab from a node in the Node Graph tab, or a parameter in the
Parameters tab to automatically create the path to that node or parameter. For example, dragging from
a node PrimitiveCreate in the Node Graph produces:
NodegraphAPI.GetNode( 'PrimitiveCreate' )
Node Position
The function SetNodePosition() sets the position of a node in the Node Graph UI. For example, to create then
position a PrimitiveCreate node:
# Get the root node
root = NodegraphAPI.GetRootNode()
# Create a new node at root level
node = NodegraphAPI.CreateNode( 'PrimitiveCreate', root )
# Define X & Y values
x = 0
y = 100
position = ( x, y )
# Set node position
NodegraphAPI.SetNodePosition( node, position )
23 NODEGRAPH API |