Update

Description

Update is called whenever an operator is expected to evaluate itself. This is the most important callback for a custom operator. The data is read, manipulated, and written back to the connected objects all within the scope of the Update callback. If there are multiple outputs Update is called once per output port.

Through the OperatorContext object, the Update callback has access to the custom parameters and port connections.

To Read Custom Parameters on the Operator

Use GetParameterValue to read the parameters of the operator. This is faster and more convenient that reading it from the operator.

To Read Inputs

Use GetInputValue to access the data that is connected to the operator. If the input is a parameter this returns the actual parameter value (for example, a number). If the input is an object (Primitive, KinematicState, ClusterProperty etc.) then the SDK object representing that object is returned.

To Read Outputs

In order for the operator to change any scene data it needs to change the value of the currently evaluated output. If the current output of the operator is a parameter, use OperatorContext.OutputPort and then OutputPort.Value on that port. If the current output is an object, use OperatorContext.OutputTarget to retrieve the SDK object that represents the output and change its state using the object model.

If the operator is a multi-output operator (not normally recommended) then use OperatorContext.OutputPort and SIObject.Name on the OutputPort to determine which port is currently being evaluated.

 

Don’t confuse setting the output value with the return value of this callback function. The callback return value should always be true in scripted operators and CStatus::OK in C++ API operators unless a severe error condition has been detected (such as unexpected inputs or output objects).

Applies To

Custom Operators

Syntax

// C#
public class <operator_name>
{
   public bool Update( Context in_ctxt )
   {
       ...
   }
}

 

// C++
CStatus <operator_name>_Update( CRef& in_context )
{
   ...
}

// JScript
function <operator_name>_Update( in_context )
{
   ...
}

# Python
def <operator_name>_Update( in_context ):
   ...

' VBScript
Function <operator_name>_Update( in_context )
   ...
End Function

# PerlScript
sub <operator_name>_Update 
{
   my $in_context = shift;
}

<operator_name> is the name specified in the call to PluginRegistrar.RegisterOperator, with any spaces removed.

Parameters

Parameter

Language

Type

Description

in_context

Scripting and C#

OperatorContext

Context.Source returns the CustomOperator.

C++

CRef &

A reference to the OperatorContext object.

Context::GetSource returns the CustomOperator .

See Also

Define

DefineLayout

Init (Operator)

Operator Callbacks



Autodesk Softimage v7.5