5/20/15

MAYA / MEL_ offset animation multiple objects

// Proc to offset animation keyframe - two mode random or increment 
// select controllers and run the command : OffsetKeyFrame random 6 or OffsetKeyFrame increment 2
global proc OffsetKeyFrame (string $type, int $value)
{
    string $sel[] = `ls -sl`;
    
    if ($type == "increment")
    {
        int $val = 0;
        for ($item in $sel)
        {
        keyframe -e -iub true -r -o over -tc $val $item;
        $val += $value;
        }
    } 
    else if ($type == "random")
    {
    for ($item in $sel)
        {
        int $rnd = rand(0,$value);
        keyframe -e -iub true -r -o over -tc $rnd $item;
        }
    }
    select -r $sel;
}

No comments:

Post a Comment