There are two types of Python shortcuts:
You can create up to 12 global shortcuts that can be mapped, or bound, to scripts. By default, some are already set up. Try Shift+F1 (from the MotionBuilder interface, not the Python editor); it creates a new camera. This is because the keyboard combination Shift+F1 is bound to the execution of NewCamera.py.
Bindings between shortcuts and scripts are configured in two steps:
config\Scripts\ActionScript.txt contains a list of scripts to execute:
[ScriptFiles]
Script1 = Basic OperationsNewCamera.py
Script2 = ActionScriptKeyIK.py
Script3 = ActionScriptKeyFK.py
Script4 = ActionScriptKeyEffector.py
Script5 = ActionScriptKeySelected.py
Script6 =
Script7 =
Script8 =
Script9 =
Script10 =
Script11 =
Script12 =
The path to the script can be one of:
Next map the script (for example Script1) to a keyboard shortcut in a keyboard file in config\Keyboard\. These files contain entries for all of the keyboard shortcuts in MotionBuilder. There are several files; you use one at a time according to the menu Settings > Keyboard Configuration. You can also use the KeyboardMapper.py script as a graphical interface to the keyboard configuration text files.
Python script bindings are of the form:
action.global.script1 = SHFT:F1*DN}
Do not to assign the same shortcut to two different actions. If you do, neither will work.
You can create your own keyboard.txt files. In the example below, "MyKeyboardConfig" would appear in the Settings > Keyboard Configuration menu after MotionBuilder restart.
[Config]
Name = MyKeyboardConfig
Following are codes used in Keyboard\*.txt. See the existing keyboard files for examples of usage.
Note that a key is specified, and not a character. For example, on a standard American keyboard there is no "@" key, since this character is made by using the modifier key Shift+2.
Modifiers
Keys
Modifiers