Expression

Object Hierarchy | Related C++ Class: Expression

Inheritance

SIObject

ProjectItem

Operator

Expression

Introduced

v2.0

Description

An Expression object is a kind of Operator representing an animation source on a parameter which you can create with Parameter.AddExpression. Expressions in Softimage allow you to control animatable parameters through a mathematical formula, which may include references to the value of other parameters. This formula is stored as the value of the "Definition" Parameter, and it can be changed via the Object Model as shown in the example below.

If a Parameter's value is driven by an Expression then the Expression can be retrieved via the Parameter.Source property.

Since the expression object is kind of operator, you can use the Operator.InputPorts property to access the parameters from which the expression is reading. Access to port groups is also provided (since this is a kind of operator); however, the expression doesn't define port groups but will pretend it has one for easy access through the SDK (see Operator.GetNumPortGroups for more details).

For more details, see "Expression Reference" in the Softimage User?s Guide.

Methods

AddCustomOp AddScriptedOp AddScriptedOpFromFile AnimatedParameters2
BelongsTo operator Connect ConnectToGroup Copy
Disconnect DisconnectGroup EvaluateAt GetICEAttributeFromName
GetInputValue GetNumInstancesInGroup operator GetNumPortGroups operator GetNumPortsInGroup operator
GetPort2 operator IsA IsAnimated2 IsClassOf operator
IsEqualTo operator IsKindOf IsLocked operator IsSelected operator
LockOwners PortAt operator SetAsSelected operator SetCapabilityFlag operator
SetLock SupportsBranchGroup operator TaggedParameters UnSetLock

Properties

Application BranchFlag operator Capabilities operator Categories
EvaluationID Families operator FullName operator Help
HierarchicalEvaluationID ICEAttributes InputPorts operator IsConnected operator
LockLevel operator LockMasters operator LockType operator Model
Mute operator Name operator NestedObjects ObjectID
Origin OriginPath OutputPorts operator Owners
PPGLayout operator Parameters operator Parent Parent3DObject
Port operator PortGroups operator Selected operator Type operator

Examples

JScript Example

// This example illustrates how to apply an expression and access it.
NewScene( null, false );
var oNull = ActiveSceneRoot.AddNull();
var oAnotherNull = ActiveSceneRoot.AddNull("AnotherNull");
strExpr = oAnotherNull.posy.FullName + " + 2";
var oExpr = oNull.posx.AddExpression(strExpr);
//You can access the parameter to which an expression is connected by using the output port.
Application.LogMessage("Parameter owner of the expression " + oExpr.OutputPorts(0).Target2.FullName);
//You can access the parameter which are used inside an expression by using the input ports of 
//the expression operator.
var oInputPorts = oExpr.InputPorts
for(i = 0; i < oInputPorts.Count; i++)
{
        Application.LogMessage("Parameter client of the expression " + oInputPorts(i).Target2.FullName);
}
// Formula that defines the expression is available as a Parameter value
oDefinitionParam = oExpr.Parameters( "Definition" )
Application.LogMessage( "Expression definition :" + oDefinitionParam.Value) ;
// Expression can be changed
strNewExpr = oAnotherNull .posy.FullName + " - " + oAnotherNull .posx.FullName ;
oDefinitionParam.Value = strNewExpr ;
Application.LogMessage( "New expression definition : " + oDefinitionParam.Value ) ;
// Show the new expression formula in action
oAnotherNull.posy = 10 ;
oAnotherNull.posx = 4 ;
// Value should be 10 - 4 = 6
Application.LogMessage( "With new expression posx is " + oNull.posx.value ) ;
// Remove the expression
oNull.posx.Disconnect() ;
//INFO : Parameter owner of the expression null.kine.local.posx
//INFO : Parameter client of the expression AnotherNull.kine.local.posy
//INFO : Expression definition :AnotherNull.kine.local.posy + 2
//INFO : New expression definition : AnotherNull.kine.local.posy - AnotherNull.kine.local.posx
//INFO : With new expression posx is 6

See Also

Parameter.Source Parameter.AddExpression Parameter.Value AddExpr SetExpr