Object Hierarchy | 関連する C++クラス:ICENode
ICENode
v7.0
ICENode クラスは、Softimage ICE グラフのビルトインまたはカスタムエフェクトノードを表します。ICENodes は、ICECompoundNodeオブジェクトとして表され、コンパウンドノードと呼ばれるサブグラフで組み立てることができます。
ICENode クラス API は、ポート、ポートグループ、ポートグループインスタンスなどのエフェクトノードのさまざまなコンポーネントにアクセスする場合に便利です。ノードポートは、Softimage オペレータのPortに似たグループで配列されます。ここでは、グループは複数のポート接続で理論的にグループ化されます。他の ICENode オブジェクトは、ICENodeInputPortおよびICENodeOutputPortとして表されたポートを介して ICENode にアクセスできます。
# 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.ActivePrimitive.ICETrees[0]
level = 0
TraverseNodeGraph( cubeICETree, level ) |