Python Callback Functions



Python callbacks allow FaceFX Studio to trigger a Python function automatically when certain actions occur.  The Python function is registered with FaceFX Studio by calling "FxStudio.registerCallback".  registerCallback takes two arguments: the name of the callback, and the python function to be called.  An existing callback's Python function can be retreived with the "getCallback" function. Alternatively, you can unregister a Python callback by calling "FxStudio.unregisterCallback" with the name of the callback as the argument.


postanalysis

Arguments
Description
group name, animation name
Notifies the user when an animation has been created by analyzing audio

def myPostAnalysisCallback(groupName, animName):
print animName + " in group " + groupName + "was just analyzed"
FxStudio.registerCallback("postanalysis", myPostAnalysisCallback)


analysistextpreprocessor

Arguments
Description
analysis text, language
Allows you to change the analysis text prior to analysis.  You can scan the existing text, then add text tags for events or curves, or change the analysis text before analysis. Must return a Python Unicode string (the analysis text to use).


def myAnalysisTextPreProcessorCallback(analysisText, language):
  return "{group1|angryEvent}" + analysisText
FxStudio.registerCallback("analysistextpreprocessor", myAnalysisTextPreProcessorCallback)

 

animationselectionchanged

Arguments
Description
group name, animation nameNotifies you when the animation selection has changed.


def myAnimationSelectionChangedCallback(groupName, animName):
  print "User selected (" + groupName + ", " + animName + ")"
FxStudio.registerCallback("animationselectionchanged", myAnimationSelectionChangedCallback)

 

visibletimerangechanged

Arguments
Description
minTime, maxTime
Notifies you when the animation time range has changed.


def myTimeRangeChangedCallback(minTime, maxTime):
print "New TimeRange: " + str(minTime) + ":" + str(maxTime)
FxStudio.registerCallback("visibletimerangechanged", myTimeRangeChangedCallback)

 

preloadaudio

Arguments
Description
relativePath, absolutePathAllows you to intercept audio loading and alter audio sources. Must return a Python string (path to audio; can be a relative or absolute path).

def myPreloadAudioCallback(relativePath, absolutePath):
return relativePath
FxStudio.registerCallback("preloadaudio", myPreloadAudioCallback)

 

posteventtakecreation

Arguments
Description
group name, animation nameNotifies you when a new animation take.


def myPostEventTakeCreationCallback(groupName, animName):
  print "New Event take on (" + groupName + ", " + animName + ")"
FxStudio.registerCallback("posteventtakecreation", myPostEventTakeCreationCallback)



Version Number: 
2009