Mel - Maya Embedded Language

<HOME>   <PREVIOUS>   <NEXT>

Expressions

Espressions are simply runtime MEL commands that manipulate any given attribute in Maya. This can occur when the animation starts (creation) or as the animation plays (runtime). To write an expression, you must open the expression editor

Windows / Animation Editors / Expression Editor

Name your expressions when creating them. Maya by default will give them the name expression1, expression2, etc... If you are using a vast amount of expressions this could get a little hairy when trying to edit a specific expression.

Choose Select Filter
Change this to by expression name.

This will show you all of the expression your Maya project currently holds. If you use the default by object/attribute name, Maya has a tendency to erase your expression if you have an error in it.

Creation Expression:

The code is executed once at the start of the animation. It is good for initially setting up objects and attributes before the animation starts. This is used extensively when programming particles.

Runtime Expression:

The code is executed on each frame of the animation. It is good for attributes that change incrementally, randomly or rhythmically over time. Runtime expressions can also be used to make a relationship between a few attributes. For instance, you can have the X translation of one object change the color of another.