/*
This example demonstrates how to create and instantiate a runtime
custom operator and connect it to a cube.
*/
NewScene( null, false );
var obj = CreatePrim( "Cube", "MeshSurface");
function MyOperator_Update( ctx, out, in1 )
{
Application.LogMessage( "MyOperator_Update: " + out.Name );
var apos = in1.Value.Geometry.Points.PositionArray.toArray();
out.Value.Geometry.Points.PositionArray = apos;
}
var sop = XSIFactory.CreateScriptedOp( "MyOperator", "", "JScript" )
sop.AddOutputPort( obj.ActivePrimitive );
sop.AddInputPort( "cube.polymsh" );
sop.Code = MyOperator_Update.toString()
sop.Connect();
|