Go to: Synopsis. Return value. Flags. MEL examples.

Synopsis

expression [-alwaysEvaluate uint] [-animated uint] [-attribute string] [-name string] [-object string] [-safe] [-shortNames] [-string string] [-timeDependent] [-unitConversion string]

expression is undoable, queryable, and editable.

This command describes an expression that belongs to the current scene. The expression is a block of code of unlimited length with a C-like syntax that can perform conversions, mathematical operations, and logical decision making on any numeric attribute(s) in the scene. One expression can read and alter any number of numeric attributes. Theoretically, every expression in a scene can be combined into one long expression, but it is recommended that they are separated for ease of use and editing, as well as efficiency.

If this command is being sent by the command line or in a script, then the user should be sure to embed escaped newlines (\n), tabs (\t) for clarity when reading them in the expression editor. Also, quotes in an expression must be escaped (\") so that they are not confused by the system as the end of your string. When using the expression editor, these characters are escaped for you unless they are already within quotes.

Note, expressions that alter or use per-particle attributes of a particle shape should use the 'dynExpression' command.

Return value

stringThe name of the expression

In query mode, return type is based on queried flag.

Flags

alwaysEvaluate, animated, attribute, name, object, safe, shortNames, string, timeDependent, unitConversion
Long name (short name) Argument types Properties
-alwaysEvaluate(-ae) uint createqueryedit
If this is TRUE (the default), then the expression will be evaluated whenever time changes regardless of whether the other inputs have changed, and an output is requested. If it is FALSE, then the expression will only be evaluated if one or more of the inputs changes and an output is requested. Note, if 'time' or 'frame' are inputs, then the expression will act as if this was set to TRUE.
-animated(-an) uint createqueryedit
Sets the animation mode on the expression node: 0 = Not Animated, 1 = Animated, 2 = Animated with No Callback.
-attribute(-a) string createqueryedit
Sets the name of the attribute to use for the expression
-name(-n) string createqueryedit
Sets the name of the dependency graph node to use for the expression
-object(-o) string createqueryedit
Sets the "default" object for the expression. This allows the expression writer to not type the object name for frequently-used objects. See the examples below.
-safe(-sf) query
Returns true if no potential side effect can occurs running that expression. Safe expression will be optimized to evaluate only when needed even if flagged alwaysEvaluate.
-shortNames(-sn) createqueryedit
When used with the -q/query flag, tells the command to return the expression with attribute names as short as possible. The default is to return the FULL attribute name, regardless of how the user entered it into the expression, including the object names. With this flag set, attribute names are returned as their short versions, and any attribute that belongs to the default object, if there is one specified, will not display the object's name.
-string(-s) string createqueryedit
Set the expression string
-timeDependent(-td) query
Returns true if expression is evaluated when time change. An expression can be time-dependent for the following reasons: - The expression refers to 'time' or 'frame' keywords. - The expression have side effects (unsafe). - The expression node's "time" attribute is connected manually. If the expression is safe and not time dependend, then they will always evaluate on depend, even if alwaysEvaluate is on.
-unitConversion(-uc) string queryedit
Insert specified unit conversion nodes at creation: "all", "none," or "angularOnly." Default is "all." For angularOnly, will insert unit conversion nodes only for angular attributes (allowing degrees-to-radians conversion). This is for performance tuning. If queried, returns the option used when the expression was created or last edited.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

expression -s "a.translateX = b.translateX * sin(c.translateX)";

expression -o "ball" -s "tx = sin(time);";