// =========================================================================== // 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 setSkinBindOptionVars(int $forceFactorySettings) { if ( $forceFactorySettings || !`optionVar -exists skinBindFalloffCurveOptionVar` ) { optionVar -rm "skinBindFalloffCurveOptionVar"; optionVar -stringValueAppend "skinBindFalloffCurveOptionVar" "0,1,2"; optionVar -stringValueAppend "skinBindFalloffCurveOptionVar" "1,0,2"; } if ( $forceFactorySettings || !`optionVar -exists skinBindReflectOption` ) { optionVar -iv skinBindReflectOption 1; } if ( $forceFactorySettings || !`optionVar -exists sortBindingList` ) { optionVar -iv sortBindingList 2; } } global proc skinBindColorRampKeyChanged() { if (`colorSliderGrp -q -exists skinBindColorRampSlider` && `gradientControlNoAttr -q -exists skinBindColorRamp`) { float $t[] = `gradientControlNoAttr -q -currentKeyColorValue skinBindColorRamp`; colorSliderGrp -e -rgb $t[0] $t[1] $t[2] skinBindColorRampSlider; } } global proc skinBindSetColorRampKey () { string $currContext = `currentCtx`; if (`colorSliderGrp -q -exists skinBindColorRampSlider` && `gradientControlNoAttr -q -exists skinBindColorRamp`) { float $t[] = `colorSliderGrp -q -rgb skinBindColorRampSlider`; gradientControlNoAttr -e -currentKeyColorValue $t[0] $t[1] $t[2] skinBindColorRamp; string $rampValue = `gradientControlNoAttr -q -asString skinBindColorRamp`; string $rampCmd = "skinBindCtx -e -colorRamp \"" + $rampValue + "\" " + $currContext; eval ($rampCmd); } } global proc skinBindListSelectUpdate( string $currContext ) { // Called when the treeView selection is changed, global string $gSkinBindInfluencesList; string $selectedInfs[] = `treeView -q -si $gSkinBindInfluencesList`; skinBindCtx -e -currentInfluence $selectedInfs[0] $currContext; } global proc skinBindReflectionValues ( ) { // Make sure the symmetry panel exists if (`checkBoxGrp -exists IBReflectionOptionsMode` == 0) return; string $currContext = `currentCtx`; string $val; int $enable = `optionVar -q skinBindReflectOption`; skinBindCtx -e -symmetry $enable $currContext; checkBoxGrp -edit -value1 $enable -changeCommand1 (" skinBindCtx -e -symmetry #1 " + $currContext + "; optionVar -iv skinBindReflectOption #1") IBReflectionOptionsMode; // Symmetry About Mode. $val = `skinBindCtx -q -about $currContext`; if ($val == "world") $intVal = 1; else $intVal = 2; radioButtonGrp -edit -enable $enable -select $intVal -on1 ("skinBindCtx -e -about \"world\" " + $currContext) -on2 ("skinBindCtx -e -about \"object\" " + $currContext) IBReflectionSpace; // Symmetry Axis $val = `skinBindCtx -q -axis $currContext` ; if ($val == "z") $intVal = 3; else if ($val == "y") $intVal = 2; else $intVal = 1; radioButtonGrp -edit -enable $enable -select $intVal -on1 ("skinBindCtx -e -axis \"x\" " + $currContext) -on2 ("skinBindCtx -e -axis \"y\" " + $currContext) -on3 ("skinBindCtx -e -axis \"z\" " + $currContext) IBReflectionOptionsAxis; // Symmetry Tolerance. floatSliderGrp -edit -enable $enable -value `skinBindCtx -q -tolerance $currContext` -cc ("skinBindCtx -e -tolerance #1 " + $currContext) IBReflectionOptionsTol; } global proc skinBindInflMenuColorPostCallBack( string $treeView, string $infl ) { string $colorPlug = $infl + ".objectColor"; int $colorIndex = `getAttr $colorPlug`; float $rgb[] = `colorIndex -q ($colorIndex+24)`; treeView -edit -buttonTransparencyColor $infl 1 $rgb[0] $rgb[1] $rgb[2] $treeView; } global proc skinBindInflMenuColorCallBack( string $treeView, string $item,int $buttonState) { string $title = (uiRes("m_skinBindValues.kInfluenceColorPickerTitle")); $title = `format -s $item $title`; string $refreshJointColorCmd = "skinBindInflMenuColorPostCallBack( \""+$treeView + "\",\"" + $item +"\" );"; objectColorPaletteForObject($item,$title,0,$refreshJointColorCmd ); } global proc skinBindSelectionSetup( string $currContext ) { // Influences list callbacks // treeView -edit -pressCommand 1 ("skinClusterInflMenuColorCallBack (\""+$influencesList +"\")") $influencesList; string $refreshCallback = "bindingSelectInfluence" ; global string $gSkinBindInfluencesList; if (`treeView -q -exists $gSkinBindInfluencesList`) { // update the radio buttons controls radioButton -e -cc ("optionVar -iv sortBindingList 1;"+$refreshCallback) bindSortRadioAlphabetical; radioButton -e -cc ("optionVar -iv sortBindingList 2;"+$refreshCallback) bindSortRadioHierarchy; radioButton -e -cc ("optionVar -iv sortBindingList 3;"+$refreshCallback) bindSortRadioFlat; // set the call back string $cmd = "skinBindListSelectUpdate " + $currContext; treeView -e -scc $cmd $gSkinBindInfluencesList; // update the current infleunce string $currentInf = `skinBindCtx -q -currentInfluence $currContext`; if( `treeView -q -itemExists $currentInf $gSkinBindInfluencesList` ) { treeView -e -si $currentInf 1 $gSkinBindInfluencesList; // clear other items string $selectedInfs[] = `treeView -q -si $gSkinBindInfluencesList`; for( $item in $selectedInfs ) { if ($item != $currentInf) { treeView -e -si $item 0 $gSkinBindInfluencesList; } } treeView -edit -pressCommand 1 ("skinBindInflMenuColorCallBack (\""+$gSkinBindInfluencesList +"\")") $gSkinBindInfluencesList; } } } proc setValues ( string $toolName, int $forceFactorySettings ) { string $currContext = `currentCtx`; setSkinBindOptionVars( $forceFactorySettings ); skinBindReflectionValues(); // update the radio buttons controls string $valueCmd = "skinBindCtx -q -di " + $currContext; int $ivalue =`eval $valueCmd`; if ($ivalue >= 0 && $ivalue < 3) { $buttonList = `radioCollection -q -collectionItemArray ibDisplayCollection`; radioCollection -e -select $buttonList[$ivalue] ibDisplayCollection; } radioButton -e -cc ("skinBindCtx -e -di 0 " + $currContext) ibDisplayNone; radioButton -e -cc ("skinBindCtx -e -di 1 " + $currContext) ibDisplayIntersecting; radioButton -e -cc ("skinBindCtx -e -di 2 " + $currContext) ibDisplayAll; $valueCmd = "skinBindCtx -q -dn " + $currContext; $ivalue =`eval $valueCmd`; string $onCmd = "skinBindCtx -e -dn true " + $currContext; string $offCmd = "skinBindCtx -e -dn false " + $currContext; if ($ivalue >= 0 && $ivalue < 2) { $buttonList = `radioCollection -q -collectionItemArray ibWeightDisplayCollection`; radioCollection -e -select $buttonList[$ivalue] ibWeightDisplayCollection; } radioButton -e -cc $offCmd ibDisplaySelect; radioButton -e -cc $onCmd ibDisplayNormalize; $valueCmd = "skinBindCtx -q -falloffCurve " + $currContext; string $value =`eval $valueCmd`; string $changeCmd = "skinBindCtx -e -falloffCurve \" #1 \" "+ $currContext; gradientControlNoAttr -e -asString $value -changeCommand $changeCmd -optionVar "skinBindFalloffCurveOptionVar" skinBindFalloffRamp; iconTextButton -e -command ("skinBindCtx -e -falloffCurve \"1,0,2,0,1,2\" "+ $currContext) ibSoftTextButton; iconTextButton -e -command ("skinBindCtx -e -falloffCurve \"1,0.5,2,0,1,2,1,0,2\" "+ $currContext) ibMediumTextButton; iconTextButton -e -command ("skinBindCtx -e -falloffCurve \"1,0.75,2,0,1,2,1,0,2\" "+ $currContext) ibMediumHardTextButton; iconTextButton -e -command ("skinBindCtx -e -falloffCurve \"1,0,0,0,1,2\" "+ $currContext) ibHardTextButton; iconTextButton -e -command ("skinBindCtx -e -falloffCurve \"0,1,0,1,0,1,0,1,1\" "+ $currContext) ibLinearTextButton; $valueCmd = "skinBindCtx -q -colorRamp " + $currContext; $value =`eval $valueCmd`; $changeCmd = "skinBindCtx -e -colorRamp \" #1 \" "+ $currContext; gradientControlNoAttr -e -asString $value -changeCommand $changeCmd -currentKeyChanged "skinBindColorRampKeyChanged" skinBindColorRamp; float $t[] = `gradientControlNoAttr -q -currentKeyColorValue skinBindColorRamp`; colorSliderGrp -e -changeCommand "skinBindSetColorRampKey" -rgb $t[0] $t[1] $t[2] skinBindColorRampSlider; iconTextButton -e -command ("skinBindCtx -e -colorRamp \"1,0,0,0.5,1,1,1,0,1,1,0,0,0,0,1\" "+$currContext) ibHotColorTextButton; iconTextButton -e -command ("skinBindCtx -e -colorRamp \"1,0,0,1,1,1,0.5,0,0.75,1,1,1,0,0.5,1,0,1,0,0.25,1,0,0,1,0,1\" "+$currContext) ibFullRangeColorTextButton; iconTextButton -e -command ("skinBindCtx -e -colorRamp \"0.5,0.5,0.5,0.5,1,1,1,1,1,1,0,0,0,0,1 \" "+$currContext) ibGreyColorTextButton; // initialize the list menu skinBindSelectionSetup( $currContext ); string $helpTag = "skinBindTool"; toolPropertySetCommon $toolName "interactiveBindTool.png" $helpTag; toolPropertySelect "skinBind"; } global proc skinBindValues ( string $toolName ) { setValues( $toolName, 0); } global proc skinBindToolReset () { string $ctx = `currentCtx`; if( `contextInfo -c $ctx` == "skinBind") { setValues( $ctx, 1); } }