// llHoldJointWeights // ////////////////////////// // // Maya script file // ////////////////////////// // // Author : Lluís Llobera // (lluisllobera@rigging101.com) // // Creation date : 22/XII/2003 // // Main procedure : type "llHoldJointWeights" in the Command Line or Script Editor // ////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// // // Skinning is a tedious, boring task in the rigging process... This script is aimed to help // the user by offering a little window from which each joint's "held" state can be quickly toggled. // // // Enjoy!! // //////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////// // llHoldJointWeightsToggle // ///////////////////////////////// // // Finds out which elements are selected, then toggles // their "held" state and refreshed the window's content. // // <-- llHoldJointWeights // --> llHoldJointWeightsRefresh // ///////////////////////////////// global proc llHoldJointWeightsToggle() { // get the names of the selected items int $SELECTED[] = `textScrollList -q -sii llHoldJointWeightsScroll` ; string $SELECTIONTEXT = "" ; for ($INDEX in $SELECTED) { textScrollList -e -sii $INDEX llHoldJointWeightsJOINTSScroll ; string $ELEMENT[] = `textScrollList -q -si llHoldJointWeightsJOINTSScroll` ; if ($ELEMENT[0] != " -- ") setAttr ($ELEMENT[0] + ".liw") (!(`getAttr ($ELEMENT[0] + ".liw")`)) ; $SELECTIONTEXT += (" -sii " + $INDEX ) ; } ; // for ($INDEX in $SELECTED) llHoldJointWeightsRefresh ; eval ("textScrollList -e" + $SELECTIONTEXT + " llHoldJointWeightsScroll") ; } ; // global proc llHoldJointWeightsToggle ///////////////////////////////// // llHoldJointWeightsRefresh // ///////////////////////////////// // // Clears the scrollText list, then evaluates it again. // // <-- llHoldJointWeights // <-- llHoldJointWeightsToggle // ///////////////////////////////// global proc llHoldJointWeightsRefresh () { // if no skinCluster nodes present, discard the whole thing string $SKINCLUSTERLIST[] = `ls -type skinCluster` ; if ((`size $SKINCLUSTERLIST`) == 0) { deleteUI llHJWWindow ; error ("no skinCluster nodes present in the scene") ; } else { // clean up scroll list textScrollList -e -ra llHoldJointWeightsScroll ; textScrollList -e -ra llHoldJointWeightsJOINTSScroll ; for ($SKINCLUSTER in $SKINCLUSTERLIST) { textScrollList -e -append (" -- "+$SKINCLUSTER+" -- ") llHoldJointWeightsScroll ; textScrollList -e -append (" -- " ) llHoldJointWeightsJOINTSScroll ; string $SKINJOINTS[] = `listConnections ($SKINCLUSTER + ".lockWeights")` ; int $LOCKED[] ; float $SIZE = size ($SKINJOINTS) ; for ($I = 0 ; $I<= ($SIZE-1) ; $I++) { string $PLUGS[] = listConnections ($SKINCLUSTER + ".lockWeights[" + $I + "]") ; $SKINJOINTS[$I] = $PLUGS[0] ; $LOCKED[$I] = (`getAttr ($PLUGS[0] + ".liw")`) ; textScrollList -e -append ($SKINJOINTS[$I]) llHoldJointWeightsJOINTSScroll ; if ($LOCKED[$I] == 1) textScrollList -e -append ($SKINJOINTS[$I] + " [Hold]") llHoldJointWeightsScroll ; else textScrollList -e -append ($SKINJOINTS[$I]) llHoldJointWeightsScroll ; } ; // for ($I = 0 ; $I ... } ; // for ($SKINCLUSTER in `ls -type skinCluster`) } ; // else } ; // llHoldJointWeightsRefresh ///////////////////////////////// // llHoldJointWeights // ///////////////////////////////// // // MAIN PROC // // Creates the main window. // // --> llHoldJointWeightsToggle // --> llHoldJointWeightsRefresh // ///////////////////////////////// global proc llHoldJointWeights () { // creates the window if (`window -ex llHJWWindow`) deleteUI llHJWWindow ; window -wh 210 280 -t "llHoldJointWeights v1.0" llHJWWindow ; // form Layout definition formLayout llHoldJointWeightsWindowForm ; // llHoldJointWeightsScroll definition textScrollList -ams 1 -dcc "llHoldJointWeightsToggle" llHoldJointWeightsScroll ; setParent llHoldJointWeightsWindowForm ; textScrollList -vis 0 llHoldJointWeightsJOINTSScroll ; setParent llHoldJointWeightsWindowForm ; // llHoldJointWeightsOptionsLayout definition formLayout llHoldJointWeightsOptionsLayout ; button -l "TOGGLE HOLD" -c "llHoldJointWeightsToggle" llHoldJointWeightsRefreshButton ; button -l "refresh" -c "llHoldJointWeightsRefresh" llHoldJointWeightsToggleButton ; formLayout -e -attachForm llHoldJointWeightsRefreshButton "top" 0 -attachForm llHoldJointWeightsRefreshButton "left" 0 -attachForm llHoldJointWeightsRefreshButton "bottom" 0 -attachControl llHoldJointWeightsRefreshButton "right" 0 llHoldJointWeightsToggleButton -attachForm llHoldJointWeightsToggleButton "top" 0 -attachPosition llHoldJointWeightsToggleButton "left" 0 60 -attachForm llHoldJointWeightsToggleButton "bottom" 0 -attachForm llHoldJointWeightsToggleButton "right" 0 llHoldJointWeightsOptionsLayout ; setParent llHoldJointWeightsWindowForm ; // main formLayout edition formLayout -e -attachForm llHoldJointWeightsOptionsLayout "bottom" 2 -attachForm llHoldJointWeightsOptionsLayout "left" 2 -attachForm llHoldJointWeightsOptionsLayout "right" 2 -attachNone llHoldJointWeightsOptionsLayout "top" -attachForm llHoldJointWeightsScroll "top" 2 -attachForm llHoldJointWeightsScroll "left" 2 -attachControl llHoldJointWeightsScroll "bottom" 2 llHoldJointWeightsOptionsLayout -attachForm llHoldJointWeightsScroll "right" 2 llHoldJointWeightsWindowForm ; // refresh llHoldJointWeightsRefresh ; // showWindow showWindow llHJWWindow ; // edit window size window -e -wh 210 280 llHJWWindow ; } ; // global proc llHoldJointWeights //////////////////////////////////////////////////////////////////////////////////////////////////// // // EoS llHoldJointWeights // ////////////////////////////////////////////////////////////////////////////////////////////////////