Skip navigation

Move to origin:

// Zero transformation on manipulator (world space).
move -rpr 0 0 0
// Freeze transformations afterward to park manipulator @ origin
// Zero the transformation on object (local space)
string $objects[] = `ls -sl`;
$obj = $objects[0];

setAttr( $obj + ".translateX" ) 0.0;
setAttr( $obj + ".translateY" ) 0.0;
setAttr( $obj + ".translateZ" ) 0.0;

setAttr( $obj + ".rotateX" ) 0.0;
setAttr( $obj + ".rotateY" ) 0.0;
setAttr( $obj + ".rotateZ" ) 0.0;
// CLEAR KEYFRAMES
int $maxTime = `playbackOptions -q -max`;
for( $i = 0; $i <= $maxTime; $i++ )
{
  currentTime $i;
  timeSliderClearKey;
}
// left leg / right leg copy.
// use: select src controller, dst controller then
// run the script.
proc copyKeyframes( string $o1, string $o2, int $kf1, int $kf2, int $maxTime )
{
  // TRANSLATION
  copyKey -time $kf1 -attribute translate $o1;
  pasteKey -time $kf2 -attribute translate $o2;
  // if the dst frame is frame 0, also copy into end frame
  if( $kf2 == 0 ) { pasteKey -time $maxTime -attribute translate $o2; }
  
  // ROTATION
  copyKey -time $kf1 -attribute rotate $o1;
  pasteKey -time $kf2 -attribute rotate $o2;
  // if the dst frame is frame 0, also copy into end frame
  if( $kf2 == 0 ) { pasteKey -time $maxTime -attribute rotate $o2; }
}

int $maxTime = `playbackOptions -q -max`;
string $objects[] = `ls -sl`;
$o1 = $objects[0];
$o2 = $objects[1];
int $kf = 0;
while( $kf <= $maxTime )
{
  $kf = `findKeyframe -time $kf -which next $o1`;
  $kf2 = ($kf + $maxTime/2) % $maxTime;
  print $kf;
  print " ";
  print $kf2;
  print "\n";
  copyKeyframes( $o1, $o2, $kf, $kf2, $maxTime );
  $kf++;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: