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.

From MotionBuilder 2011 the following functions are deprecated:

  1. FBXFileOpen: use FBApplication.FileOpen() instead.

  2. FBXFileMerge: use FBApplication.FileMerge() instead.

  3. FBXFileAppend: use FBApplication.FileAppend() instead.

  4. FBXFileSave: use FBApplication.FileSave() instead.

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

List of all members.

Public Member Functions

  __init__ (object pObject=None)
  Constructor.
bool  Minimize (bool pBlocking=True)
  Minimize window.
bool  Maximize ()
  Maximize window (minimized).
bool  FileNew ()
  Command FILE->NEW in the menus.
bool  FileOpen (str pFilename, bool pShowOptions=False, FBFbxOptions pOptions=None)
  Open a file, replacing the current scene.
bool  FileOpen (pBuffer, long pBufferLength)
bool  GetMaxFrameCount (pMemAddr, long pSize, long pFrameCount, int pTimeScale)
bool  FileMerge (str pFilename, bool pShowOptions=False, FBFbxOptions pOptions=None)
  Merge a file with the current scene.
bool  FileAppend (str pFilename, bool pShowOptions=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)
  Import a motion file.
bool  FileExport (str pFilename)
  Export a motion file.
FBBatchStatus  FileBatch (HFBBatchOptions pBatchOptions, HFBPlotOptions pPlotOptions=None)
  Start a batch.
bool  FileImportBatch (str pName, HFBBatchOptions pBatchOptions, FBModel pReference)
  Import a motion file using batch options.
bool  FileExportBatch (str pName, HFBTake pTake, HFBBatchOptions pBatchOptions, tuple pExportModels)
  Export a motion file using batch options.
bool  SaveCharacterRigAndAnimation (str pFileName, HFBCharacter pCharacter, HFBFbxOptions pFbxOptions)
  Save the rig and its animation in a file.
bool  LoadAnimationOnCharacter (str pFileName, HFBCharacter pCharacter, HFBFbxOptions pFbxOptions, HFBPlotOptions pPlotOptions)
  Load a rig and its animation from a file.
bool  IsValidBatchFile (str pFilename)
  Verify motion file readability.
  FileRender (FBVideoGrabOptions pRenderOptions=None)
  Render current scene to media file.
bool  ExecuteScript (str pFilename)
  Execute a python script file.
  SwitchViewerCamera (FBCamera pCamera)
  Switch the current viewer's camera.
bool  FBXFileOpen (str pFilename, FBFbxOptions pOptions=None)
bool  FBXFileMerge (str pFilename, FBFbxOptions pOptions=None)
bool  FBXFileAppend (str pFilename, FBFbxOptions pOptions=None)
bool  FBXFileSave (str pFilename=None, FBFbxOptions pOptions=None)
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.
FBPropertyListManipulator  Manipulators
  List: of manipulators.

Member Function Documentation

bool Minimize ( bool  pBlocking = True )

Minimize window.

Parameters:
pBlocking Is 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).
bool FileNew ( )

Command FILE->NEW in the menus.

Returns:
true if successful.
bool FileOpen ( str  pFilename,
bool  pShowOptions = False,
FBFbxOptions  pOptions = None 
)

Open a file, replacing the current scene.

Command File->Open in the menus.

Parameters:
pFilename File to open.
pShowOptions true if options dialog is showed (default=false).
pImportingNamespace namespace added to all objects in the loaded scene (default=NULL)
Returns:
true if successful.
bool FileOpen ( pBuffer  ,
long  pBufferLength 
)
bool GetMaxFrameCount ( pMemAddr  ,
long  pSize,
long  pFrameCount,
int  pTimeScale 
)
bool FileMerge ( str  pFilename,
bool  pShowOptions = False,
FBFbxOptions  pOptions = None 
)

Merge a file with the current scene.

Command File->Merge in the menus.

