MEL How-To #01

Back · Previous · Next Maya

How do you find out all these things about MEL? I can't find some things in the documentation!

Believe it or not, I always recommend Maya's MEL documentation to learn the syntax: bookmark the "MEL Functions: Alphabetical" page. Check out all of the MEL commands available. Browse the DG node docs as well to get a sense of the internal workings and relationships.

Also, I snoop a lot. I scan and search the "internal" MEL scripts that activate tools, perform commands, create windows and dialogs.

Turn on the "Echo All Commands" option in the Script Editor and find out what commands are executed as Maya performs an action you are curious about. Be aware, however, that many commands you see echoed in the Script Editor are not actual "commands" but are in fact ancillary procedures implemented through MEL. The documentation only lists those functions which are built into Maya's kernal and not those written in MEL.

Many of these MEL procedures commonly used by Maya are not the "primary" function of their script file and cannot be tracked simply by looking for a MEL script of the same name. An example of this is ‘PolySelectConvert’.

If you turn on Echo All Commands and select the menu item:

Polygons -> Selection -> Convert Selection To Faces 

You will see the following command echoed to the Script Editor:

PolySelectConvert 1

This is not a Maya command and thus it is not documented. Additionally, in Maya v2.5 this is not the "primary" function of a script file named "PolySelectConvert.mel". The procedure is found in:

<MAYA_INSTALL_DIR>/scripts/startup/PolygonsMenu.mel

Scanning this script reveals that the actual command that is doing the work is in fact:

polyListComponentConversion

That is a Maya command and is documented.

Just for the record, in Maya v3 the PolySelectConvert procedure has earned its own MEL script.

The ‘whatIs’ MEL command can assist in tracking the source of these commands. It tells you whether the queried procedure is an internal command or a script, and if the latter, in which file the script resides:

whatIs PolySelectConvert;
// Result: Script found in: D:/AW/Maya2.5/scripts/startup/PolygonsMenu.mel //
whatIs PolySelectConvert;
// Result: Script found in: D:/AW/Maya3.0/scripts/others/PolySelectConvert.mel //

Failing this, it may be necessary to search through all of Maya's installed MEL scripts with some form of "Find In Files" function to find where and how a procedure is implemented (I use TextPad and its Search Files function). Useful search criteria for this search may be the procedure name, arguments used by Maya when calling the procedure, or a text label used within one of Maya's menus or windows. Matches found from this text can reveal what procedures are involved with a command or UI control.

I get a lot from Maya Mailing Lists as well. You can browse the Maya ML Archives at:

A final thought: Sometimes what you need is not documented.. at least not literally. It's all a matter of understanding how Maya's command pipeline works, being nosy, and tracking down what's really doing the work.

Monday, December 17, 2001