File Events
 
 
 

File Events

FBApplication allows for various callback functions to be registered to file I/O events. The code sample below illustrates how to register a function to be called just before the scene is cleared from FBApplication.FileNew()'s execution.

from pyfbsdk import *

def MyCallback(pCaller, pEvent):
    ''' 
    pCaller: In this example, it will be the FBApplication object.
    pEvent:  An instance of the FBEvent triggered.
    '''
    print "MyCallback Triggered."


# Get the instance of FBApplication.
app = FBApplication()

# Register the callback function to the OnFileNew event.
app.OnFileNew.Add(MyCallback)

# Create a new scene. This triggers the OnFileNew event.
app.FileNew()

# Remove the callback function we have created when we are done.
app.OnFileNew.Remove(MyCallback)
NoteAll the callbacks of an event may be removed in one call, for example: app.OnFileNew.RemoveAll()

Event Descriptions

The following table describes the events which are triggered by FBApplication.

Event Description
FBApplication.OnFileNew Triggered when FBApplication.FileNew() is invoked, but before anything has been destroyed.
FBApplication.OnFileNewCompleted Triggered when FBApplication.FileNew() has completed.
FBApplication.OnFileOpen Triggered when FBApplication.FileOpen() is invoked, but nothing has been loaded yet.
FBApplication.OnFileMerge Triggered when either of the following functions have been invoked, but before anything is loaded:
FBApplication.OnFileOpenCompleted Triggered when either of the following functions have completed their execution:
FBApplication.OnFileSave Triggered when FBApplication.FileSave() has been invoked, but before anything is saved.
FBApplication.OnFileSaveCompleted Triggered when FBApplication.FileSave() has completed.
FBApplication.OnFileExit Triggered when FBApplication.FileExit() is invoked.