// Creation Date: Jun-01-2001 // Last Updated: Apr-02-2002 // Revision: 1.1 // Tested on Maya: 3.01 and 4.0 // // Author: Gino Dammers - gdammers@xs4all.nl // // Procedure Name: // // axisControl // // Description: // This script eliminates the need of double clicking on the move or rotate tool to switch axises. // AxisControl creates a little interface on your Maya window that lets you quickly switch // between axises, depending which two tools you're standing.. The Move Tool or Rotate Tool. // Once installed the AxisControl window will automatically update every time you switched Tool.. // If you switch to a tool that's not Move or Rotate, AxisControl will automatically hide itself. // It will show itself again when you select Move or Rotate. // ------- // Move - Object, Local, World // Rotate - Local, Global, Gimbal. // // Usage: // Type " axisControl " in the script editor and drag it to your shelf. // Press it to toggle axisControl On or Off // global proc perform_axisControl(string $toolName, string $focusWindow) { if (!`window -exists eg_axisControl`) { window -mxb false -title "Axis Control" -topEdge 32 -leftEdge 988 -w 228 -h 36 -tb false -vis false eg_axisControl; columnLayout AxisControlColumnLayout; radioButtonGrp -nrb 3 -cw 1 50 -cw 2 57 -cw 3 57 -vis false -l "Rotate" -l1 "Local" -l2 "Global" -l3 "Gimbal" manipModeRadio; radioButtonGrp -nrb 2 -vis false -cw 1 50 -l "Move" -l1 "Object" -l2 "Local" manipModeRadio1 ; radioButtonGrp -shareCollection manipModeRadio1 -vis false -cw 1 50 -nrb 2 -l "" -l1 "World" -l2 "Normal" -en2 false manipModeRadio2; } if ($toolName == "Move") { // Hide the Rotate controls radioButtonGrp -e -vis false manipModeRadio; // Initialize settings // int $manipMode = `manipMoveContext -q -mode $toolName`; switch ($manipMode) { case 0: radioButtonGrp -e -sl 1 manipModeRadio1; $manipMode = 1; break; case 1: radioButtonGrp -e -sl 2 manipModeRadio1; $manipMode = 2; break; case 2: radioButtonGrp -e -sl 1 manipModeRadio2; $manipMode = 3; break; case 3 : radioButtonGrp -e -sl 2 manipModeRadio2; $manipMode = 4 ; break; } // Object vs Local vs Global Space vs vertex Normal // radioButtonGrp -e -vis true -nrb 2 -on1 ("manipMoveContext -e -mode 0 " + $toolName) -on2 ("manipMoveContext -e -mode 1 " + $toolName) manipModeRadio1 ; radioButtonGrp -e -vis true -nrb 2 -on1 ("manipMoveContext -e -mode 2 " + $toolName) -on2 ("manipMoveContext -e -mode 3 " + $toolName) manipModeRadio2; if (!`window -q -vis eg_axisControl`) showWindow eg_axisControl; setFocus $focusWindow; } if ($toolName == "Rotate") { // Hide the Move controls radioButtonGrp -e -vis false manipModeRadio1; radioButtonGrp -e -vis false manipModeRadio2; // Initialize settings // int $manipMode = `manipRotateContext -q -mode $toolName`; switch ($manipMode) { case 0: radioButtonGrp -e -sl 1 manipModeRadio; $manipMode = 1; break; case 1: radioButtonGrp -e -sl 2 manipModeRadio; $manipMode = 2; break; case 2: radioButtonGrp -e -sl 3 manipModeRadio; $manipMode = 3; break; } // Object vs Local vs Global Space vs vertex Normal // radioButtonGrp -e -vis true -nrb 2 -on1 ("manipRotateContext -e -mode 0 " + $toolName) -on2 ("manipRotateContext -e -mode 1 " + $toolName) -on3 ("manipRotateContext -e -mode 2 " + $toolName) -select $manipMode manipModeRadio; if (!`window -q -vis eg_axisControl`) showWindow eg_axisControl; setFocus $focusWindow; } } global proc check_axisControl() { string $wf = `getPanel -withFocus`; if (`currentCtx` == "moveSuperContext") { perform_axisControl "Move" $wf; } else if (`currentCtx` == "RotateSuperContext") { perform_axisControl "Rotate" $wf; } else { if ( `window -exists eg_axisControl` ) deleteUI -window eg_axisControl; } } global proc int axisControlisActive() { global int $axisControlJob; if ($axisControlJob) { int $a = 1; return $a; } else { int $a = 0; return $a; } } global proc axisControl() { axisControlisActive; global int $axisControlJob; if ($axisControlJob) { axisControlUninstall; } else { axisControlInstall; } } global proc axisControlInstall() { global int $axisControlJob; if ($axisControlJob!=0) { warning "axisControl is already installed.. switch to Move or Rotate Tool to see the panel"; } else { $axisControlJob=`scriptJob -event "ToolChanged" "check_axisControl"`; check_axisControl; print("// Result: axisControl Installed.// \n"); } } global proc axisControlUninstall() { // setTool selectionSuperContext; global int $axisControlJob; if ($axisControlJob!=0) { scriptJob -k ($axisControlJob); print("// Result: axisControl Un-Installed.// \n"); $axisControlJob=0; if ( `window -exists eg_axisControl` ) deleteUI -window eg_axisControl; } }