Iconoklast
01-14-2005, 07:00 PM
Ok, this is a bit primitive and needs implementing with tools, but I've managed to make a nice clean replica of XSI's very handy sticky keys. If you're unfamiliar with them, basically the way they work is, if you have say, the scale tool selected, and you press and hold the move tool, do your moving, and then release the move tool key, it will switch you back to scale. If you just tap the move tool, instead of holding it down, it will switch to the move tool permanently.
Anyway, the code isn't very elegant, and what I have here is just a testing purpose (only works for the move tool), but I thought I'd paste it for others to have a mess with aswell.
Here how it setup:
Go to the hotkey editor and create 'New'. Call this 'StickyMove' and paste the following:
global float $start;
global string $gMove;
global string $tool;
global string $newTool;
float $start = `timerX`;
$tool = `currentCtx`;
setToolTo $gMove;
$newTool = `currentCtx`;
hit 'accept'. Create another one ('New') and call this StickyMoveRelease, and put this in the command area:
global float $start;
global string $tool;
global string $newTool;
float $time = `timerX -st $start`;
print $time;
if ($time > 0.1)
setToolTo $tool;
else
setToolTo $newTool;
Now just bind StickyMove to a key, and StickyMoveRelease to the same key but make sure the 'release' radio button is checked.
Then, create a cube, grab the scale tool, do some scaling, then hit the hotkey, move it around a bit, then release and it will switch you back to scale. Or, tap the hotkey and it will switch you to move permanently
It's obviously not as well implemented as XSI's sticky keys, since it works on all keys there, and here you have to make ones for individual keys, but I think sticky keys are really handy and pleasant to use and thought I'd figure out a way to have them in maya.
Anyway, the code isn't very elegant, and what I have here is just a testing purpose (only works for the move tool), but I thought I'd paste it for others to have a mess with aswell.
Here how it setup:
Go to the hotkey editor and create 'New'. Call this 'StickyMove' and paste the following:
global float $start;
global string $gMove;
global string $tool;
global string $newTool;
float $start = `timerX`;
$tool = `currentCtx`;
setToolTo $gMove;
$newTool = `currentCtx`;
hit 'accept'. Create another one ('New') and call this StickyMoveRelease, and put this in the command area:
global float $start;
global string $tool;
global string $newTool;
float $time = `timerX -st $start`;
print $time;
if ($time > 0.1)
setToolTo $tool;
else
setToolTo $newTool;
Now just bind StickyMove to a key, and StickyMoveRelease to the same key but make sure the 'release' radio button is checked.
Then, create a cube, grab the scale tool, do some scaling, then hit the hotkey, move it around a bit, then release and it will switch you back to scale. Or, tap the hotkey and it will switch you to move permanently
It's obviously not as well implemented as XSI's sticky keys, since it works on all keys there, and here you have to make ones for individual keys, but I think sticky keys are really handy and pleasant to use and thought I'd figure out a way to have them in maya.
