Mel - Maya Embedded Launguage

<HOME>   <PREVIOUS>   <NEXT>

A Look at MEL

MEL scripts need only be as complex as the action you want to perform. This complexity can vary from creating a simple sphere to anything you can imagine. A good way to familiarize yourself with MEL is to look at how Maya's interface is run. Maya's entire graphical user interface (GUI) is run through MEL commands and procedures.

Let's create an object in Maya, a sphere, and looking at what happens in the script editor.

Create a sphere
Create / Nurbs Primitives / Sphere

Open up the script editor
Windows / General Editors / Script Editor

what you should see in the script editor is:
sphere -p 0 0 0 -ax 0 1 0 -ssw 0 -esw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -nsp 4 -ch 1;
objectMoveCommand;
We see two commands. The first command creates a nurbsSphere with some options attached and the second command sets our current tool to the move tool. Let's take the fundamental element of this code and type it into the command line

In the command line type sphere;
hit ENTER (on the numeric keypad)
You should see a nurbs sphere appear on your screen. Open your script editor again.
sphere;
// Result: nurbsSphere1 makeNurbSphere1 //
This should illustrate that Maya's interface is using the same commands you will be using to create your scripts with. To familiarize yourself with how Maya is using it's commands, keep the script editor open while you work and notice what is happening every time you perform an action. <Top>