ICENodeContainer.Nodes
 
 
 

ICENodeContainer.Nodes

Description

Returns an ICENodeCollection containing all nodes in this container, including both ICENode and the immediate ICECompoundNode objects. To access the inner nodes of ICECompoundNode objects you need to call this property on their respective ICECompoundNode parents (via ICENodeContainer.CompoundNodes).

This property is typically used for iterating over an entire node graph. For example, start by calling this property on the ICETree. While iterating over the returned collection, when you find a compound node, call ICENodeContainer.CompoundNodes on it to get any inner compound nodes and so on recursively down through the graph.

C# Syntax

// get accessor
ICENodeCollection rtn = ICENodeContainer.Nodes;

Examples

Python Example

# Sample code to show how to traverse a node graph with ICENodeContainer
import win32com.client
from win32com.client import constants
xsi = Application
xsi.NewScene( "", 0 )
# Recursive function for traversing a node graph
def TraverseNodeGraph( in_node, level ):
        indent = level * '.'
        # Log the visited node name
        xsi.LogMessage( indent + in_node.Name )
        nodeCount = 0
        nodes = ()
        if in_node.IsClassOf( constants.siICENodeContainerID ): 
                # The input node might be a ICETree or ICECompoundNode, let's get their ICENodes
                nodes = in_node.Nodes
                nodeCount = nodes.Count
        # Recursively traverse the graph
        for i in range(nodeCount):
                TraverseNodeGraph( nodes[i], level+2 )
# Create a sample twist deformer graph first
xsi.CreatePrim( "Cube", "MeshSurface" )
xsi.SetValue( "cube.polymsh.geom.subdivu", 15 )
xsi.SetValue( "cube.polymsh.geom.subdivv", 14 )
xsi.ApplyOp( "ICETree", "cube", None, None, None, 0 )
xsi.AddICENode( "GetDataNode", "cube.polymsh.ICETree" )
xsi.SetValue( "cube.polymsh.ICETree.SceneReferenceNode.Reference", "cube.polymsh.PointPosition" )
xsi.AddICENode( "RotateVectorNode", "cube.polymsh.ICETree" )
xsi.AddICENode( "3DVectorToScalarNode", "cube.polymsh.ICETree" )
xsi.AddICENode( "SetData", "cube.polymsh.ICETree" )
xsi.SetValue( "cube.polymsh.ICETree.SetData.PredefinedAttributeName", "PointPosition" )
xsi.AddAttributeToSetDataICENode( "cube.polymsh.ICETree.SetData", "PointPosition", constants.siComponentDataTypeVector3, constants.siComponentDataContextComponent0D, constants.siComponentDataStructureSingle )
xsi.ConnectICENodes( "cube.polymsh.ICETree.port1", "cube.polymsh.ICETree.SetData.set" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.RotateVectorNode.vector", "cube.polymsh.ICETree.SceneReferenceNode.value" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.SetData.pointposition", "cube.polymsh.ICETree.RotateVectorNode.result" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.3DVectorToScalarNode.vector", "cube.polymsh.ICETree.SceneReferenceNode.value" )
xsi.AddICENode( "MultiplyNode", "cube.polymsh.ICETree" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.MultiplyNode.value1", "cube.polymsh.ICETree.3DVectorToScalarNode.y" )
xsi.AddICENode( "ScalarToRotationNode", "cube.polymsh.ICETree" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.ScalarToRotationNode.angle", "cube.polymsh.ICETree.MultiplyNode.result" )
xsi.ConnectICENodes( "cube.polymsh.ICETree.RotateVectorNode.rotation", "cube.polymsh.ICETree.ScalarToRotationNode.rotation" )
xsi.SetValue( "cube.polymsh.ICETree.ScalarToRotationNode.y", 1 )
xsi.SetValue( "cube.polymsh.ICETree.ScalarToRotationNode.x", 0 )
xsi.SetValue( "cube.polymsh.ICETree.MultiplyNode.value2", 20 )
xsi.CreateICECompoundNode("cube.polymsh.ICETree.3DVectorToScalarNode,cube.polymsh.ICETree.MultiplyNode,cube.polymsh.ICETree.ScalarToRotationNode", "")
# Get the ICETree off the cube primitive and start iterating in the graph
cube = xsi.Selection(0)
cubeICETree = cube.ActivePrimitive2.ICETrees[0]
level = 0
TraverseNodeGraph( cubeICETree, level )
# Expected results:
# INFO : ICETree
# INFO : ..Get Data
# INFO : ..Rotate Vector
# INFO : ..Set Data
# INFO : ..Compound Node
# INFO : ....3D Vector To Scalar
# INFO : ....Multiply
# INFO : ....ScalarToRotation

See Also

ICENodeContainer.CompoundNodes ICENodeContainer.DataModifierNodes ICENodeContainer.DataProviderNodes