You can run Python scripts when MotionBuilder starts up and while MotionBuilder is running.
At start up, MotionBuilder runs Python scripts in the following order:
ToolManager.py in
.
Python scripts in the user folder. For example, C:\Users\
Python scripts in
Python scripts in a user defined Python startup folder. To set the user defined Python startup folder, select Settings Preferences
Python, and specify a folder in the Python startup folder field.
The startup folder is added to the Python import path variable (sys.path
). You can import functionality from scripts saved here to other scripts. Alternatively, you can also use the Command Line Options to specify which script to run when MotionBuilder starts up.
You can run Python scripts within MotionBuilder in the following ways:
Run individual commands and Python scripts in the Python Editor's interactive console, or using the Python Telnet Console.
Bind Python scripts to a keyboard shortcut. For more information, see Managing Python Tools.
Run Python scripts from the Asset Browser using a custom path (right click in the navigation tree). When you drag and drop from the Asset Browser to the scene, you are prompted to execute, add to the scene, or both. Adding to the scene makes it accessible in the Navigator under Scripts.
Run Python scripts through MotionBuilder's C++ API function FBApplication::ExecuteScript().