View Full Version : script for changing hotkeys?

03 March 2003, 09:19 AM
i noticed one of the efficient strengths of 3d apps like LW and Wings is that because they have a reduced amount of "features" they can afford a lot of intuitive hotkeys for modelling. Maya on the contrary cannot afford this because of its shear volume.

Does such a script exist(mel is way beyond me) that will know which mode you are in...say...Modelling mode...and while in this mode all of the hotkeys are relevant to modelling toolls...and say....once you are in Animation mode...all of the hotkeys will then be relavent to animation? The point is to streamline the hotkeys so they make sense for what you are doing. When i am modelling...i will never need to use the animation hotkeys...and vice versa. This makes a lot more space for doing hotkeys for common tasks like extrude and merge vertices or split polygon tool and what not yet not waste the hotkeys when you are animating....

03 March 2003, 04:49 PM
string $mode = `optionMenu -q -v menuMode`;

if ($mode == "Animation")
{ }

if ($mode == "Modeling")
{ }

if ($mode == "Dynamics")
{ }

if ($mode == "Rendering")
{ }

if ($mode == "Cloth")
{ }

insert whatever hotkey commands you want to use for the different modes in the corresponding brackets.

03 March 2003, 04:54 PM
Heres another one that i use a lot. This one calls different hotkeys depending on which panel is the active one

$activePanel = `getPanel -withFocus`;

if ($activePanel == "graphEditor1")
{ }
else if ($activePanel == "outlinerPanel")
{ }
else { }

04 April 2003, 10:51 AM
Thanx Sam....if you have time to go into this a bit more indepth...

i had a programming course when i was i know a just little about the "if" and "else if" statements....

so what actually goes into the brackets? the reason i ask is what are the mel commands for the tools assigned to hotkeys?

04 April 2003, 03:58 PM
Just put whatever hotKey command you want inside the brackets. You can find the commands by looking through the hotKey editor window and by selecting the command from the menu and then look for what it says in the scriptEditor.

For example

string $mode = `optionMenu -q -v menuMode`;

if ($mode == "Animation" || $mode == "Rendering" || $mode == "Dynamics" || $mode == "Cloth")
{performSetKeyframeArgList 1 {"0", "animationList"};}
else {performPolyPrimitive Sphere 0;}

In this example, I used ||, which means "or".
(You can also use &&, which means "and")

what the code above says is something like
"if mode is animation or rendering or dynamics or cloth, set keyFrame. Otherwise, create poly sphere.

04 April 2003, 10:57 AM
ok...makes sense now. And then i would take this script...and assign it to the actual hotkey no? For you example....I would assign "s" and if it was in the modelling mode it would create a sphere....other wise it would create a keyframe whenever i used "s"

04 April 2003, 04:32 PM

CGTalk Moderation
01 January 2006, 07:00 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.