Expressions

 
 
 

Expressions in a general sense are mathematical formulas that combine numbers, variables, operators, functions and other expressions, do not contain an equal sign (=), and evaluate to a numerical or boolean value, fcurve, or graph.

Expressions in Softimage are a type of DataSource that can be applied to a Parameter or Parameter to drive its value (animate it). At its core is the expression definition, which contains a mathematical formula (an expression in the general sense) stored in a string. Expression definitions can be constructed from the set of functions, operators, variables, and constants available from the Expression Reference. For example, to link object A's Y rotation to object B's X translation, you would set an expression on the A.kine.local.roty parameter using this expression definition:

"l_fcv(B.kine.local.posx)"

Tip

For a complete listing of all functions and tokens available to use as part of your expression definition, see Expression Reference.

In the UI the animation expression appears as a a special Expression operator nested under its owner's parameter node in the explorer. It acts like a special kind of property which can be inspected and contains a set of parameters which contain data related to the expression (for example, the expression definition is contained in the Definition parameter).

Note

For more information on animating with expressions in Softimage via the UI, see the Softimage user guide.

From the perspective of the SDK, an Expression or Expression object is a kind of a stunted Operator or Operator object. You can access the set of parameters affecting the driven parameters using the Operator.InputPorts or Operator::GetInputPorts property, but port groups are not fully supported.

Note

You cannot directly use more than one animation source (for example, keyframes and an expression) on the same parameter. To combine animation sources, you must store actions for use in the animation mixer.

Special Parameters on the Expression Property

Parameters driven by expressions have four extra parameters nested under the Expression or Expression object which are accessible by iterating over the Expression's ParameterCollection or ParameterCollection. These parameters contain this information:

Parameter

Description

Active

True by default; setting this parameter to false mutes the link.

Target

Returns the name of the target parameter (that is, the parameter that owns the expression). Read only.

Definition

This is the real meat of the expression: you can change this string definition if you need to change the link or even remove the link entirely.

Comment

Nothing specified by default.

Note

Depending on what kind of expression is controlling the parameter, there may also be other parameters that appear. If the expression defines a linked parameter, you will have access to an FCurve or FCurve via the Parameter.Source or Parameter::GetSource property. For multi-linked parameters, the Interpolation Property or Property is available instead. For more information, see Expression Reference.