Mel - Maya Embedded Launguage


What is Mel?

As you might have guessed by the title, Mel means Maya Embedded Launguage. Mel is a scripting launguage. This means that you can type a Mel command and execute that command as soon as you hit enter. This differs from a compiled language, a compiled language would require you convert your code into commands the computer understands, and example of this would be a language such as C. Since Mel is a scripting language, it makes Mel extremely fast to use. Unfortunately, this does not eliminate your having to debug your code. Like any programming language debugging will probably be where you spend the bulk of your time.

Where do we write Mel?

Before we dive into Mel lets familiarize with the different areas we can write Mel in. Mel can be executed in several different areas with in Maya, for this class we are only going to concern ourselves with the major areas. You may, if you like, write your Mel externally in a program such as Notepad or UltraEdit-32 and then copy and paste your code into maya.
  • This is located in the lower right corner of your screen

  • Command Line

    Script editor

  • Windows / General Editors / Script Editor
    Script Editor

    Command Shell

  • Windows / General Editors / Command Shell
    Command Shell


  • This is located near the top of your screen

  • Shelves

    Script Files

  • located in your Maya scripts folder. Have a .Mel extention following the name.

    Expression Editor

  • Windows / Animation Editors / Expression Editor
    Expression Editor
  • Our first 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 just about your imaginations limits. 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;
    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 aspect of this code and type it into the command line

    In the command line type sphere;
    hit enter
    You should see a nurbs Sphere appear on your screen. Open your script editor again.
    // Result: nurbsSphere1 makeNurbSphere1 //
    This should illustrate that Maya's interface is using the same commands you will be using to create you scripts with. To familiarize yourself with how maya is running it's commands keep the sript editor open while you work as notice what is happening every time you perform an action.