Port.Target2
 
 
 

Port.Target2 operator

Introduced

v3.0

Description

Returns the connected object (KinematicState, Primitive, etc.) to which this port is connected, this can be used to access the name or path of the object. It is possible to access other output ports within the context of the _Update function of a custom operator however, this is not recommended and the results cannot be guaranteed. Within the context of a custom operator's _Update function you should only access the current OutputPort object available via as an argument to the function and any InputPort object.

Port.Target2 replaces Port.Target which returns a ProjectItem and didn't allow you access to non-ProjectItem objects such as the Parameter object.

C# Syntax

// get accessor
Object rtn = Port.Target2;

Examples

VBScript Example

'
' This example demonstrates how to find the object connected to the input port for a built-in Softimage operator
'
' Add a cube to the scene and apply the edge operator
set oRoot = Application.ActiveProject.ActiveScene.Root
set oObject = oRoot.AddGeometry( "Cube", "MeshSurface" )
AddEdge oObject.FullName & ".pnt[LAST];" & oObject.FullName & ".edge[1]", 21.019
' Find the operator in the stack
set oOperator = oObject.ActivePrimitive.ConstructionHistory.Find( "addedgeop" )
if TypeName(oOperator) <> "Nothing" then
        ' Find the input primitive 
        for each oInputPort in oOperator.InputPorts
                set oTarget = oInputPort.Target2
                if TypeName( oTarget ) = "Primitive" then
                        Application.LogMessage "addedge operator is reading from the primitive"
                end if
        next
else
        Application.LogMessage "cannot find operator"   
end if