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

Conversational MEL Part 3

Topics Covered: Online MEL command reference; query and edit mode flags; UI layouts; sliders Sample
Script: Basic turntable animation and UI


In the past two articles we've covered a lot of MEL: commands, flags, variables, arrays, and even a basic loop. But this wild ride ain't over yet � MEL the language has a lot more to offer. I would, however, like to take this moment to bring your attention to the two other members of the MEL family: MEL the user interface and MEL the command library. When people talk about MEL, they are usually referring to something that's a little bit language, a little bit user interface, and a little bit command library. Up until now we've been primarily focused on the language � the rules and concepts that govern how you write a MEL script. In this article we're going to spend some quality time with MEL the user interface and MEL the command library � and in the process we might just stumble onto a script for setting up a turntable animation.

In this article we will go over:
  1. The online MEL Command Reference
  2. UI layouts and controls
  3. Turntable animation

Play it, DJ

In flagrant disregard for the well ordered list above, we're going to start off with the turntable animation. This will give us something concrete to sink our teeth into (how's that for a mixed metaphor?) when we cover the other, more abstract, sections later.

What is it?

A turntable animation is a simple animation used to give the viewer a 360 degree look at a model or scene. The model is placed at the camera's center of interest and rotates around like it was sitting on a record player turntable. Alternatively the model can sit still while the camera revolves around it. Here're four images from a turntable animation of the Stanford Bunny:

Turntable animation

Spinning, Scratching, Cutting, and Pasting

For the first pass at our turntable animation script we're going to rely on the same cut and paste technique that served us so well in the first article. Let's forget the MEL for a moment and start pushing buttons and pulling widgets.
First load something worth looking at - ideally something that'll look different when you spin it around (you may note that our tutorial examples have been upgraded � no cones and spheres here!).


There are many ways to create a turntable animation but we're going to try and let Maya do most of the work
  1. Create a curve circle
  2. Create a camera
  3. Set the circle as the camera's motion path
  4. Point the camera towards the bunny

As you do each step make sure to grab the MEL code that Maya spits out.

Creating a circle:

Create a NURBS circle

Instead of a regular camera we'll create a �Camera and Aim�:

Create a camera

When adding the circle as the Camera's motion path turn off the Follow option � the aim widget is already controlling the camera's rotation so the motion path should not:

Attach to motion path

And finally point the camera at the bunny by dragging the aim widget over to the bunny's center.

Position the aim widget

And that's it! According to my calculations we should have collected the following MEL script:

Turntable MEL script

circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.000109361 -s 8 -ch 1;
camera -centerOfInterest 5 -focalLength 35 -lensSqueezeRatio 1 -cameraScale 1
-horizontalFilmAperture 1.4173 -horizontalFilmOffset 0
-verticalFilmAperture 0.9449 -verticalFilmOffset 0 -filmFit Vertical
-overscan 1 -motionBlur 0 -shutterAngle 144 -nearClipPlane 0.01
-farClipPlane 1000 -orthographic 0 -orthographicWidth 30;
cameraMakeNode 2 "";

select -cl ;
select -r camera1 ;
select -tgl nurbsCircle1 ;
pathAnimation -fractionMode true -follow false
-startTimeU `playbackOptions -query -minTime`
-endTimeU `playbackOptions -query -maxTime`;
select -r camera1_aim ;
move -r 0 0 5 ;
Let's activate the turntable camera...

Switch to the turntable camera

... and take a look!

Bad turntable

... Well that's certainly not pretty.

It looks like our setup might be in need of a little tweak or two. Luckily for this article the tweak is the pillar upon which this fine industry rests and Maya is bursting with little gadgets and doohickeys to help us out. In order to find those gadgets and use those doohickeys we're going to have to put on our readin' hats and take a look at: