MEL and Expressions
Expressions are MEL commands that are implemented in the Expression Editor, and are calculated at every frame. A valuable tool, it is easily one of the most powerful features that Maya has to offer.
Tip: By default, all constraints/nodes are evaluating. When working with Expressions, use the Evaluate All/Disable All (EnableAll; DisableAll;) options along with Interactive Playback (InteractivePlayback;) for debugging/troubleshooting.
A weighted character mesh, deformed only by joints through the use of Expressions. |
|
The mesh shown is weighted to a max of 4 influences per vertex. See below images for the full body expression script used, or here for the posing demo, and the Python script/tool used in the scene.
Main considerations: – as the hand rotates/twists, the mesh going up the arm has diminished twists based on the hand rotation value (forearm, biceps) – as the forearm bends inward, the elbow pulls back to have a sharper point – as the arms are stretched forward, the back/shoulder blades are pulled back so as not to cave in, and the chest is pulled forward and inward – as the arms are stretched back, the back/shoulder blades are inward, and the chest is pulled outward and towards the back – as the arm is raised overhead, the armpit comes into the body, and the shoulders/traps keep shape coming inward to the neck – belt strap deformation to accommodate rotations in the arm, shoulder, and chest/back/armpit areas – as the body twists, the waist area has diminished twist values – as a leg is raised, the pack around the belt transforms up and rotates outward Get the song here. |
---|
An example of using more complex MEL script procedures in the Expression Editor to create more powerful deformations. | |
---|---|
The mesh shown is weighted to a maximum of 3 influences per vertex. Below are the procedures for finding the distance between two vectors, and how to get the length ratio between 3 vectors (when paired with the first procedure).
|
A few more examples of using simple MEL commands/scripts in the Expression Editor to create dynamic deformations. | |
---|---|
|
The meshes shown are weighted to a maximum of 3 influences per vertex. Below are example expressions to create the counter-twists, and mirroring animations.
|
An example tool window developed in MEL. |
|
---|---|