CustomOperator.AddOutputPort

Introduced

v4.0

Description

Adds an OutputPort to the custom operator. It is recommended that each operator uses only a single output, but multiple outputs are supported. Warning: This method is not available after the operator has been connected (see Operator.Connect).

Scripting Syntax

oReturn = CustomOperator.AddOutputPort( PortTarget, [PortName], [PortGroup], [InsertAt], [Flags] );

Return Value

The newly created OutputPort.

Parameters

Parameter Type Description
PortTarget Variant Object or full name of the object to connect to the port. Softimage will remember the full name of the object, but this can be overridden at connection time to connect to a different object (see Operator.Connect and Operator.ConnectToGroup).
PortName String Name of the port

Default Value: The default name is "Out" + the Parameter.ScriptName of the object being connected, for example "Outposx".

PortGroup Long Index of the port group.

Default Value: -1

InsertAt Long Index of the port at a specific index.

Default Value: -1

Flags Long Mask of port group flags described by siPortFlags.

Default Value: 0

Examples

JScript Example

/*
        This example illustrates how to use the AddOutputPort method to define 
        an output port.
*/
NewScene( null, false );
var obj = CreatePrim( "Cube", "MeshSurface");
var sop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" )
var group = sop.AddPortGroup( "MainGroup" );
sop.AddOutputPort( obj.ActivePrimitive, "OutPolygonMesh", group.Index );
sop.AddInputPort( "cube.polymsh", "InPolygonMesh", group.Index );
sop.Connect();
// The operator's update function
function MyOperator_Update( ctx, out, in1 ) 
{
        Application.LogMessage( "MyOperator_Update: " + out.Value );
        var aPos = in1.Value.Geometry.Points.PositionArray.toArray();
        out.Value.Geometry.Points.PositionArray = aPos;
}

See Also

CustomOperator.AddOutputPortByClassID AddCustomOp