Parameters:
pFilename File to merge.
pShowOptions true if options dialog is showed (default=false).
pImportingNamespace namespace added to all objects in the loaded scene (default=NULL)
Returns:
true if successful.
bool FileAppend ( str  pFilename,
bool  pShowOptions = 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. This is now done with FBFbxOptions.CustomImportNamespace.

Parameters:
pFilename File to merge.
pShowOptions true if options dialog is showed (default=false).
pImportingNamespace namespace added to all objects in the loaded scene (default=NULL)
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:
pFilename Save file as pFilename. A value of NULL will use the current file name.
Returns:
true if successful.
FileExit ( bool  pSave = False )

Quit application.

Command FILE->EXIT in the menus.

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

Import a motion file.

Command FILE->IMPORT in the menus.

Parameters:
pFilename The file to import. To import two files at the same time (ex: .amc & .asf), separate the two files path with a comma ("Path1,Path2").
pMatchModels If 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. 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. Every unmatched models will be created.
Returns:
True if the import succeeded.
Remarks:
The data will be imported in the current take.
The last 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->EXPORT in the menus.

Parameters:
pFilename The 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 ( HFBBatchOptions  pBatchOptions,
HFBPlotOptions  pPlotOptions = None 
)

Start a batch.

Command FILE->BATCH in the menus.

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

Import a motion file using batch options.

Import used for loading files in batch process.

Parameters:
pName The name of the file without extension. Extension and path will be taken from batch options.
pBatchOptions The options for the import.
pReference Reference 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,
HFBTake  pTake,
HFBBatchOptions  pBatchOptions,
tuple  pExportModels 
)

Export a motion file using batch options.

Export used for saving files in batch process.

Parameters:
pName The name of the file without extension. Extension and path will be taken from batch options.
pTake Animation take to the export.
pBatchOptions The options for the export.
pExportModels Models 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,
HFBCharacter  pCharacter,
HFBFbxOptions  pFbxOptions 
)

Save the rig and its animation in a file.

Parameters:
pFileName File name.
pCharacter Character to save.
pFbxOptions The options for the character rig and animation export
Warning:
After save, the current scene selection will be reset.
bool LoadAnimationOnCharacter ( str  pFileName,
HFBCharacter  pCharacter,
HFBFbxOptions  pFbxOptions,
HFBPlotOptions  pPlotOptions 
)

Load a rig and its animation from a file.

Parameters:
pFileName File name.
pCharacter Target character.
pFbxOptions The options for the character rig and animation load
pPlotOptions If 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:
pFilename The file to test.
Returns:
True if file was opened successfully (file is closed at the end).
FileRender ( FBVideoGrabOptions  pRenderOptions = None )

Render current scene to media file.

Command FILE->RENDER in the menus.

Parameters:
pRenderOptions The options used when rendering the scene. If you don't specify them, current one are used.
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 ExecuteScript ( str  pFilename )

Execute a python script file.

Parameters:
pFilename The 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:
pCamera Camera to switch current viewer to.
bool FBXFileOpen ( str  pFilename,
FBFbxOptions  pOptions = None 
)
Deprecated:
Use FBApplication.FileOpen() instead.

Opens a file, replacing the current scene.

Parameters:
pFilename File to open.
pImportingNamespace Namespace added to all objects in the loaded scene (default=NULL).
Returns:
True if successful.
bool FBXFileMerge ( str  pFilename,
FBFbxOptions  pOptions = None 
)
Deprecated:
Use FBApplication.FileMerge() instead.

Merges a file with the current scene.

Parameters:
pFilename File to merge.
pImportingNamespace Namespace added to all objects in the loaded scene (default=NULL).
Returns:
True if successful.
bool FBXFileAppend ( str  pFilename,
FBFbxOptions  pOptions = None 
)
Deprecated:
Use FBApplication.FileAppend() instead.

Appends a file to the current scene.

Parameters:
pFilename File to merge.
pImportingNamespace Namespace added to all objects in the loaded scene (default=NULL).
Returns:
True if successful.
bool FBXFileSave ( str  pFilename = None,
FBFbxOptions  pOptions = None 
)
Deprecated:
Use FBApplication.FileSave() instead.

Saves the file under another name.

Parameters:
pFilename Saves file as pFilename. A value of NULL uses the current file name.
Returns:
True if successful.
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.

FBPropertyListManipulator Manipulators

List: of manipulators.


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