Maya Embedded Language


The Maya Embedded Language is a scripting language used to simplify tasks in Autodesk's 3D Graphics Software Maya. Most tasks that can be achieved through Maya's GUI can be achieved with MEL, as well as certain tasks that are not available from the GUI. MEL offers a method of speeding up complicated or repetitive tasks, as well as allowing users to redistribute a specific set of commands to others that may find it useful.

Design

MEL is syntactically similar to Perl and Tcl. It provides some memory management and dynamic array-allocation, and offers direct access to functions specific to Maya. The majority of standard Maya commands are default MEL scripts, saved in the Maya Program Files directory.
MEL is fairly limited compared to mainstream scripting languages. Mel is primarily a language meant to journal the Maya session, thus lacks many advanced features such as associative arrays. Python was added to Maya as an alternative to MEL in Maya 8.5. Still MEL offers some advantages to Python:
MEL is often criticized for its lack of programming features, and object orientation. In practice, however, MEL is used as a metaprogramming language where MEL just instructs Maya's node architecture to solve the problem. Since nodes form the actual computational core of Maya using a more robust readily apparent programming method would be a very inefficient approach. In many ways MEL complements the Maya API, with somewhat clear boundaries between allocated tasks. This makes MEL harder to learn and fully understand.

Uses

The tools designed using MEL scripts generally come under the following categories:
This is an example of a script which copies a selected object through its path:

// animated duplicates/instances script
proc animatedDuplication
// Usage example:
// duplicate the current selection 5 times --
// evenly distributed between frame 1 and 240
animatedDuplication;

Features

Maya also offers an expression language that is a super-set of MEL, and results in nodes that are executed as part of Maya's dependency graph. Expressions are developed with Maya's expression editor, and allow scripts to trigger while Maya evaluates the scene file at each change in time, to simulate complex behaviors or perform other useful tasks.