Python Callback Functions



Contents
  1. analysistextpreprocessor
  2. animationselectionchanged
  3. newanimationdataavailable
  4. postanalysis
  5. posteventtakecreation
  6. postxmlexport
  7. preloadaudio
  8. preloadtext
  9. visibletimerangechanged

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 retrieved with the "getCallback" function. Alternatively, you can unregister a Python callback by calling "FxStudio.unregisterCallback" with the name of the callback as the argument.



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 name
Notifies you when the animation selection has changed.


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

 

newanimationdataavailable

Arguments
Description
-
Notifies you when the animation data diplayed in studio has changed.  (changing the time value, moving a node slider, etc)


def myNewAnimationDataAvailableCallback():
  print "Animation Data Changed"
FxStudio.registerCallback("newanimationdataavailable", myNewAnimationDataAvailableCallback)

 

 

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)

 

 

posteventtakecreation

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


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


postxmlexport

Arguments
Description
xmlPath
Notifies you when the actor has been exported to an .xml file.

def myPostXmlExportCallback(xmlPath):
  print "Exported to " + xmlPath
FxStudio.registerCallback("postxmlexport", myPostXmlExportCallback)

 

preloadaudio

Arguments
Description
relativePath, absolutePath
Allows 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)

 

preloadtext

Arguments
Description
initial audio path, analysis language
Called prior to executing the analyze command.  Allows you to override the text file to load.  Inputs are the default text file path (in the same folder as the audio file with the same filename and the .txt file extension) and the language for analysis.  Must return a string (the path to the text file to use).

Note: Only Available in versions of FaceFX Studio with the Analyze command.

def myPreloadTextCallback(textPathInitial, analysisLanguage):
  # Change to search for text in "E:" drive
  return textPathInitial.replace("C:", "E:")
FxStudio.registerCallback("preloadtext", myPreloadTextCallback)

 

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)

 

 

 

Version Number: 
2010