Saving to a File
Saving to a File
The FBApplication.FileSave()
function allows you to save the current scene to a file. This function is equivalent to File > Save As...
in the application menu. To avoid any ambiguity, it is recommended to use an absolute file path when saving or loading data.
from pyfbsdk import *
app = FBApplication()
# Use an absolute path to save the file.
#
# Note: The 'r' before the path indicates that the string
# should be used literally, including all escape characters such as '\'.
#
app.FileSave(r'C:\Autodesk\filename.fbx')
In the code sample below, we save the scene to a user-specified location via a popup window. We use the os
python module to obtain the current user' s directory (os.path.expanduser('~')
, where the '~'
stands for the home directory). We then set the default value of FBFilePopup.Path
to the current user's My Documents\MB folder.
from pyfbsdk import *
import os
app = FBApplication()
# Save the file using a dialog box.
saveDialog = FBFilePopup()
saveDialog.Style = FBFilePopupStyle.kFBFilePopupSave
saveDialog.Filter = '*.fbx'
saveDialog.Caption = 'My Save Dialog Box'
# Set the path to the current user's My Documents\MB folder.
saveDialog.Path = os.path.expanduser('~') + '\\Documents\\MB'
saveDialog.FileName = 'DancingMan.fbx'
if saveDialog.Execute():
app.FileSave(saveDialog.FullFilename)
FBX File Embedded Media
If you are using the FBX file format to save your scene data, media such as textures and materials can be embedded within the file. This requires that the FBFbxOptions.EmbedMedia
property be set to True
(this property is set to True
by default). Only the binary FBX file format supports embedded media; the ASCII file format does not support embedded media, but is more human-readable. For more information, see File Options.
FBX File Size
You can now open significantly large FBX files in MotionBuilder because it supports FBX SDK 2016. In prior releases of MotionBuilder, the FBX file size was restricted to 2 GB.
- An FBX file saved using Motionbuilder 2016 cannot be opened in prior versions of MotionBuilder because of file format changes. It can only be opened using MotionBuilder 2016.
- If an FBX file needs to be opened using prior versions of MotionBuilder, select Python Tools > FBX Export and choose an FBX version for exporting the FBX file.
- Certain third party video codecs can cause issues when large FBX files (greater than 2 GB) containing video are loaded or saved in Motionbuilder 2016. If issues or crashes occur while loading large FBX files containing video, it is recommended to install the latest updates for any third party video codecs.