Nodes and properties

The SDNode class enables users to get information about specific nodes, which properties can be accessed with the SDPropert y class. All of these can be either read of modified.

Available node information include:

  • definition;

  • identifier;

  • position;

  • properties (as a list);

  • resources that are being referenced;

Accessing node definitions and properties
import sd
# Import the required classes.
from sd.api.sdproperty import SDPropertyCategory
from sd.api.sdvalueserializer import SDValueSerializer

# Get and print information regarding the selected nodes.
def printSelectedNodesInfo(nodes):
    for node in nodes:
        definition = node.getDefinition()
        nodeId = node.getIdentifier()

        print("node %s, id = %s" % (definition.getLabel(), nodeId))

        # Create a list of each property category enumeration item.
        categories = [

        # Get node properties for each property category.
        for category in categories:
            props = definition.getProperties(category)

            # Get the label and identifier of each property.
            for prop in props:
                label = prop.getLabel()
                propId = prop.getId()

                # Get the connection for the currently accessed property.
                if prop.isConnectable():
                    connections = node.getPropertyConnections(prop)

                    if connections:
                        print("Propery %s is connected!!!" % label)

                # Get the value for the currently accessed property.
                value = node.getPropertyValue(prop)

                if value:
                    print("Property %s, id = %s, value = %s" % (label, propId, SDValueSerializer.sToString(value)))

Accessing node inputs identifiers and types
import sd
# Import the required classes.
from sd.api import sduimgr
from sd.api.sdproperty import *

# Access a node in the current graph, and its properties.
graph = uiMgr.getCurrentGraph()
node = graph.getNodeFromId('<Replace this text with the node ID>')
nodeProps = node.getProperties(SDPropertyCategory.Input)

# List node identifiers and types in console.
for i in range(len(nodeProps)):