Professional Documents
Culture Documents
//
//Added the auto "Range Fwd and Rev" Lock.
//will lock down the selected object based on the Hilighed Time Range Slider.
// This script will lock down, hold and key an object to world space for x amount
of frames for the current object position
// Select the first selected object and lock it down to the new locator//
// ******UI********
//kill existing
if ((`window -ex frameyWindow`) == true) deleteUI frameyWindow;
//create UI
window -w 4 -t "Lock Down v2" frameyWindow;
showWindow frameyWindow;
string $locator[];
//Create locator
select $locator;
select -cl ;
select -r $firstObject ;
//---------------------------------------------------------//
int $i=0;
while($i<$holdFrames)
setKeyframe $firstObject.t;
$i = $i + 1;
select -cl ;
select $locator;
delete;
select $firstObject;
string $locator[];
//Create locator
select $locator;
select -cl ;
select -r $firstObject ;
//---------------------------------------------------------//
int $i=0;
while($i<$holdFrames)
setKeyframe $firstObject.t;
$i = $i + 1;
select -cl ;
select $locator;
delete;
select $firstObject;
//Forward Locks down the number of frames based on the highliged selection in the
Time Slider
//Locking will occur based on the FIRST frame of the highliged section
global proc lockRangeFwd(){
global string $gPlayBackSlider;
float $rangeArray[2];
$rangeArray = `timeControl -q -rangeArray $gPlayBackSlider`;
currentTime ($rangeArray[0]);
$frameCount =($rangeArray[1] - $rangeArray[0]);
lockDown($frameCount);
}
//Reverse Locks down the number of frames based on the highliged selection in the
Time Slider
//Locking will occur based on the LAST frame of the highliged section
fabLockDownUI;
tt -assign to a key. It the tungten tangent tool. It's on the graph editor. But
having it as a hotkey saves time.
waitCursor -state on; // make a nice wait cursor icon while it works...-comet
// Determine index value of current key (2) and four neighbors (0,1,3,4).
$i[2] = $selectedindexes[$I];
$i = {$i[2] - 2, $i[2] - 1, $i[2], $i[2] + 1, $i[2] + 2};
// Loop to determine x and y positions of five keys (time and value of each).
$start = (`max 0 (2 - $i[2])`);
$end = (`min 5 (2 + $totalindexes - $i[2])`);
for ($p = $start; $p < $end; $p = $p + 1)
{
float $X[] = `keyframe -in $i[$p] -query -tc $curve`; $x[$p] = $X[0];
float $Y[] = `keyframe -in $i[$p] -query -vc $curve`; $y[$p] = $Y[0];
}
// Are there nodes? Check sign (+,0,-) for the 3 slope changes.
{$node = true;
$inSmooth = ( $m[1] + ( ($m[1] - $m[0]) / 2.0 ) );
$outSmooth = ( $m[2] + ( ($m[2] - $m[3]) / 2.0 ) );}
//as long as tangent is locked (handles move together), combine the two slope
values into one.
//Exception: if weights are free and also broken, treat angle as unified.
$inSlope = $slope;
$outSlope = $slope;
if ($locked == true)
{
keyTangent -in $i[2] -lock false $curve; // Temporarily unlock tangent.
}
}
else
{
$inlimit = ( ( $inSmooth * $m[1] ) < 0 ) ? ( 0 ) : ( 3 * $m[1] );
$outlimit = ( ( $outSmooth * $m[2] ) < 0 ) ? ( 0 ) : ( 3 * $m[2] );
$inSlope = ( shallower( $inSmooth, $inlimit ) );
$outSlope = ( shallower( $outSmooth, $outlimit ) );
}
// Relock tangents.
if ($locked == true) {keyTangent -in $i[2] -lock true $curve;}
SelectAll;
setDisplaySmoothness 1;
select -cl ;
// sets pickers
setObjectPickMask "All" 0;
selectType -nurbsCurve 1;
selectType -locator 1;
/*
*/;
// Error: file: C:/Program
Files/Autodesk/Maya2016/scripts/others/createModelPanelMenu.mel line 275: menuItem:
Object 'iselectEnableItem' not found. //
// sets pickers
setObjectPickMask "All" 0;
selectType -nurbsCurve 1;
selectType -locator 1;
/*
*/;