Form and Space

creating CG 3D since 2001

  • Connect @
  • Linked in
  • Vimeo
  • Twitter
neutral pose

Maya: Neutral Pose Revisited

Matthew | November 22, 2012

2 Comments

I’ve been working on improvements of this. Previously, I attempted to make a tool that would create a neutral pose. It wasn’t very good. What I want to do is set the current selections transformations to 0,0,0 0,0,0 1,1,1 for translation, rotation, and scale. Why do this? Well, it makes it easier to reset an object to it’s default pose when animating. All I need to do is enter zeros and ones into the transformations, respectively. Of course, the motivation behind this tool comes from my experience in rigging characters in XSI. There’s a very nice, easy to use, Save Neutral Pose tool. It stores the current transformation in a separate “neutral pose object”, and could be modified even after the rig had been animated. Allowing a TD to modify a rig without breaking the current animation. Sounds nice, and I’d like more of that in Maya. I never really liked my first neutral pose tool for Maya, so here I go again, trying to perfect it.

This time it’s a bit smarter. Not too smart, but smarter. It will take a your object and create a parent object with the exact transformations, then parent your object to the new parent. Effectively, setting the child, your object’s, transformations to zeros and ones. That becomes the new starting pose for the object. This isn’t something you’d do in the middle of an animation process. It’s done at the rigging stage, or can be used as a modeling helper.

More to come with this script.

neutral pose

Set Neutral Pose

string $neutralObj = mls_neutralPose("pCube1");
print $neutralObj;


proc string mls_neutralPose(string $object)
{
    float $m[] = `xform -q -ws -m $object`;
    
    string $newParent = `group -empty`; 
        
    xform -ws -m ($m[0]) ($m[1]) ($m[2]) ($m[3])
                 ($m[4]) ($m[5]) ($m[6]) ($m[7])
                 ($m[8]) ($m[9]) ($m[10]) ($m[11])
                 ($m[12]) ($m[13]) ($m[14]) ($m[15]) 
                 $newParent;
        
    parent $object $newParent;
        
    return $newParent;
  
}

2 responses to “Maya: Neutral Pose Revisited”

  1. A slight modification to Matt’s script to make a match transforms tool.

    Select 2 or more objects.
    All objects move to the Last Selected object.

    mls_matchTransform();

    proc mls_error()
    {
    error “Select 2+ Objects. Selected Object(s) moves to Last Selected Object”;
    }
    proc mls_result(string $objs[])
    {
    string $mls_printResult;
    int $objsSize = size($objs);
    for ($i = 0; $i < ($objsSize – 1); ++$i)
    {
    $mls_printResult = ($mls_printResult + " " + $objs[$i]);
    }
    $mls_printResult = ($mls_printResult + " to " + $objs[$objsSize-1]);

    print ("Matched" + $mls_printResult);
    }

    proc mls_matchTransform()
    {
    string $objects[] = `ls -tr -sl`;
    int $mls_selection = size($objects);
    if ($mls_selection < 2)
    {
    mls_error();
    }

    else
    {
    string $target = $objects[($mls_selection-1)];

    for ($i = 0; $i < $mls_selection; ++$i)
    {
    string $objA = $objects[$i];

    float $m[] = `xform -q -ws -m $target`;

    xform -ws -m ($m[0]) ($m[1]) ($m[2]) ($m[3])
    ($m[4]) ($m[5]) ($m[6]) ($m[7])
    ($m[8]) ($m[9]) ($m[10]) ($m[11])
    ($m[12]) ($m[13]) ($m[14]) ($m[15])
    $objA;
    }

    mls_result($objects);
    }
    }

  2. Matthew says:

    Thank you, Ken. Very useful!

Leave a Reply

Twitter

Subscribers

    396