Either, Mel or python. I have a curve I want to mirror along the vertical axis and I'm doing so with this:
scaleKey -iub false -ts -1 -vs 1 -animation keys
Its mirroring it along frame 1 as the vertical axis, I know I can use the -tp flag to offset it correctly but I'm not sure how to make that work. Is there anyway to do this via mel/python?
Replies
Does it just mirror the animation/or position of the object(cause I noticed it mirrors the position very well but don't see any keys even for driven keys),so do u need to set the keys for the new position or it mirrors the actual keys or creates a new set of mirrored keys?
scaleKey -iub false -ts 1 -vs -1 -animation keys;
Seems to be what your after..
scaleKey -iub false -ts -1 -vs 1 -animation keys
Does left/right but it moves the curve along the timeline rather than flipping it from the curves center.
* Select all keyframes that you want to invert the value for
* In the second "Stats" input field type "*=-1" and hit enter
* values for all selected keyframes should be inversed
This also works for adding (+=) subtracting (-=) and dividing (/=).
//run me
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
global proc reverseKeys()
{
string $obSelss[] = `ls -sl `;
int $selected = size($obSelss);//$channels = `channelBox -q -sma "mainChannelBox"`; //$channelLoop = size($channels);
string $range = `timeControl -q -rng timeControl1`;
string $time[];
$numTokens = `tokenize $range "\":" $time`;
float $timeStart = $time[0];
float $timeStart = $timeStart;
float $timeEnd = $time[1];
float $timeEnd = $timeEnd -1;
float $timePiv = (($timeStart + $timeEnd)/2);
float $FrameCount = ($timeEnd - $timeStart);
string $range = $timeStart + ":" + $timeEnd;
scaleKey -time $range -timeScale -1 -timePivot $timePiv;
}
reverseKeys;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////