Getting values and fcurves for the port parameters of an ICE node


ICE nodes have ports, and the ports have parameters. It’s the parameters that you work with in an ICE node PPG.

For simple types such as float, integer and boolean, you can access the port parameter value through ICENodeInputPort.Value. However, for more complex types, like a 3D vector, you need to go through the ICENodeInputPort.Parameters.

In either case (simple or complex types), to get an Fcurve, you get a parameter and then use Parameter.Source.

For example, suppose you have a Scalar node:
ports_params_Scalar
To get the value from a Scalar node, you’d do this:

si = Application
node = si.Dictionary.GetObject( "pointcloud.pointcloud.ICETree.ScalarNode" )
port = node.InputPorts(0)

# For scalars, you can just use the port.Value property
print port.Value

# Or you could go through the Parameters
print port.Parameters(0).Value
# 0.428628623486
# 0.428628623486

# It's a little confusing because the port and the parameter have the same name:
print port.FullName
print port.Parameters(0).FullName
# pointcloud.pointcloud.ICETree.ScalarNode.value
# pointcloud.pointcloud.ICETree.ScalarNode.value


# Now get the Fcurve
fcv = param.Source

Now consider the case of a 3D Vector node, where you have one port (value) and three parameters (value_x, value_y, and value_z):
ports_params_3DVector
In this case, you cannot use ICENodeInputPort.Value, so you have to go through the parameters collection:

si = Application
node = si.Dictionary.GetObject( "pointcloud.pointcloud.ICETree.3DVectorNode" )
port = node.InputPorts(0)
print port.FullName # pointcloud.pointcloud.ICETree.3DVectorNode.value
param = port.Parameters( 0 )
print param.FullName # pointcloud.pointcloud.ICETree.3DVectorNode.value_x
print param.Value # 0.933080613613

# Now get the Fcurve
fcv = param.Source

hat tip: Alan Fregtman

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s