Loading from a File
 
 
 

Loading from a File

The following code sample illustrates how to open a file using FBApplication.FileOpen().

NoteIt is recommended to use an absolute path as an argument to FBApplication.FileOpen(). If a relative path is specified, it is relative to the current working directory of MotionBuilder. The current working directory of MotionBuilder can be changed in various ways, for example: by manually opening a file, or invoking FBPopup.Execute() to let the user specify the location to save or load a file.

from pyfbsdk import *

app = FBApplication()

filename = "C:\Program Files\Autodesk\MotionBuilder 2012 (64-bit)\OpenRealitySDK\scenes\PlasticMan.fbx"

# Open the sample file "PlasticMan.fbx", and prompt the user with a 
# UI dialog box, as indicated by the second True argument.
app.FileOpen(filename, True)

Opening, Merging, Appending and Importing...

FBApplication provides several functions allowing you to control how the loaded data appears in the scene. The following table describes these functions.

Function Description
FBApplication.FileOpen()

Opens the file, and replaces the current scene with the loaded data.

This is equivalent to File > Open... in the application menu.

FBApplication.FileMerge()

Opens the file, and merges its contents with the current scene.

This is equivalent to File > Merge... in the application menu.

FBApplication.FileAppend()

Opens the file, and appends its contents to the current scene.

This is equivalent to File > Merge... in the application menu, with all options set to "append".

FBApplication.FileImport()

Opens the file, and imports the animation data contained in the motion file. If the second parameter of this function is True, models matching by name in the scene will have their animation data replaced by the imported data.

This is equivalent to File > Motion File Import... in the application menu.