Object Hierarchy | Related C++ Class: ICENode
ICENode
v7.0
The ICENode class represents a built-in or custom effect node in
the Softimage ICE graph. ICENodes can be assembled in sub-graphs
called compound nodes, which are represented as ICECompoundNode objects.
The ICENode class API is convenient for accessing the different
components of an effect node such as ports, port groups and port
group instances. The node ports are organized in groups similar to
the Softimage operator Ports, where groups
are logical groupings of multiple port connections. Other ICENode
objects can connect to an ICENode object via its ports represented
as ICENodeInputPort and
ICENodeOutputPort.
# Sample code to show how to access the ICENode elements. import win32com.client from win32com.client import constants xsi = Application # Recursive function for traversing a node graph def TraverseNodeGraph( node, level ): indent = level * '.' # Log info on the visited node xsi.LogMessage( "* * *" ) # Node info xsi.LogMessage( indent + "node: " + node.FullName ); xsi.LogMessage( indent + "node type: " + node.Type ); xsi.LogMessage( indent + "node proxy class: " + xsi.ClassName(node) ); xsi.LogMessage( indent + "node connected: " + str(node.IsConnected) ); xsi.LogMessage( indent + "node parent: " + str(node.Parent.Name) ) xsi.LogMessage( indent + "node root: " + str(node.RootNodeContainer.Name) ) # Node port group info portGroupCount = node.PortGroupCount xsi.LogMessage( indent + "number of groups: " + str(portGroupCount) ) for iGroup in range(portGroupCount): nPortsInGroup = node.GetPortCount(iGroup) xsi.LogMessage( indent + "number of ports in group " + str(iGroup) + ": " + str(nPortsInGroup) ) nGroupInst = node.GetGroupInstanceCount(iGroup) xsi.LogMessage( indent + "number of instances of group " + str(iGroup) + ": " + str(nGroupInst) ) for iInst in range( nGroupInst ): for iPort in range( nPortsInGroup ): xsi.LogMessage( indent + "port " + str(iPort) + "," + str(iGroup) + "," + str(iInst) ) p = node.GetPortFromIndex(iPort,iGroup,iInst) xsi.LogMessage( indent + "port name: " + p.Name ) xsi.LogMessage( indent + "output port: " + str(p.IsOutput) ) # Node input port info inPorts = node.InputPorts inputPortCount = inPorts.Count xsi.LogMessage( indent + "node input ports: " + str(inputPortCount) ) # Node output port info outPorts = node.OutputPorts outputPortCount = outPorts.Count xsi.LogMessage( indent + "node output ports: " + str(outputPortCount) ) nodeCount = 0 nodes = () if node.IsClassOf( constants.siICENodeContainerID ): # The input node might be a ICETree or ICECompoundNode, let's get their ICENodes nodes = 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 navigating the graph cube = xsi.Selection(0) cubeICETree = cube.ActivePrimitive2.ICETrees[0] level = 0 TraverseNodeGraph( cubeICETree, level ) |