animation mel script for baserig

When blocking my animation, I sometime like to key all the animateable attributes on the control objects that handle gross body movements all at once so that I don’t get unexpected results with my poses. Attempting to select each and every control object individually, setting keys on each object, and then returning to my original selection for continued animating would be an amazingly slow process. This mel script takes a lot of that out of my hands. I assign this mel script to a hot key, use that hotkey when I’m ready to set a keyframe and can continue working seemingly without having to edit my current selection. I’ll describe how this mel script works below:

//storing current selection in variable
string $currentSelect[] = `ls -sl`;

The “//” line contains comments I used to guide myself through the steps I wanted the script to take. the “string” line creates an array that remembers what you(the user) currently have selected and stores it so that it can be recovered later.

//grabbing all the control objects
select -cl ;
select fullBodyCTRL ;
select -add LfootCTRL ;
select -add LheelGrp ;
select -add LheelGrp ;
select -add LfootROT ;
select -add LfootPIVOT ;
select -add LtoeROT ;
select -add RfootCTRL ;
select -add RfootROT ;
select -add RfootPIVOT ;
select -add RtoeROT ;
select -add LhandCTRL ;
select -add RhandCTRL ;
select -add hipCTRL ;
select -add hipAngle ;
select -add backCTRL ;
select -add LshoulderCTRL ;
select -add LarmFKCTRL ;
select -add LforearmFKCTRL ;
select -add LhandFKCTRL ;
select -add RshoulderCTRL ;
select -add LelbowCTRL ;
select -add RarmFKCTRL ;
select -add RforearmFKCTRL ;
select -add RhandFKCTRL ;
select -add RelbowCTRL ;
select -add neckCTRL ;
select -add headCTRL ;
string $ctrlObj[] = `ls -sl`;

These lines of code create an array,”$ctrlObj[]” , that will be used later to set keyframes on the keyable atrributes of the items in the array. The first line, “select -cl;” clears maya of any selection at all. The next line, “select fullBodyCTRL ;”, starts a new selection. Each subsequent line begin with “select -add” which allows you to add to your current selection without dropping what is already selected. The last line, “string $ctrlObj[] = `ls -sl`;”, makes an array that contains the names of all the currently selected items.

//creating array of all keyable attributes of the main list
string $animAllObj[] = `listAnimatable $ctrlObj`;

this next line of code will take that list of objects saved in the “ctrlObj”array earlier, and creates another array,”animAllObj” that contains the names of each keyable attribute of the objects in the list. For example, some of the controls should only have their rotation keyed. Others have some custom attribute that would not get keyed if you told Maya to key only the traslation or rotation. Since each object has been set up so that only what needs to be keyed is keyable, no unnecessary keyframe information will be created.

//set keyframe for all keyable attributes for all control objects
setKeyframe $animAllObj;

This line of code will set a keyframe on the current frame for each of the keyable attributes in the array “animAllObj”.

//retore to original selected object and clear array
select -r $currentSelect;

These last lines restore the visible selection to what it was before the mel script selected all of the control objects and set the requested keyframes. Also, the arrays that were created were cleared to make that memory available for something else.

To assign this mel script to a hotkey in your Hotkey Editor

    1. go to Window->Settings/Preferences->Hotkey Editor in Maya.
    2. under “Categories” scroll to and click on “User”
    3. click the “New” button on the lower right hand side of the window.
    4. copy and paste the mel script lines from above into the “Command:” area
    5. name the script.
    6. click “Accept”.
    7. the name you have chosen will show up in the “Commands” window above
    8. click the name and assign it a new hotkey(make sure the hot key you want is not in use)

*note* this version of the script should be assigned to a free hot key in your hot key editor or added as a button to your shelf in Maya so that it is invoked whenever you press that hot key or button. I plan on creating a separate GUI that will allow you to set keys, and separately change the list of objects keyed on the fly.

Leave a Reply

Shapeways prints ordered

I recently prepared three models for printing via shapeways.

the Big Blue Boy Scout from Jamal Sullivan on Vimeo.

version of the joker from Jamal Sullivan on Vimeo.

punk duck full model from Jamal Sullivan on Vimeo.

Details »

the Big Blue Boy Scout part 2

The modeling for this character is complete! You can see a turntable of the model here:

Details »

Vail Film Festival 2012

I recently had occassion to attend the Vail Film Festival. I created the animated pre-roll of the festival logo and sponsors.
Details »

the Big Blue Boy Scout

supes and his cape

I’m modeling a very familiar character for a 3D fan film, Superman, or as I’ve seen Batman call him “the big blue boy scout”. Here are a few images of the model in progress as well as a turntable of the current look of the model.
Details »

Demo Reel 2012


This demo reel showcases some of the work I have been involved in. Unless otherwise indicated, I did all of the work presented. I work in 3D animation, primarily using Maya currently. I also am quite familiar with 3D Studio and to a lesser extent SoftImage XSI. I am extremely proficient in many of the Adobe Creative Suite applications.
Details »

3d turntables on vimeo

I’ve posted some turntables of some models @ vimeo. I’ve embedded them here:

self portrait turntable from Jamal Sullivan on Vimeo. Details »

Modeling a punk duck

Here is an original character I came up with sketching for a class one day.

Details »