/*
This example demonstrates how to create a runtime scripted operator and connect
it to the first cube, disconnect it, and then reconnect it to a second cube.
*/
// Update function for scripted operator
function MyOperator_Update( ctx, Out, InPolymsh )
{
var aPos = InPolymsh.Value.Geometry.Points.PositionArray.toArray();
Out.Value.Geometry.Points.PositionArray = aPos;
}
// Create a new scene with two cubes
NewScene( null, false );
var obj1 = CreatePrim( "Cube", "MeshSurface");
var obj2 = CreatePrim( "Cube", "MeshSurface");
// Create a runtime scripted operator
var scop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" );
scop.AddIOPort( obj1.ActivePrimitive );
// Connect operator to obj1
scop.Connect( obj1 );
// Disconnect operator from obj1
scop.Disconnect();
// Reconnect operator to obj2
scop.Connect( obj2 );
|