// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure Name: // buildWeightCurve // // Description: // Adds the weight curve to a blend node. This is where user defined // weight curves can be added. // // Input Arguments: // node - The name of the blend node. // // weightCurve - The enum defining which type of weight curve // to create. This should match the option // box UI. // Return Value: // None. // global proc buildWeightCurve(string $node, int $weightCurve) { switch ($weightCurve) { case 2: // Ease In // setKeyframe -at weight -t 0.0 -v 0.0 -itt "spline" -ott "spline" $node; keyTangent -e -a -t 0 -ia 0.0 -iw 1.0 $node; keyTangent -e -a -t 0 -oa 0.0 -ow 1.0 $node; setKeyframe -at weight -t 1.0 -v 1.0 $node; break; case 3: // Ease out // setKeyframe -at weight -t 0.0 -v 0.0 $node; setKeyframe -at weight -t 1.0 -v 1.0 -itt "spline" -ott "spline" $node; keyTangent -e -a -t 1 -ia 0.0 -iw 0.0 $node; keyTangent -e -a -t 1 -oa 0.0 -ow 0.0 $node; break; case 4: // Ease In/Out // setKeyframe -at weight -t 0.0 -v 0.0 -itt "spline" -ott "spline" $node; keyTangent -e -a -t 0 -ia 0.0 -iw 1.0 $node; keyTangent -e -a -t 0 -oa 0.0 -ow 1.0 $node; setKeyframe -at weight -t 1.0 -v 1.0 -itt "spline" -ott "spline" $node; keyTangent -e -a -t 1 -ia 0.0 -iw 0.0 $node; keyTangent -e -a -t 1 -oa 0.0 -ow 0.0 $node; break; case 1: // Linear // default: setKeyframe -at weight -t 0.0 -v 0.0 $node; setKeyframe -at weight -t 1.0 -v 1.0 $node; break; } } global proc doBlendClip(string $clipEd, int $weightCurve, int $rotInterp) { string $selected[] = getSelectedClips("noOptions"); int $nSelected = size($selected); if ($nSelected == 0) { error( uiRes("m_clipPropertiesWindow.kNoClipsSelected") ); } if ($nSelected != 2) { error ( (uiRes("m_doBlendClip.kTwoClipsMustBeSel")) ); } // Assuming that there are two selected clips. // string $scheduler1 = getClipScheduler($selected[0]); string $scheduler2 = getClipScheduler($selected[1]); if ($scheduler1 != $scheduler2) { error ( (uiRes("m_doBlendClip.kTheClipsSameScheduler")) ); } int $clipIndex1 = getClipIndex($selected[0], $scheduler1); int $clipIndex2 = getClipIndex($selected[1], $scheduler1); $cmd = ("clipSchedule -b " + $clipIndex1 + " " + $clipIndex2); $cmd += (" \"" + $scheduler1 + "\""); eval($cmd); // Now get the blend node that was created. // string $blendNode[] = `clipSchedule -bn $clipIndex1 $clipIndex2 -q $scheduler1`; if (size($blendNode) > 0) { // Only look at the first blend node. // buildWeightCurve($blendNode[0], $weightCurve); setAttr ($blendNode[0]+".rotateInterp") $rotInterp; } }