Node Properties

Functions

Flags

NodegraphAPI.IsNodeEdited(node)

True if the node parameters are displayed. When nodes are edited their parameters are displayed in the user interface. There can be none or several nodes edited at once time.

Return type:bool
NodegraphAPI.SetNodeEdited(node, edited, exclusive=False)

Set if the node parameters are displayed. When nodes are edited their parameters are displayed in the user interface. There can be none or several nodes edited at once time. If optional exclusive arg is True, all nodes are unedited before setting the edited flag on specified node.

NodegraphAPI.IsNodeViewed(node)

True if the node results are displayed. When the node is viewed, its output is displayed in the interface.

Return type:bool
NodegraphAPI.SetNodeViewed(node, viewed, exclusive=False)

Set if the node results are displayed. When the node is viewed, its output is displayed in the interface. If optional exclusive arg is True, all nodes are unviewed before setting the view flag on specified node.

NodegraphAPI.IsNodeSelected(node)

True if the node is selected in the interface. Interface operations that effect nodes will be applied to selected nodes. There can be any number of selected nodes at a time.

Return type:bool
NodegraphAPI.SetNodeSelected(node, selected)

Set if the node is selected in the interface. Interface operations that effect nodes will be applied to selected nodes. There can be any number of selected nodes at a time.

NodegraphAPI.SetAllSelectedNodes(nodelist)

Replace the nodes that are selected. If the sequence of nodes is empty, all nodes will be unselected. Interface operations that effect nodes will be applied to selected nodes. There can be any number of selected nodes at a time.

NodegraphAPI.IsNodeHidden(node)
NodegraphAPI.SetNodeHidden(node, hide)
NodegraphAPI.IsNodeFloating(node)

True if the node is tracking the mouse position. When nodes are interactively created or moved, they become floating nodes. Floating nodes track with the mouse movement until they are placed.

Return type:bool
NodegraphAPI.SetNodeFloating(node, flag)

Set if the node is tracking the mouse position. When nodes are interactively created or moved, they become floating nodes. Floating nodes track with the mouse movement until they are placed.

NodegraphAPI.IsNodeThumbnailEnabled(node)
NodegraphAPI.SetNodeThumbnailEnabled(node, enabled)
NodegraphAPI.IsNodeLockedByParents(node)
Return type:bool
Parameters:node (NodegraphAPI.Node or None) – The node whose parent nodes to check.
Returns:True if the contents of any of the given node’s parent nodes are locked, otherwise False.

Shapes

NodegraphAPI.GetNodeShapeAttr(node, attrName)
NodegraphAPI.GetNodeShapeAttrs(node)
NodegraphAPI.SetNodeShapeAttr(node, attrName, attrValue)
NodegraphAPI.SetNodeShapeNodeAttrs(node, attrDict)
NodegraphAPI.DeleteNodeShapeAttr(node, attrName)

Comments

NodegraphAPI.GetNodeComment(node)

Get the user comment on the node

Return type:string
NodegraphAPI.SetNodeComment(node, comment)

Set the user comment.

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
rootNode = NodegraphAPI.GetRootNode()

# Create a new node at root level
primNode = NodegraphAPI.CreateNode('PrimitiveCreate', rootNode)

# Define X & Y values
position = (0, 100)

# Set node position
NodegraphAPI.SetNodePosition(primNode, position)
NodegraphAPI.GetNodePosition(node)

Get the 2D position of the node. Created nodes have the position (0, 0). The position is in y-down integers.

Return type:(int, int)
NodegraphAPI.SetNodePosition(node, xy)

Set the 2D position of the node. The position is in y-down integers.

Parameters:xy (int, int) – the new node position

Miscellaneous

NodegraphAPI.GetMenuPath(nodeType)
NodegraphAPI.CheckNodeType(node, stringOrClassTypes)

Instance Methods

Flags

Node3D.isAutoRenameAllowed() → bool

True if the node is locked from auto-name changes.

Node3D.setAutoRenameAllowed(bool) → bool

Locks or unlocks the node from auto-name changes.

Node3D.isBypassed() → bool

True if the node state is set to bypassed.

Node3D.setBypassed(state)

Enables or disables the node according to the given bypassed state.

Node3D.isLocked(considerParents=False) → bool

True if the node is locked to prevent changes, otherwise False. The considerParents flag controls whether the content-locked states of ancestor nodes are taken into account: child nodes of content-locked ancestor nodes are locked against edits in the UI, but can still be modified using the NodegraphAPI (unless they are locked themselves).

Node3D.setLocked(bool)

Locks or unlocks the node to prevent or allow changes.

Node3D.isMarkedForDeletion() → bool

True if the node has been deleted (node.delete), but hasn’t yet been deallocated by the deletion queue.

Node3D.delete()

Deletes the node and any children it contains.

Node3D.isResetPossible() → bool

True if the node can be reset (either by a generic parameter reset or by calling the customReset() method).

Node3D.customReset() → bool

Resets node parameters to factory settings. Returns true if a customReset is implemented. If false is returned, a generic parameter-by-parameter sync will be attempted.

Name

Each node has a name, which is unique within the bounds of a Katana recipe. Name-spacing does not exist for node names, which means that a call to:

node = NodegraphAPI.GetNode('PrimitiveCreate')
node.setName("Teapot")
print(node.getName())

It may not behave as expected if the chosen name is already in use by another node in the scene. In that case setName() finds a similar - but unique - name, uses that, and returns the new unique node name.

It’s possible to store a string user attribute on a node that utilities can search for in order to reference a node in a smaller context. This is a simple pattern that can provide a more localized pseudo node name. See Parameters/index.rst for more on adding parameters.

Warning

Node names cannot contain spaces. Any spaces or invalid characters that are used in the node name are converted into underscores. For example, the node name “Material Plastic” becomes “Material_Plastic”.

Node3D.getName() → str

Returns the unique name for the node.

Node3D.setName(name)

Sets the name for a node. The real unique name is returned.

Type

Node3D.getBaseType()

Returns a string naming the real base type of this node.

Node3D.getType() → str

Returns a string naming the registered type of this node.

Node3D.setType(typeName)

Sets a string naming the registered type of this node.

Parameters

See Parameters.

Parents

Node3D.setParent(groupNode) → bool

Sets the new parent group for this node. Can be None for no parent. Returns True if reparent successful.

Node3D.getParent() → Node

Returns the GroupNode that is the parent of this node, or None.

Attributes

Caution

Node attributes should not be confused with scene graph attributes

Node3D.getAttributes() → dict

Returns a dictionary of named static values that are persistent with the node.

Node3D.setAttributes(dict)

Assigns new named persistent values to the node with a string keyed dictionary.