Saturday, November 15, 2014

New Script for Timing Goodness

Created a quick script to auto offset my keys on animation




global proc Key_Offset()
{
if(`window -exists "Key_Offset"`)
{
deleteUI "Key_Offset";
}
window Key_Offset;

setParent ..;
rowLayout -numberOfColumns 3
    -columnWidth3 75 30 100;
text -h 50 -align "left" -label "Offset Frames";
intField -w 50 Frames;



button -l "Offset Selection" -command "offsetAnim" -ann "Offsets objects keyframes by a value set in the window.";
window -edit -wh 220 60 Key_Offset;
showWindow Key_Offset;
}

global proc offsetAnim()
{
    string $sel[] = `ls -sl -fl`;
    int $frame = `intField -q -value Frames`;
    int $size = size($sel);
    int $offset;
    for($i=1; $i < $size; $i++)
    {
        $offset = $frame * $i;
        select $sel[$i];
        keyframe -e -iub true -r -o over -tc $offset;
    }
}

No comments: