// =========================================================================== // 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. // =========================================================================== global proc cMuscleDuplicateWeights() { string $wtFrom = "sticky" ; string $wtTo = "stickyb" ; string $mS = "cMuscleSystem1" ; // Determine proper attributes to use... // string $weightListFrom = "" ; string $weightsFrom = "" ; string $weightListTo = "" ; string $weightsTo = "" ; if ($wtFrom == "sticky") { $weightListFrom = "stickyWeightListMus" ; $weightsFrom = "stickyWeightsMus" ; } else if ($wtFrom == "stickyb") { $weightListFrom = "stickyWeightListMusB" ; $weightsFrom = "stickyWeightsMusB" ; } else if ($wtFrom == "stickyc") { $weightListFrom = "stickyWeightListMusC" ; $weightsFrom = "stickyWeightsMusC" ; } else error -sl 0 (uiRes("m_cMuscleDuplicateWeights.kUnknownWtFromType")) ; if ($wtTo == "sticky") { $weightListTo = "stickyWeightListMus" ; $weightsTo = "stickyWeightsMus" ; } else if ($wtTo == "stickyb") { $weightListTo = "stickyWeightListMusB" ; $weightsTo = "stickyWeightsMusB" ; } else if ($wtTo == "stickyc") { $weightListTo = "stickyWeightListMusC" ; $weightsTo = "stickyWeightsMusC" ; } else error -sl 0 (uiRes("m_cMuscleDuplicateWeights.kUnknownWeightWtToType")) ; setAttr ($mS+".envelope") 0.0 ; // Disable waitCursor -state on ; string $title = (uiRes("m_cMuscleDuplicateWeights.kWindowTitleDuplicateWeights")); $title = `format -stringArg $mS $title`; progressWindow -title $title -progress 0 -status (uiRes("m_cMuscleDuplicateWeights.kInitialProgressPoint")) -isInterruptable true ; int $nList = `getAttr -size ($mS+"."+$weightListFrom)` ; string $msg = (uiRes("m_cMuscleDuplicateWeights.kListComponents")); $msg = `format -stringArg $nList $msg`; print $msg ; int $i ; for ($i=0; $i < $nList; ++$i) { if (`progressWindow -q -isCancelled`) { warning -sl 0 (uiRes("m_cMuscleDuplicateWeights.kTransferWeightsAborted")) ; break ; } int $nWts = `getAttr -size ($mS+"."+$weightListFrom+"["+$i+"]."+$weightsFrom)` ; int $nPct = 100.0 * $i / ($nList-1.0) ; string $msg = (uiRes("m_cMuscleDuplicateWeights.kComponentSubWeights")); $msg = `format -stringArg $i -stringArg ($nList-1) -stringArg $nPct -stringArg $nWts $msg`; progressWindow -e -progress $nPct -status $msg ; // print ("// "+$nPct+"% - Component "+$i+" / "+($nList)+" ("+$nWts+" sub weights) //\n") ; // Now dup each weight... int $n ; for ($n=0; $n < $nWts; ++$n) { float $fWt = `getAttr ($mS+"."+$weightListFrom+"["+$i+"]."+$weightsFrom+"["+$n+"]")` ; setAttr ($mS+"."+$weightListTo+"["+$i+"]."+$weightsTo+"["+$n+"]") $fWt ; } } progressWindow -endProgress ; waitCursor -state off ; setAttr ($mS+".envelope") 1.0 ; // Enable print (uiRes("m_cMuscleDuplicateWeights.kMuscleDuplicateWeightsDone")) ; }