MEL Basics - Maya Embedded Language - WRITTEN IN 2003

You'll have to excuse the Learning Edition Screens if you see them since all I have is Maya 4.5 LE.

The nice part about Maya is that it comes with a complete reference for MEL in the Help menu. So you can figure out a lot of it just by looking at it.

Start a new file or just start Maya.

 

We'll start with a polygon cube.

In the command line at the bottom of Maya type

polyCube;
New File

Hit enter. You'll notice a cube now appears in Maya. I'll zoom in to see it.

Now we can resize it just by typing in another command.

scale 20 .5 20;
polyCube;

Now we have a large squashed cube. Neat huh?
Lets move onto putting in more than 1 line at a time.

You'll need to open a new window called the Script Editor. Its the button on the botton right that looks like this.

You'll get another window. The only trick to entering in scripts here is that you need to press the number key enter instead of the regular enter.

$i = 0; 
while($i++ < 10)
{
  polyCube; 
  scale 20 .1 20;
  move 0 $i 0;
} 


Alright, now we have 10 thin cubes right right straight up in a row.

$ is how you make a variable. If you're not familiar with programming a variable can be anything really. You can use a variable to hold values instead of typing them over and over. Lets make a more complicated script to make a lot of cube in a pattern. Well need 3 variable for this.

Alright, now we have 10 thin cubes right right straight up in a row.

$ is how you make a variable. If you're not familiar with programming a variable can be anything really. You can use a variable to hold values instead of typing them over and over. Lets make a more complicated script to make a lot of cube in a pattern. Well need 3 variable for this.

$i = 0; 
while($i++ < 10)
{ 
   $j = 0; 
   while($j++ < 10)
   { 
     $k = 0;
     while($k++ < 10)
     {
       polyCube;
       scale .3 .3 .3; 
       move ($j-5.5) ($i-5.5) ($k-5.5);
    } 
  }
}


Hopefully this gives you some example of why one might want to learn MEL. MEL allows animators to quickly create or work with large amounts of data. Good luck with your projects!