// =========================================================================== // 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: Feb 13, 2001 // // Description: // A scriptJob to contro the IK/FK switching UI // global proc ikSelectionChanged(string $menu) // // Description: // When the selection changes, this updated the ik/fk UI // { if (`headsUpDisplay -exists HUDIKSolverState` && `headsUpDisplay -q -vis HUDIKSolverState`) { // The menu will get updated when the Heads Up Display is // updated. // return; } // There are five different returned values from ikFKSolverState() // 0 : No joints or ikHandles are selected. // 1 : The selected items have their solver enabled. // 2 : The selected items have their solver disabled. // 3 : No solver on the selcted joints. // 4 : Some of the selected items have their solvers // enabled and others have their solvers disabled. // int $solverState = ikFKSolverState(`ls -sl`); int $ikOn = false; if ($solverState == 1 || $solverState == 4) { $ikOn = true; } menuItem -edit -checkBox $ikOn $menu; optionVar -intValue ikFKSwitchState $ikOn; } global proc updateIKFKCheckBox(int $state) { global string $gikFKSwitchStateCheckBoxMenu; if (`menuItem -ex $gikFKSwitchStateCheckBoxMenu`) { menuItem -edit -checkBox $state $gikFKSwitchStateCheckBoxMenu; optionVar -intValue ikFKSwitchState $state; } } global proc setUpIKSelectionScriptJob(string $menu) { global string $gikFKSwitchStateCheckBoxMenu; $gikFKSwitchStateCheckBoxMenu = $menu; scriptJob -protected -event "SelectionChanged" ("ikSelectionChanged(\""+$menu+"\")"); scriptJob -protected -event timeChanged ("ikSelectionChanged(\""+$menu+"\")"); }