// =========================================================================== // 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. // =========================================================================== // // // Creation Date: Feb 20, 2001 // // Description: // This script creates a weight curve. // // Input Arguments: // None. // // Return Value: // None. // global proc doCreateClipWeightCurve (string $clips[]) { int $nClips = size($clips); if ($nClips == 0) { return; } int $ii = 0; for ($ii = 0; $ii < $nClips; $ii++) { string $clip = $clips[$ii]; string $connections[] = `listConnections -source true -destination false ($clip+".weight")`; if (size($connections) > 0) { // Something is already connected, so do nothing. // string $warnMsg = (uiRes("m_doCreateClipWeightCurve.kClipWarn")); $warnMsg = `format -s $clip $warnMsg`; warning($warnMsg); continue; } float $startTime = `getAttr ($clip + ".startFrame")`; setKeyframe -at weight -t $startTime -v 1.0 $clip; float $sourceStartTime = `getAttr ($clip + ".sourceStart")`; float $sourceEndTime = `getAttr ($clip + ".sourceEnd")`; float $endTime = ($sourceEndTime - $sourceStartTime) * `getAttr ($clip + ".scale")`; setKeyframe -at weight -t ($startTime + $endTime) -v 1.0 $clip; } }