FBApplication Class Reference


Detailed Description

FBApplication is used mainly to manage files.

It provides functionality like that in the MotionBuilder file menu, for example, open file, save file.

Note that event registration is instanced-based. When an FBApplication object is destroyed, all the event callbacks are unregistered. If you want to have a tool to be notified of events, it needs to have a FBApplication data member.

Examples
Tasks/BatchExportCharacterAnimationTool.py, Tasks/ExportAnimationLibrary.py, Tasks/SaveOneTakePerFile.py, BasicOperations/FBFbxOptions.py, BasicOperations/FBSystemEvents.py, BasicOperations/ImportWithNamespace.py
Inheritance diagram for FBApplication:

List of all members.

Public Member Functions

 __init__ (object pObject=None)
 Constructor.
bool Minimize (bool pBlocking=True)
 Minimize window.
bool Maximize ()
 Maximize window (minimized).
 UpdateAllWidgets ()
 Request to refresh display of all UI widgets.
 FlushEventQueue ()
 Flush event queue.
bool FileNew (bool pAskUser=False, bool pClearSceneName=True)
 Command FILE->NEW in the menus.
bool FileOpen (str pFilename, bool pShowUIMsg=False, FBFbxOptions pOptions=None)
 Open a file, replacing the current scene.
bool FileOpen (pBuffer, long pBufferLength)
 Open a file from memory.
bool GetMaxFrameCount (pBuffer, long pBufferLength, long pFrameCount, int pTimeScale)
 Get max frame count from a scene file in memory.
bool FileMerge (str pFilename, bool pShowUIMsg=False, FBFbxOptions pOptions=None)
 Merge a file with the current scene.
bool FileMerge (FBStringList pPathlist, bool pShowUIMsg=False, FBFbxOptions pOptions=None)
 Merge multiple files with the current scene.
bool FileAppend (str pFilename, bool pShowUIMsg=False, FBFbxOptions pOptions=None)
 Append a file to the current scene.
bool FileSave (str pFilename=None, FBFbxOptions pOptions=None)
 Save the file under another name.
 FileExit (bool pSave=False)
 Quit application.
bool FileImport (str pFilename, bool pMatchModels=False, bool pCreateUnmatchedModels=True)
 Import a motion file.
bool FileExport (str pFilename)
 Export a motion file.
FBBatchStatus FileBatch (FBBatchOptions pBatchOptions, FBPlotOptions pPlotOptions=None)
 Start a batch.
bool FileImportBatch (str pName, FBBatchOptions pBatchOptions, FBModel pReference)
 Import a motion file using batch options.
bool FileExportBatch (str pName, FBTake pTake, FBBatchOptions pBatchOptions, tuple pExportModels)
 Export a motion file using batch options.
bool SaveCharacterRigAndAnimation (str pFileName, FBCharacter pCharacter, FBFbxOptions pFbxOptions)
 Save the rig and its animation in a file.
bool LoadAnimationOnCharacter (str pFileName, FBCharacter pCharacter, FBFbxOptions pFbxOptions, FBPlotOptions pPlotOptions)
 Load a rig and its animation from a file.
bool IsValidBatchFile (str pFilename)
 Verify motion file readability.
bool OneClickSendAsNewScene (FBOneClickApplication pApplication)
 Send the current scene as a new scene in the specified application.
bool OneClickUpdateCurrentScene ()
 Send the scene to update the current scene in the specified application.
bool OneClickAddToCurrentScene ()
 Send the scene and add it to the current scene in the specified application.
 OneClickSelectPreviouslySentObject ()
 Select, in MotionBuilder, the object that were sent.
FBOneClickApplication OneClickIsConnectedTo ()
 Return the other application that MotionBuilder is connected to.
bool FileRender (FBVideoGrabOptions pRenderOptions=None)
 Render current scene to media file.
bool AudioRender (FBAudioRenderOptions pAudioRenderOptions=None)
 Render audio of current scene to media file, currently WAV file only.
bool ExecuteScript (str pFilename)
 Execute a python script file.
 SwitchViewerCamera (FBCamera pCamera)
 Switch the current viewer's camera.
FBApplication TheOne ()
 Get the global object for this class.

Public Attributes

FBPropertyEvent OnFileNewCompleted
 Event: A File New has been completed.
FBPropertyEvent OnFileNew
 Event: A File New has been requested, nothing has been destroyed yet.
