What is a Custom ICENode?

 
 
 

Custom ICENodes are regular ICENodes implemented as self-installable plug-ins with the C++ API. Like built-in ICENodes, a custom ICENode reads in data, processes it and then writes out the data.

An ICENode can be used along with other custom or built-in ICENodes to create compound nodes. Input and output data comes from the other ICENodes in a graph: the data flows along each ICENode encapsulated in single or 2D array. The type of data encapsulation is specified when a new ICENode is registered in Softimage. For example, an ICENode can be defined with an input connection of float and an output connection of float vectors.

XSIPLUGINCALLBACK CStatus XSILoadPlugin( PluginRegistrar& in_reg )
{
	in_reg.PutAuthor(L"SoftimageUser");
	in_reg.PutName(L"MySimpleICENode Plugin");

	enum IDs
	{
		ID_InPort = 0,
		ID_OutPort = 1,
		ID_InGroup = 100,
		ID_TMAP = 400,
		ID_SMAP,
		ID_CMAP,
		ID_UNDEF = UINT_MAX
	};

	ICENodeDef nodeOpDef;
	nodeOpDef = Application().GetFactory().CreateICENodeDef(L"MySimpleICENode");

	// Add input port and group.
	CStatus st;
	st = nodeOpDef.AddPortGroup( ID_InGroup );
	st.AssertSucceeded( ) ;

	st = nodeOpDef.AddInputPort( 
		ID_InPort, // port index (defined in IDs enum)
		ID_InGroup, // index of group to add port to
		siICENodePortDataFloat, // data type
		siICENodePortStructureSingle, // structure type
		siICENodeEvaluationContextAny, // context type
		L"InFloats", // port name
		L"InFloats			"// port scripting name
	);
	st.AssertSucceeded( ) ;

	// Add output port.
	st = nodeOpDef.AddOutputPort( 
		ID_OutPort, // port index (defined in IDs enum)
		siICENodePortDataFloat, // data type
		siICENodePortStructureSingle, // structure type
		siICENodeEvaluationContextAny, // context type
		L"Out2DVectors", // port name
		L"Out2DVectors 		"// port scripting name
	);
	st.AssertSucceeded( ) ;

	// Register a new ICENode definition
	PluginItem nodeItem = in_reg.RegisterICENode( nodeOpDef );

	// Set the new ICENode category
	nodeItem.PutCategories(L"ICENode Category Sample");

	return CStatus::OK;
}

The Evaluate callback is typically called in a multi-threaded context managed by Softimage, so you don't have to worry about thread locking when reading or writing the data passed to a custom ICENode. Evaluation threads are created by Softimage and assigned on a per-processor basis, so there will be one thread created per processor on your machine. The data is process in several passes where each pass is assigned to a thread.

You can also tell Softimage to process your custom ICENode in a single-thread or in multi-phase processing. Single-threading processing is often required when you need to access all the input data in one single pass. For instance you could create a node to compute the bounding-box of a geometry which requires access to the entire set of point positions in one pass. See Single-Thread Custom ICENode for more information. Multi-phase processing gives more control on the ports to evaluate and the context data types to process. See Multi-Phase Custom ICENode for more information.

See the Custom ICENode example located in the examples folder of the Softimage SDK installation directory.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License