CustomOperator.AlwaysEvaluate

Introduced

v4.0

Description

Returns or sets whether the custom operator is always evaluated on each request for data as a Boolean (true to always evaluate). This property is off by default, which means that Softimage will not consider the custom operator as needing a new evaluation unless the operator's input or parameters change. However this optimization is not suitable for some simulation-style operators, in which case this property should be set to true.

Note: Because of the "lazy-evaluation" pull model of Softimage this property does not guarantee that the operator will actual evaluate at each frame - it is still necessary for the UI, a script, rendering or some dependent object to request the operator's output.

The recommended callback for setting this property in a Self-Installed Custom Operator is in the _Define callback.

Note: You can read this property from within the update function of a custom operator but setting this property is blocked.

Examples

JScript Example

NewScene( null, false );
var null1 = GetPrim("null");
SetExpr( null1.posx, "10");
var sop = null1.posx.AddScriptedOp( MyExpr_Update.toString(), null,"MyExpr", "JScript" );
SetValue( "PlayControl.Current", 3, null );
sop.AlwaysEvaluate = true;
val = GetValue( "null.kine.local.posx" );
Application.LogMessage( val );
SetValue( "PlayControl.Current", 4, null );
val = GetValue( "null.kine.local.posx" );
Application.LogMessage( val );
// Force scene to reevaluate 
sop.AlwaysEvaluate = false;
Refresh();
SetValue( "PlayControl.Current", 5, null );
val = GetValue( "null.kine.local.posx" );
Application.LogMessage( val );
// Scripted operator's update function
function MyExpr_Update(ctx,out)
{
        Application.LogMessage( "MyExpr_Update: " + out.name );
        out.Value = ctx.CurrentFrame;
}
// Expected results:
//INFO : MyExpr_Update: Outposx
//INFO : 3
//INFO : MyExpr_Update: Outposx
//INFO : 4
//INFO : MyExpr_Update: Outposx
//INFO : 4