FBPropertyEvent OnFileOpenCompleted
 Event: A File Open has been completed.
FBPropertyEvent OnFileOpen
 Event: A File Open has been requested, nothing has been loaded yet.
FBPropertyEvent OnFileMerge
 Event: A File Merge has been requested, nothing has been loaded yet.
FBPropertyEvent OnFileSaveCompleted
 Event: A File Save has been completed.
FBPropertyEvent OnFileSave
 Event: A File Save has been requested, nothing has been saved yet.
FBPropertyEvent OnFileExit
 Event: A File Exit as been requested, nothing has been destroyed yet.
FBPropertyString FBXFileName
 Read Write Property: Current scene filename.
FBPropertyActor CurrentActor
 Read Write Property: Indicate the current actor, as used by the character tool.
FBPropertyCharacter CurrentCharacter
 Read Write Property: Indicate the current character, as used by the character tool.

Member Function Documentation

bool Minimize ( bool  pBlocking = True)

Minimize window.

Parameters:
pBlockingIs the minimization blocking operation (default = true).
Returns:
Operation was successful (true or false).
bool Maximize ( )

Maximize window (minimized).

Returns:
Operation was successful (true or false).
UpdateAllWidgets ( )

Request to refresh display of all UI widgets.

FlushEventQueue ( )

Flush event queue.

Processes all pending events for the calling thread until there are no more events to process. You can call this function occasionally when your code is busy performing a long operation (e.g. copying a file).

bool FileNew ( bool  pAskUser = False,
bool  pClearSceneName = True 
)

Command FILE->NEW in the menus.

Parameters:
pAskUserSet to true to cause a save dialog to popup. Default is false.
pClearSceneNameSet to true to clear the scene name, set to false to retain it. Default is true.
Returns:
true if successful.
bool FileOpen ( str  pFilename,
bool  pShowUIMsg = False,
FBFbxOptions  pOptions = None 
)

Open a file, replacing the current scene.

Command File->Open in the menus.

Parameters:
pFilenameFile to open.
pShowUIMsgSet false if don't want to popup any UI dialog or messages (default=false).
pOptionsProvide finer control on file open options (default=NULL). if not null, Option dialog will only show if both option's ShowOptionsDialog property and pShowUIMsg are true.
Returns:
true if file open successfully.
bool FileOpen ( pBuffer  ,
long  pBufferLength 
)

Open a file from memory.

Warning:
this is advanced & not supported function, use with caution.
Parameters:
pBufferthe memory buffer for the file. Raw memory address is expected in pyfbsdk.
pBufferLengththe memory buffer size.
Returns:
true if file opened successfully.
bool GetMaxFrameCount ( pBuffer  ,
long  pBufferLength,
long  pFrameCount,
int  pTimeScale 
)

Get max frame count from a scene file in memory.

Warning:
this is advanced & not supported function, use with caution.
Parameters:
pBufferthe memory buffer for the file. Raw memory address is expected in pyfbsdk.
pBufferLengththe memory buffer size.
pFrameCountout parameter to hold max frame count. this parameter is not needed in pyfbsdk.
pTimeScaleTime scale.
Returns:
true if file opened successfully. In pyfbsdk, a tuple (bool, kLong) will return instead, the first one is ORSDK function return value, the second is for max frame count.
bool FileMerge ( str  pFilename,
bool  pShowUIMsg = False,
FBFbxOptions  pOptions = None 
)

Merge a file with the current scene.

Command File->Merge in the menus.

Parameters:
pFilenameFile to merge.
pShowUIMsgSet false if don't want to popup any UI dialog or messages (default=false).
pOptionsProvide finer control on file open options (default=NULL). if not null, Option dialog will only show if both option's ShowOptionsDialog property and pShowUIMsg are true.
Returns:
true if successful.
bool FileMerge ( FBStringList  pPathlist,
bool  pShowUIMsg = False,
FBFbxOptions  pOptions = None 
)

Merge multiple files with the current scene.

Command File->Merge in the menus.

Parameters:
pPathlistFiles to merge.
pShowUIMsgSet false if don't want to popup any UI dialog or messages (default=false).
pOptionsProvide finer control on file open options (default=NULL). if not null, Option dialog will only show if both option's ShowOptionsDialog property and pShowUIMsg are true.
Returns:
true if successful.
bool FileAppend ( str  pFilename,
bool  pShowUIMsg = False,
FBFbxOptions  pOptions = None 
)

