Executing a script
 
 
 

MotionBuilder provides various methods for executing scripts. You can choose any of the following methods to execute a script:

To launch a script from the Command Line startup:

If you start MotionBuilder from the command line motionbuilder.exe, there are various startup options you can specify. Running MotionBuilder by command line can be a very effective way to assist you in optimizing your pipeline and helping you automate certain tasks.

MotionBuilder Startup Flags

The following table lists the MotionBuilder startup flags.

Note

A command line cannot consist of a user specifying a Python script and a filename for startup because for efficiency your Python script can open the file you want on startup using FBApplication if you need both.

Command line argument Description
-console Opens an output window used by FBTrace in the OR SDK, where the appropriate stdout/err stream goes. If you choose to use this console output window for Python output, you also need to specify the -verbosePythonflag.
-g [width] [height] Sets the window size of MotionBuilder to the values you specified. The default value is as large as the screen size.
-S Starts MotionBuilder in Full Screen Mode. This is the same as choosing Display > Full Screen inside the Viewer. To exit out of Full Screen Mode, press Alt-Enter.
-suspendMessages Disables all the warnings and dialogs. This flag is useful for automation purposes when you do not want the script to be interrupted by dialogs. By default, all warnings and dialogs are shown.
-T[UI Name] Finds a tool with the matching name among the tools that MotionBuilder has registered, and if it is found, it activates it. This flag parameter is case sensitive. Note that unlike the other flags, there is no space between the flag name and the UI Name parameters.
-verbosePython Outputs all Python messages to the appropriate stdout/err stream.This puts the Python print messages to the window that you activate as well as to the Python Editor using the console flag. This is the same location that FBTrace outputs to when using the OR SDK. By default, we do not output python output to stdout/err, only to the Python Editor.

If you know every single time you run MotionBuilder you always want a flag to be executed, instead of using the command line which can be inefficient, you can edit your Windows shortcut for the MotionBuilder application to include the flag parameter you want so that when you double click the application icon the flag is executed. A good use of this is for the -console flag. Following are some examples.

Command line argument Description
motionbuilder.exe mia_blue.fbx Opens the file mia_blue.fbx on MotionBuilder startup.
motionbuilder.exe -S mia_blue.fbx Starts MotionBuilder in Full Screen opening the scene mia_blue.fbx.
motionbuilder.exe -suspendMessages testScript.py Launches the script testScript.py on startup and suppresses all messages boxes that the script might generate.
motionbuilder.exe -console -verbosePython Script.py Launches the script Script.py and sends the output to the console output window.
motionbuilder.exe -g 500 500 -S mia_blue.fbx Specifies the full screen mode to be 500 by 500 with the scene mia_blue.fbx open.
motionbuilder.exe -TAudio Launches the tool Audio from the toolaudio folder in the Samples\tools\ directory on start up. (You need to compile it first.)
motionbuilder.exe -console "-TPython Editor" mia_blue.fbx Launches the tool Python Editor and console opening the scene mia_blue.fbx.

See Also