MEL script utility


Say you're working in a Maya scene and you have several shots laid out, different camera attributes, different props. Each shot has a beginning frame and an ending frame, and you usually set the playback range to correspond to the shot's beginning and ending frames when you are working on it. This utility makes it easy to keep track of the various shots and frame ranges, and very easy to move between them in Maya.

Add shot information

Enter a project name. Give the first shot a shot name, and enter its 1st frame and last frame numbers.

Then click Add to List.

Do this for all the shots in your scene. Once you've entered them, you can move them around in the list, edit them, or delete them using the buttons to the right of the list.

Save the file as XML

Since you've spent all this time entering the shots, you should probably save your work. Click the XML button. Here you can see your shots in XML format. Choose Save as XML File to save this XML shot list as a file on your hard drive.

If you have previously saved a file, you can re-load it here by clicking Import XML File.

You can also edit your XML in this window, and your changes will be reflected in the list when you click Back.

Generate the MEL script

Once your shots are all in order, in the main screen click MEL. The textbox contanins the MEL Script that creates a window in Maya with your shot information. Copy the text from this textbox -- remember, Ctrl+A selects all the text and Ctrl+C copies it.

Paste the MEL Script in Maya's Script Editor

Open Maya's Script Editor and paste the code into the lower panel.

When the code is in the Script Editor, you can hit Ctrl+Enter on the number keypad to execute it, or middle-mouse drag the selected script to the shelf so you can easily run the tool at the click of a button. When you execute the code, you'll get a window in Maya that allows you to select one of your shots.

In a click or two, set your playback range.

Choose the shot you want to edit in the drop-down list, and click Do It. The playback range in the Maya time slider updates to display just the frames in your scene. Select Set render range to match if you want to update your render settings to render just the frames in your selected shot.