Append a file to the current scene.

Same as File->Merge in the menus with all options set to append. In earlier versions of MotionBuilder, a namespace could be specified with a parameter in this function, or FBFbxOptions.CustomImportNamespace, Now this is now done with FBFbxOptions.NamespaceList.

Parameters:
pFilenameFile to merge.
pShowUIMsgSet false if don't want to popup any UI dialog or messages (default=false).
pOptionsProvide finer control on file open options (default=NULL). if not null, Option dialog will only show if both option's ShowOptionsDialog property and pShowUIMsg are true.
Returns:
true if successful.
bool FileSave ( str  pFilename = None,
FBFbxOptions  pOptions = None 
)

Save the file under another name.

Command File->SaveAs in the menus.

Parameters:
pFilenameSave file as pFilename. A value of NULL will use the current file name.
pOptionsProvide finer control on file save options (default=NULL)
Returns:
true if successful.
FileExit ( bool  pSave = False)

Quit application.

Command File->Exit in the menus.

Parameters:
pSavetrue if file is saved on exit(default=false).
bool FileImport ( str  pFilename,
bool  pMatchModels = False,
bool  pCreateUnmatchedModels = True 
)

Import a motion file.

Command File->Motion File Import... in the menus.

Parameters:
pFilenameThe file to import. To import two files at the same time (ex: .amc & .asf), separate the two files path with a comma ("Path1,Path2").
pMatchModelsIf there is already a model in the scene with the same name, the model will not be created and we replace the animation of the given model.
pCreateUnmatchedModelsWhether unmatched models will be created. This flag matters only when pMatchModels is true. when pMatchModels is false, all the models are created.
Returns:
True if the import succeeded.
Remarks:
No models selected, all the models in the scene will be checked for a potential name match.
If there are models selected in the scene, only these models will be checked for a potential name match.
If only one model is selected (ex: hips), this models and its hierarchy will be used.
The data will be imported in the current take.
The last two parameter are only used for motion files.
For now, you cannot import custom file types.
Currently, only the default import options are used.
Warning:
The signature of this function might change in the future to support import options.
bool FileExport ( str  pFilename)

Export a motion file.

Command File->Motion File Export... in the menus.

Parameters:
pFilenameThe file to create. To create two files at the same time (ex: .amc & .asf), separate the two files path with a comma ("Path1,Path2").
Returns:
True if the export succeeded.
Remarks:
If the file exists, it will be overwritten.
current take is use.
The last parameter is only used for motion files.
For now, you cannot export custom file types.
Currently, only the default export options are used.
Warning:
The signature of this function might change in the future to support export options.
FBBatchStatus FileBatch ( FBBatchOptions  pBatchOptions,
FBPlotOptions  pPlotOptions = None 
)

Start a batch.

Command File->Batch... in the menus.

Parameters:
pBatchOptionsThe options for the batch process (same as in the batch UI).
pPlotOptionsThe options for plotting (same as in the plot UI)(default=NULL).
Returns:
The status of the operation.
bool FileImportBatch ( str  pName,
FBBatchOptions  pBatchOptions,
FBModel  pReference 
)

Import a motion file using batch options.

Import used for loading files in batch process.

Parameters:
pNameThe name of the file without extension. Extension and path will be taken from batch options.
pBatchOptionsThe options for the import.
pReferenceReference model for the import.
Returns:
True if the import succeeded.
Remarks:
Not all options have to be set, only those that belong to process.
bool FileExportBatch ( str  pName,
FBTake  pTake,
FBBatchOptions  pBatchOptions,
tuple  pExportModels 
)

Export a motion file using batch options.

Export used for saving files in batch process.

Parameters:
pNameThe name of the file without extension. Extension and path will be taken from batch options.
pTakeAnimation take to the export.
pBatchOptionsThe options for the export.
pExportModelsModels to the export.
Returns:
True if the export succeeded.
Remarks:
Not all options have to be set, only those that belong to process.
bool SaveCharacterRigAndAnimation ( str  pFileName,
FBCharacter  pCharacter,
FBFbxOptions  pFbxOptions 
)

Save the rig and its animation in a file.

