wondering if there's a way to "refresh" the hotkeys from a file. I want to be able to have multiple hotkey configs, and load them up with a hotkey... anyone got any ideas?
take a look at the userHotkeys.mel and userRunTimeCommands.mel files in the user directory. It should be possible to make different versions of these files and source them to make a hotkey set active. I think you only need to make different versions of the userHotkeys.mel file because you could write all runTimeCommands in one file. Not sure if this works but you can try.
hope this helps a bit
have you got any idea how to force maya to reload these files??? because it doesn't sound like having multiple versions and swapping these would be too hard, i just don't know how to force maya to reload them
anyone got any ideas?
Ok, I've managed to get the code working to swap the actual files, now all I need to do is figure out how to force the files to reload themselves.
unfortunately the souce command doesn't work... does anyone know?
You just have to use the "source" command to execute the file, there
Ok, I just tried it and found out that you also need the userNamedCommands.mel file. So once you have all commands you want to use for the hotkeys in the userRunTimeCommands.mel and userNamedCommands.mel you can make different versions of the userHotkeys.mel file and source them.
ok, sourcing the userRuntimeCommands.mel works great, but the problem is, that the hotkeys aren't refreshed as such. whatever is different in the new file is added, but the old stuff isn't deleted. So I need someway to force maya to write a new hotkey file, flush it from memory, and load in a new one.
any ideas anyone? it looks like maya just wasn't made for this... either that, or this task is beyond my feeble skills. ![]()
you could use this:
hotkey -fs;
this resets the hotkeys to the factory settings, or do you want the other keys to have no function at all? Then you should try to use the hotkey command to assign nothing to all possible keys.
//*******************************
string $char[] = {"a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n",
"o", "p", "q", "r", "s", "t", "u",
"v", "w", "x", "y", "z"};
string $specialC[] = {"up", "down", "right", "left",
"home", "end", "page_up", "page_down",
"insert", "return", "space", "f1", "f2",
"f3", "f4", "f5", "f6", "f7", "f8", "f9",
"f10", "f11", "f12"};
string $letter;
for($letter in $char)
{
print ("hotkey -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -alt -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -ctl -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -alt -ctl -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -k "" + toupper $letter + "" -n "" -rn "";n");
print ("hotkey -alt -k "" + toupper $letter + "" -n "" -rn "";n");
print ("hotkey -ctl -k "" + toupper $letter + "" -n "" -rn "";n");
print ("hotkey -alt -ctl -k "" + toupper $letter + "" -n "" -rn "";n");
}
for($letter in $specialC)
{
print ("hotkey -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -alt -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -ctl -k "" + $letter + "" -n "" -rn "";n");
print ("hotkey -alt -ctl -k "" + $letter + "" -n "" -rn "";n");
}
//*******************************
in case you want to assign nothing to every key, this script prints commands every possible key combination. so just execute this script and copy the result from the script-editor to a file. You can then use this file to clear every key and after that source your hotkey-file. But remember that this clears _every_ key, so after using these hotkey commands there will be no hotbox on "space" and no movetool on "w". So if you want that certain key aren