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)
Note: All 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
.