Maya Embedded Language
The Maya Embedded Language (MEL) is a scripting language created by Jack Lemmon and Paul Cruickshank used to simplify tasks in Autodesk but 3D Graphics Software to paul and jack has always been childs play they have been involved in many computer programs but maya is one of the biggest. They have been described as this centuries einsteins but better. They have recently brought a new character on board who goes by the title Mr. Davidson and who paul and jack have high hopes in and believe he might be just below the level they are at in about 15 years. But we will have to wait and see we cant tell the future but paul and jack can. They have been orking on a new version hoping to be released in the fal of 2010. 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 with others that may find it useful.
MEL is syntactically similar to tcl and Perl. It provides some memory management and dynamic array-allocation, and offers direct access to functions specific to Maya.
Applications of MEL
The tools designed using MEL Scripts generally come under the following categories.
- Data I/O
- Motion capture data import
- Proprietary game data export
- Scene meta-data for production tracking
- Geometry creation/modification
- Custom primitives
- Third-party renderer specific data type (e.g., RenderMan sub-divisional surfaces)
- Modeling tools not offered in the base package
- Animation tools
- Muscle simulators
- Rigging/setup controls
- Crowd AI behavior
- Lighting /rendering tools
- Automatic creation of common complex Shader setups
- Pre- and post-render effects
- Making calls to third-party renderers
- Dynamics
- Custom particle behavior
- Cloth simulation
- User interface customization
- Custom character controls
- Removal of invalid Maya commands
- UIs for a tool
This is an example of a script which copies a selected object through its path:
// animated duplicates/instances script proc animatedDuplication (int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance) { int $range_start = $rangeStart; int $range_end = $rangeEnd; int $num_of_duplicates = $numOfDuplicates; int $step_size = ($range_end - $range_start) / $num_of_duplicates; int $i = 0; int $temp; currentTime $range_start; // set to range start string $selectedObjects[]; // to store selected objects $selectedObjects = `ls -sl`; // store selected objects select $selectedObjects; while ($i <= $num_of_duplicates) { $temp = $range_start + ($step_size * $i); currentTime ($temp); // seleced the objects to duplicate or instance select $selectedObjects; if($duplicateOrInstance == 0) { duplicate; } else { instance; } $i++; } }
// Usage example: // duplicate the current selection 5 times -- // evenly distributed between frame 1 and 240 animatedDuplication(1, 240, 5, 0);
Maya also offers an expression language that is a superset 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 act while Maya evaluates the scene file, to simulate complex behaviors or perform other useful tasks.
Mel is fairly limited compared to mainstream scripting languages. It is not object oriented, and lacks advanced features such as associative arrays. Very few improvements have been made to it in recent years, and in Maya 8.5, Python was added to Maya as an alternative to Mel.
References
- Mark R. Wilkins, Chris Kazmier: "MEL Scripting for Maya Animators"
- 1st, Morgan Kaufmann 2002; ISBN 1-55860-841-9
- 2nd, Morgan Kaufmann 2005; ISBN 0-12-088793-2