OutputPort.Value operator

Description

This property is only available within the Update callback of a Operator. It is either set or read depending whether the output is a Parameter or an object.

When the operator OutputPort is connected to a Parameter, this property lets you set the value of the parameter. (Trying to change the value through Parameter.Value would have no effect).

When the operator OutputPort is connected to an object this property returns the SDK object corresponding to the output.

Note: In the case of an operator with multiple outputs, it is only correct to access this property on the currently evaluated output port.

Examples

JScript Example

/*
        This example illustrates how to use the OutputPort.Value property within 
        the context of the _Update function of a runtime scripted operator
*/
NewScene( null, false );
var oObject = Application.ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" );
apply_taper( oObject );
// This is the _Update callback used for the 'MyTaper' runtime operator
function MyTaper_Update( ctx, Out, InGeom )
{       
        // Get the taper factor.
        var dFactor = ctx.Parameters("Factor").Value
        // Get the array of point positions.
        var aPnts = InGeom.Value.Geometry.Points.PositionArray.toArray();
        // Taper
        for ( var i = 0; i < aPnts.length / 3; i++ )
        {
                var dTaper = (1 - ( aPnts[1 + (i*3)] * dFactor ))
                aPnts[0 + (i*3)] = aPnts[0 + (i*3)] * dTaper;
                aPnts[1 + (i*3)] = aPnts[1 + (i*3)];
                aPnts[2 + (i*3)] = aPnts[2 + (i*3)] * dTaper;
        }
        // Set the points by accessing the geometry via
        // the OutputPort.Value property
        Out.Value.Geometry.Points.PositionArray = aPnts;
}       
// This function creates the 'MyTaper' operator on the fly and then connects it
// immediately to the input object.
function apply_taper( oObject )
{
        var op = XSIFactory.CreateScriptedOp( "MyTaper", MyTaper_Update.toString(), "JScript" );
        // Define connections
        var ioport = op.AddIOPort( oObject.ActivePrimitive, "Geom" );
        // Define parameters
        var pdef = XSIFactory.CreateParamDef2( "Factor", siDouble, 0.5, 0, 1 );
        op.AddParameter( pdef );
        // Connect operator
        op.Connect( oObject );
}

See Also

Parameter.Value OperatorContext.OutputPort OperatorContext.OutputTarget