Object Hierarchy | 関連する C++クラス:ICENodePort
ICENodePort
v7.0
ICENodePort は、ICENodeInputPortやICENodeOutputPortなどのICENodeポートの基本クラスです。ICENodePort は、ICENode の接続ポイントであり、他の ICENodePort オブジェクトに接続されます。ICENodePort は、何かに接続することもできますし、接続せずにおくこともできます。ポートは、Softimage オペレータのPortに似たグループで配列されます。ここでは、グループは複数のポート接続で理論的にグループ化されます。
# # This example shows how to access the ports of ICENode objects # import win32com.client from win32com.client import constants xsi = Application # ICENodePort introspection def LogICENodePort( in_nodeport, level ): indent = level * '.' xsi.LogMessage( "* * * " ) xsi.LogMessage( indent + "node port: " + in_nodeport.FullName ) xsi.LogMessage( indent + "node port parent: " + in_nodeport.Parent.FullName ) xsi.LogMessage( indent + "node port class: " + xsi.ClassName( in_nodeport ) ) xsi.LogMessage( indent + "output node port: " + str(in_nodeport.IsOutput) ) xsi.LogMessage( indent + "connected: " + str(in_nodeport.IsConnected) ) xsi.LogMessage( indent + "group port index: " + str(in_nodeport.Index) ) xsi.LogMessage( indent + "group index: " + str(in_nodeport.GroupIndex) ) xsi.LogMessage( indent + "group instance index: " + str(in_nodeport.GroupInstanceIndex) ) xsi.LogMessage( indent + "type: " + str(in_nodeport.DataType) ) xsi.LogMessage( indent + "structure type: " + str(in_nodeport.StructureType) ) xsi.LogMessage( indent + "evaluation context type: " + str(in_nodeport.ContextType) ) connectednodes = in_nodeport.ConnectedNodes count = connectednodes.Count xsi.LogMessage( indent + "connected nodes: " + str(count) ) for i in range(count): xsi.LogMessage( indent + "connected node: " + connectednodes[i].Name ) # Log the port parameters params = in_nodeport.Parameters for param in params: xsi.LogMessage( indent + "parameter: " + param.ScriptName + ":" + str(param.GetValue2()) ) # 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 ) # Log all ICENodePorts for this node inPorts = in_node.InputPorts inputPortCount = inPorts.Count xsi.LogMessage( indent + "node input ports: " + str(inputPortCount) ) for i in range(inputPortCount ): nodeport = inPorts[i] LogICENodePort( nodeport, level+2 ) outPorts = in_node.OutputPorts outputPortCount = outPorts.Count xsi.LogMessage( indent + "node output ports: " + str(outputPortCount) ) for i in range(outputPortCount ): nodeport = outPorts[i] LogICENodePort( nodeport, level+2 ) 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 ) |