Parameters:
pFileNameFile name.
pCharacterCharacter to save.
pFbxOptionsThe options for the character rig and animation export
Warning:
After save, the current scene selection will be reset.
bool LoadAnimationOnCharacter ( str  pFileName,
FBCharacter  pCharacter,
FBFbxOptions  pFbxOptions,
FBPlotOptions  pPlotOptions 
)

Load a rig and its animation from a file.

Parameters:
pFileNameFile name.
pCharacterTarget character.
pFbxOptionsThe options for the character rig and animation load
pPlotOptionsIf the animation should be plotted on the target rig, these plot options will be used. Set to NULL if animation will not be plotted.
Returns:
true if successful.
bool IsValidBatchFile ( str  pFilename)

Verify motion file readability.

Parameters:
pFilenameThe file to test.
Returns:
True if file was opened successfully (file is closed at the end).
bool OneClickSendAsNewScene ( FBOneClickApplication  pApplication)

Send the current scene as a new scene in the specified application.

Parameters:
pApplicationThe application that will receive the scene.
Returns:
True if transfer successful.
bool OneClickUpdateCurrentScene ( )

Send the scene to update the current scene in the specified application.

Returns:
True if transfer successful.
bool OneClickAddToCurrentScene ( )

Send the scene and add it to the current scene in the specified application.

Returns:
True if transfer successful.
OneClickSelectPreviouslySentObject ( )

Select, in MotionBuilder, the object that were sent.

FBOneClickApplication OneClickIsConnectedTo ( )

Return the other application that MotionBuilder is connected to.

Returns:
The application that MotionBuilder is connected to.
bool FileRender ( FBVideoGrabOptions  pRenderOptions = None)

Render current scene to media file.

Command FILE->RENDER in the menus.

Parameters:
pRenderOptionsThe options used when rendering the scene. If you don't specify them, current one are used.
Returns:
True if the file was rendered successfully otherwise False and FBVideoGrabber.GetLastErrorMsg() contains the description of the error.
Remarks:
Render options can be changed if they are not valid.
Warning:
If the destination media file exist, it will be overwritten by default.
bool AudioRender ( FBAudioRenderOptions  pAudioRenderOptions = None)

Render audio of current scene to media file, currently WAV file only.

Parameters:
pAudioRenderOptionsThe options used when rendering audio of the scene. Default value: 2 channels, 16 bits, 44100 hz, the begin and end time span for current time referential, Default file name is "Output.wav" in the last audio output path, ro the default document path if the last path doesn't exist.
Returns:
True if the file was rendered successfully
Warning:
If the destination media file exist, it will be overwritten by default. If the destination media file is opened by other application, the audio render process may not success because of not able to open it.
bool ExecuteScript ( str  pFilename)

Execute a python script file.

Parameters:
pFilenameThe script file to execute.
Returns:
True if the script file was found and executed.
Remarks:
This function can only be used in the UI thread.
SwitchViewerCamera ( FBCamera  pCamera)

Switch the current viewer's camera.

Parameters:
pCameraCamera to switch current viewer to.
FBApplication TheOne ( )

Get the global object for this class.

Returns:
the global object.

Member Data Documentation

FBPropertyEvent OnFileNewCompleted

Event: A File New has been completed.

FBPropertyEvent OnFileNew

Event: A File New has been requested, nothing has been destroyed yet.

FBPropertyEvent OnFileOpenCompleted

Event: A File Open has been completed.

FBPropertyEvent OnFileOpen

Event: A File Open has been requested, nothing has been loaded yet.

FBPropertyEvent OnFileMerge

Event: A File Merge has been requested, nothing has been loaded yet.

FBPropertyEvent OnFileSaveCompleted

Event: A File Save has been completed.

FBPropertyEvent OnFileSave

Event: A File Save has been requested, nothing has been saved yet.

FBPropertyEvent OnFileExit

Event: A File Exit as been requested, nothing has been destroyed yet.

Read Write Property: Current scene filename.

FBPropertyActor CurrentActor

Read Write Property: Indicate the current actor, as used by the character tool.

Can be NULL. If not null, CurrentCharacter must be null, as the character tool works on only one item at a time.

FBPropertyCharacter CurrentCharacter

Read Write Property: Indicate the current character, as used by the character tool.

Can be NULL. If not null, CurrentActor must be null, as the character tool works on only one item at a time.


FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication
FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication FBApplication