Adverti horiz upsell
Conversational MEL Part 3
Conversational MEL Part 3
JamesPiechota, updated 2006-11-30 18:04:17 UTC 39,335 views  Rating:
(1 rating)
Page 2 of 4

The Online MEL Command Reference


As we saw last article with the 'rename', 'ls', and 'substitute' commands � Maya ships with some pretty powerful tools built in. But how do you find these nuggets of MEL gold? Enter the online MEL Command Reference. The command reference lists all of the built-in MEL commands, as well as descriptions, and example uses.

The easiest way to get at the command reference is by hitting the F1 key when running Maya. Doing so will bring you to the Maya docs:

Maya docs

We'll pass by �Using Maya� and the fun sounding topics like �Fluid Effects� and �Toon Shading�, and move down to �Developer Resources�, where the light is darker, the air danker, and the likes of �File Formats� and �Environment Variables� live. Click �MEL Commands� to launch the online MEL Command Reference.

Developer Resources

The initial screen is divided into three parts: the search box, a list of command categories, and the full list of commands.

MEL Command Reference

Let's find some information about the 'button' command:

Search for the button command

This page which lists every command that contains the word 'button' � this can be very useful if you only remember part of a command name (e.g. 'poly', or 'slider'). Click 'button' to open its command documentation.

There are three parts to the command documentation: synopsis, flags, and examples:

Parts of a MEL command

The synopsis provides a highlevel overview of the command, as well providing information about the command target and return value.

Command synopsis

The next section lists all of the flags. Flags are listed by long and short names. To help you keep your brain young and agile, Maya does not alphabetize them. Below each flag name is a brief description of how they modify the behavior of the command. Over to the right you'll find the data type of any arguments the flag requires. And at the end, are a list of properties:

Flag docs

The properties of a flag indicate how the flag can be used. Q stands for query, C for create, and E for edit. Up until now we've only used flags in the create mode, the default.

Create


A create mode flag is used when you first create something, like a sphere or button, or when you are causing some action to occur, like renaming or moving an object. The sphere button we created in the first article has several examples of create mode flags:

button
-label
"Sphere"
-command
"polySphere;move -r 0 0 -2; move -r 0 1 0 ; ";

'-label', '-command' are create mode flags that set the label and command of a newly created button. '-r' is a create mode flag that indicates how an object is to be moved. Revisiting the spoken command example:

sit -location �here�;

'-location' is a create mode flag used to tell your dog where to sit.

Query


Many create mode flags are also query and edit mode flags. In order to use a flag in query mode you have to add the special '-q' flag to the command. When a flag is used in query mode, instead of setting some bit of data, it returns some bit of data. For example:

button -q -label button1;
// Result: Sphere //

Here, instead of setting the button's label, we're asking it to tell us what its current label is. Often a create mode flag requires a flag argument, but when you use that flag in query mode, no command argument is needed and none should be given. You may, however, note the 'button1' lurking at the end of the query command. Because there may be many buttons in your scene, when you query a flag you have to indicate which button it is you're talking to. In this case it's the cleverly named 'button1'.

Edit


Edit mode flags are very similar to create mode flags, except that they are used after an object has been created. To use a flag in edit mode you have to add the special '-e' flag to the command. Like create flags, edit flags often require a flag argument, and, like query flags, often need a command argument at the end to indicate which object should be edited. We could turn our �Sphere� button into the long sought after �Make My Scene Pretty� button with a simple edit command:

button -e -label �Make My Scene Pretty� button1;

A real life example of query and edit flags might occur when you're talking with your dog: �Pooch, where you sitting?�, upon which he might answer �Over here.� This would be like using a query flag:

sit -q -location pooch;
// Result: Over here //

And if you then followed up with: �Hmm... I think I'd prefer it if you sat over there�, that would be like using an edit flag:

sit -e -location �over there� pooch;

Examples


Okay let's check out the examples section:

Examples docs

As expected, the examples section provides examples of how a command might be used. Often you can just grab some of the examples, paste it into Maya, and go from there.

To recap:
  1. The online MEL docs provide information about Maya's built-in commands and flags.
  2. A create flag is used when you first create something, or when you are causing some action to occur.
  3. A query flag returns information about Maya or an object.
  4. An edit flag are used to make changes to an object after it has been created.