PDA

View Full Version : Tool Switcher


Rook
04-30-2005, 03:31 AM
Anyone have any ideas on making a mel script that functions so when you hit a hotkey it will toggle between the move, scale, rotate and select tool. Any help would be appreciated.

lkruel
04-30-2005, 03:47 AM
It's already built into Maya,

Q - Select
W- move
E- rotate
R - Scale

If memory serves me right

Rook
04-30-2005, 04:24 AM
I figured it out.
I have that silly Nostromo 52 pad. I mapped the scroll wheel so it scrolls between all the tools.
The wheel works in that every time you scroll it, a hotkey is activated. With one hotkey, "O" I toggle between, move, select, rotate and scale.
Basically I needed a bunch of "if" statements

poly-phobic
04-30-2005, 04:38 AM
can u post your script :)
sounds like one of those minute scripts that will make workflow quicker.

Rook
04-30-2005, 05:03 AM
Sure. The only thing I can't figure out now is if your not in one of the tools listed in the script, how do you change the tool to the select tool.


Assign this to a hotkey. Works well with the Nostormo Pad scroll wheel
//
//scroll down
//
string $currentCtx = `currentCtx`;
global string $gSelect;
global string $gMove;
global string $gRotate;
global string $gScale;

if ( $currentCtx == $gSelect )
{
setToolTo $gMove;
}

if ( $currentCtx == $gMove )
{
setToolTo $gRotate;
}


if ( $currentCtx == $gRotate )
{
setToolTo $gScale;
}

if ( $currentCtx == $gScale )
{
setToolTo $gSelect;
}

thematt
04-30-2005, 09:11 AM
wouldn't you be able to had an other variable that stand for the "y" short cut and in an other if statement check if that one is selected to send you to the move tool?

Sorry can't be mre clear bcause i don't have maya here..



cheers

ajk48n
04-30-2005, 04:14 PM
If you're in a different tool, you could try using the switch statement.

Here's the fixed script.

string $currentCtx = `currentCtx`;

switch ($currentCtx) {

case "selectSuperContext":
setToolTo "moveSuperContext";
break;

case "moveSuperContext":
setToolTo "RotateSuperContext";
break;

case "RotateSuperContext":
setToolTo "scaleSuperContext";
break;

case "scaleSuperContext":
setToolTo "selectSuperContext";
break;

}

poly-phobic
05-09-2005, 08:20 PM
ajk48n: the switch statement here does not work when switching from a different tool.
i get a syntax error. \

poly-phobic
05-09-2005, 11:27 PM
edit******************

CGTalk Moderation
05-09-2005, 11:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.