Tuesday, April 12, 2011

Snap Previous Keyframe Value V.2

/*
Tool Name: Previous Keyframe Value Snap
Author: M. Tyler Heckman
Date: 04/13/11
Version: 2.0
*/

proc prevKeyValue()
{
string $animCurves[] = `keyframe -q -name`;
float $selectTimes[];
float $selectValues[] = `keyframe -q -sl -valueChange`;
float $allTimes[];
float $snapValues[];
float $valueHolder[];
int $keyCount[];
int $keyCountSum = 0;

// stores first selected keys value of each curve

for ( $i = 0; $i < `size $animCurves`; $i++ )
{
$keyCount[$i] = `keyframe -q -sl -keyframeCount $animCurves[$i]`;

if($keyCountSum == 0)
{
$snapValues[$i] = $selectValues[($keyCount[$i] - $keyCount[$i])];
$keyCountSum = $keyCountSum + $keyCount[$i];
}
else
{
$snapValues[$i] = $selectValues[$keyCountSum];
$keyCountSum = $keyCountSum + $keyCount[$i];
}

$allTimes = `keyframe -q -timeChange $animCurves[$i]`;
$selectTimes = `keyframe -q -sl -timeChange $animCurves[$i]`;


//snaps all selected keys per curve to their respected first selected key value

for ( $b = 0; $b < `size $allTimes`; $b++ )
{
for ( $a = 0; $a < `size $selectTimes`; $a++ )
{
if ( ( $allTimes[$b] == $selectTimes[$a] ))
{
keyframe -e -index $b -valueChange $snapValues[$i] $animCurves[$i];

keyTangent -inTangentType flat -outTangentType flat -t $selectTimes[$a] $animCurves[$i];

}
}
}
}

clear $allTimes;
clear $selectTimes;

};

prevKeyValue;



Interwebuals

Meindbender. Because they are just that good.

1 comment:

toryburchshoesbags said...

To meet for the demand of baseball game that needs additional grip on the grassy field, Hogan Online
a pair of spiked sneakers is of necessity, for which would be the premise of a successful baseball match. Spiked soles of the baseball sneakers Hogan Onlinehave the function of tightening grip over the ground by not letting you to fall down even the surface is slick with rain. Baseball sneakers Franklin Marshall Hoodies
are designed for you with molded rubber cleats and heel pull tab for easy wear as well as to exhibit excellent traction over the ground. Abercrombie and Fitch ClothingFew sneakers are even available with baseball design at the side for stylish look.