// =========================================================================== // 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: 17 January 97 // // // Procedure Name: // shuffleManipHandleIndex // // Description: // // Allows user to cycle through the handles on // the transformation manips, both forwards and // backwards. Passing in 1 indexes up, and -1 // indexes down. Could be extended to other // manip types, if they gain the ability to set // their active handles. // // Input Arguments: // -next // -previous // // Return Value: // None. // global proc shuffleManipHandleIndex( string $shuffle ) { global string $gMove, $gRotate, $gScale; // // Get the current context // string $currentCtx = `currentCtx`; string $cmdString; int $increment; if( $shuffle == "-next" ) { $increment = 1; } else { $increment = -1; } if( $currentCtx == $gMove ) { if (`superCtx -q $gMove` != "Move") return; // // Get the currently active handle on // the move context // int $newAH = `manipMoveContext -q -ah Move`; $newAH = ( $newAH + $increment ); if( $newAH == 4 ) { // // Index is greater than 4, so set // it back to 0 to allow cycling // $newAH = 0; } if( $newAH == -1 ) { // // Index is less than 0, so set it // back to 3 to allow cycling // $newAH = 3; } // Build the command string to execute to change the active // manip handle // $cmdString = ( "manipMoveContext -e -ah "+$newAH+" Move" ); eval $cmdString; return; } if( $currentCtx == "Rotate" ) { if (`superCtx -q $gMove` != "Rotate") return; // // Get the currently active handle on // the rotate context // int $newAH = `manipRotateContext -q -ah $currentCtx`; $newAH = ( $newAH + $increment ); if( $newAH == 3 ) { // // Index is greater than 2, so set // it back to 0 to allow cycling - note // that the screen aligned handle is // being filtered out here - set this // to 4 to get the screen aligned handle // included in the cycling. // $newAH = 0; } if( $newAH == -1 ) { // // Index is less than 0, so set it // back to 2 to allow cycling // $newAH = 2; } // Build the command string to execute to change the active // manip handle // $cmdString = ( "manipRotateContext -e -ah "+$newAH+" "+$currentCtx ); eval $cmdString; return; } if( $currentCtx == $gScale ) { if (`superCtx -q $gScale` != "Scale") return; // // Get the currently active handle on // the scale context // int $newAH = `manipScaleContext -q -ah "Scale"`; $newAH = ( $newAH + $increment ); if( $newAH == 4 ) { // // Index is greater than 4, so set // it back to 0 to allow cycling // $newAH = 0; } if( $newAH == -1 ) { // // Index is less than 0, so set it // back to 3 to allow cycling // $newAH = 3; } // Build the command string to execute to change the active // manip handle // $cmdString = ( "manipScaleContext -e -ah "+$newAH+" Scale" ); eval $cmdString; return; } }