// =========================================================================== // 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 bindSkinInflPopulate( string $skinCluster, string $currentTreeView ) // // Description: // Creates a menu that shows all the influence joints. // { // make sure that the tree view exists. if ( !`treeView -q -ex $currentTreeView ` ) return; // Preserve current selection of the treeView string $currentListSelection[]; $currentListSelection = `treeView -q -selectItem $currentTreeView `; // Cleanup the list if it exists. treeView -e -ra $currentTreeView ; if ( $skinCluster == " " || $skinCluster == "") { // Nothing selected so leave return; } // Create a list of all influence objects names. string $inflList[], $inflListShortNames[]; int $inflListParentIndexes[]; int $inflTypes[]; int $inflIdx = 0; int $sortList = `optionVar -q sortBindingList`; // reuse the skin cluster method from paiting. source skinClusterInflMenu; string $skinClusters[]; $skinClusters[0] = $skinCluster; skinClusterInflFindInfluenceNodes($skinClusters, $inflList, $inflListShortNames, $inflListParentIndexes, $inflTypes, $sortList ); // ================================= // Create a popup menu now. // ================================= int $numInfls = size($inflList); int $ii; for ($ii = 0; $ii < $numInfls; $ii++) { string $infl = $inflList[$ii]; string $inflShortName = $inflListShortNames[$ii]; string $inflParent = ""; if( $inflListParentIndexes[$ii] >= 0 ) { $inflParent = $inflList[$inflListParentIndexes[$ii]]; } treeView -e -addItem $infl $inflParent $currentTreeView ; if( $inflShortName != "" ) { treeView -e -displayLabel $infl $inflShortName $currentTreeView ; } } // Reapply the curent user defined filter (which will togle items visibility filterUIRefreshView $currentTreeView ; // ================================= // Set the selection // ================================= for( $item in $currentListSelection ) { if( `treeView -q -itemExists $item $currentTreeView ` ) { treeView -e -selectItem $item 1 $currentTreeView ; } } // set up the color on the buttons. $numInfls = size($inflList); for ($ii = 0; $ii < $numInfls; $ii++) { string $infl = $inflList[$ii]; if( $inflTypes[$ii] == 0 ) { string $colorPlug = $infl + ".objectColor"; int $colorIndex = `getAttr $colorPlug`; float $rgb[] = `colorIndex -q ($colorIndex+24)`; print $rgb; // We have to write something on the button to see the color treeView -edit -buttonTextIcon $infl 1 " " $currentTreeView; treeView -edit -buttonTransparencyColor $infl 1 $rgb[0] $rgb[1] $rgb[2] $currentTreeView; } else { treeView -edit -enableButton $infl 1 0 -buttonVisible $infl 1 0 $currentTreeView; } } } global proc bindingSelectInfluence () { string $sel[] = `ls -sl`; if (size($sel) > 0) { // pick up the values methods from the context. source skinBindValues; string $currContext = `currentCtx`; global string $gSkinBindInfluencesList; string $list[] = `listConnections -type skinCluster`; if( size( $list ) > 0 ) { bindSkinInflPopulate( $list[0], $gSkinBindInfluencesList ); skinBindSelectionSetup $currContext; } } }