// =========================================================================== // 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: Jan. 6, 97 // // Description: defines behaviour and layout of ik handle portion // of the jointContext tool property sheet // global proc ikHandlePropCallback(string $parent, string $whichCallback) // // Procedure Name: // ikHandlePropCallback // // Description: // Callbacks for the IK Handle Tool Property Sheet in joint tool. // // Input Arguments: // Parent name, and // current callback name. // // Return Value: // None. // { setParent $parent; string $whichCtx = `currentCtx`; switch ($whichCallback) { case "selectedIKSolver": string $solverName = ikSolverUnlocalize(`optionMenuGrp -q -value ikHandleOptionMenu`); jointCtx -e -solverTypeH $solverName $whichCtx; break; case "autoPriorityOn": intSliderGrp -e -enable false priority; jointCtx -e -autoPriorityH true $whichCtx; break; case "autoPriorityOff": intSliderGrp -e -enable true priority; jointCtx -e -autoPriorityH false $whichCtx; break; case "snapHandleHOn": jointCtx -e -snapHandleH true $whichCtx; break; case "snapHandleHOff": jointCtx -e -snapHandleH false $whichCtx; break; case "forceSolverHOn": jointCtx -e -forceSolverH true $whichCtx; break; case "forceSolverHOff": jointCtx -e -forceSolverH false $whichCtx; break; case "stickyHOn": jointCtx -e -stickyH sticky $whichCtx; break; case "stickyHOff": jointCtx -e -stickyH off $whichCtx; break; case "priorityHValue": int $p = `intSliderGrp -q -v priority`; jointCtx -e -priorityH $p $whichCtx; break; case "weightHValue": float $w = `floatSliderGrp -q -v handleWeight`; jointCtx -e -weightH $w $whichCtx; break; case "poWeightHValue": float $pow = `floatSliderGrp -q -v handlePOWeight`; jointCtx -e -poWeightH $pow $whichCtx; break; default: break; } } global proc ikHandleSetCallbacks (string $parent) // // Procedure Name: // ikHandleSetCallbacks // // Description: // associate control events with callbacks // // Input Arguments: // parent name. // // Return Value: // None. // { setParent $parent; optionMenuGrp -e -cc `CBG "ikHandleProp" $parent "selectedIKSolver"` ikHandleOptionMenu; checkBoxGrp -e -on1 `CBG "ikHandleProp" $parent "autoPriorityOn"` -of1 `CBG "ikHandleProp" $parent "autoPriorityOff"` autoPriorityGrp; checkBoxGrp -e -on1 `CBG "ikHandleProp" $parent "snapHandleHOn"` -of1 `CBG "ikHandleProp" $parent "snapHandleHOff"` snapHandleGrp; checkBoxGrp -e -on1 `CBG "ikHandleProp" $parent "forceSolverHOn"` -of1 `CBG "ikHandleProp" $parent "forceSolverHOff"` forceSolverGrp; //===================================================== // For maya1.0, there is not superSticky yet. So in UI, // use checkBox to turn on/off sticky. // // Use radioButtonGrp when implementing superSticky. //===================================================== //radioButtonGrp -e // -on1 `CBG "ikHandleProp" $parent "stickyOff"` // -on2 `CBG "ikHandleProp" $parent "stickySticky"` // -on3 `CBG "ikHandleProp" $parent "stickySuperSticky"` // stickyGrp; checkBoxGrp -e -on1 `CBG "ikHandleProp" $parent "stickyHOn"` -of1 `CBG "ikHandleProp" $parent "stickyHOff"` stickyGrp; intSliderGrp -e -cc `CBG "ikHandleProp" $parent "priorityHValue"` priority; floatSliderGrp -e -cc `CBG "ikHandleProp" $parent "weightHValue"` handleWeight; floatSliderGrp -e -cc `CBG "ikHandleProp" $parent "poWeightHValue"` handlePOWeight; return; } global proc ikHandleOptionLayout(string $parentN, int $cl ) // // Procedure Name: // ikHandleOptionLayout // // Description: // jointTool property sheet shares this proc to create ikHandle part. // { string $parent; string $solvers[]; string $solverType; int $itemNum; int $i; setParent $parentN; setUITemplate -pushTemplate OptionsTemplate; frameLayout -cll true -cl $cl -label (uiRes("m_ikHandleOptionLayout.kIKHandleSettings")) ikHandleFrame; columnLayout ikHandleOptions; separator -style "none"; $parent = `setParent -query`; optionMenuGrp -label (uiRes("m_ikHandleOptionLayout.kCurrentSolver")) ikHandleOptionMenu; $solvers = `ikSystem -q -ls`; $itemNum = 0; for( $i = 0; $i < size($solvers); $i++ ) { $solverType = `objectType $solvers[$i]`; if( $solverType != "ikSplineSolver" && $solverType != "hikSolver") { string $l10n = ikSolverLocalize($solvers[$i]); menuItem -label $l10n ($solvers[$i] + $itemNum); $itemNum++; } } separator -hr true sep1; checkBoxGrp -label "" -numberOfCheckBoxes 1 -label1 (uiRes("m_ikHandleOptionLayout.kAutopriority")) autoPriorityGrp; checkBoxGrp -label "" -numberOfCheckBoxes 1 -label1 (uiRes("m_ikHandleOptionLayout.kSolverEnable")) forceSolverGrp; checkBoxGrp -label "" -numberOfCheckBoxes 1 -label1 (uiRes("m_ikHandleOptionLayout.kSnapEnable")) snapHandleGrp; checkBoxGrp -label "" -numberOfCheckBoxes 1 -label1 (uiRes("m_ikHandleOptionLayout.kSticky")) stickyGrp; separator -hr true sep2; intSliderGrp -field 1 -label (uiRes("m_ikHandleOptionLayout.kPriority")) -minValue 0 -value 1 priority; floatSliderGrp -field 1 -label (uiRes("m_ikHandleOptionLayout.kWeight")) -minValue 0.0 -maxValue 100.0 -step 0.1 -value 1.0 handleWeight; floatSliderGrp -field 1 -label (uiRes("m_ikHandleOptionLayout.kPOWeight")) -minValue 0.0 -maxValue 1.0 -step 0.001 -value 1.0 handlePOWeight; setParent ..; // ikHandleOptions setParent ..; // ikHandleFrame setUITemplate -popTemplate; ikHandleSetCallbacks( $parent ); clear($solvers); return; }