Python



FaceFX Studio supports Python for a scripting language.  Python code can be executed from the Python shell in the Console Tab, or it can be saved out in ".py" files and executed with the exec FaceFX command.

Python Shell

You can execute FaceFX commands from the python shell by prepending the commands with the % character like so:

>>> %loadActor -file ".\Samples\Slade-Maya.facefx";

You can also use the shell as a test area for writing scripts. You can set variables, and even write multi-line scripts.

Writing Python .py Files

To gain easy access to FaceFX Python Functions, import the FaceFX module.  Functions which would otherwise need to be expressed as FxStudio.functionName can simply be referenced as functionName.

from FxStudio import *

You can execute FaceFX commands from a python script using the issueCommand function like so:

FxStudio.issueCommand('loadActor -file ".\Samples\Slade-Maya.fxa";')
FxStudio.issueCommand('loadActor -file "%s";'%(pythonVariable))
FxStudio.issueCommand('loadActor -file ' + pythonVariable)

 

Executing Python .py Files

Use the exec command to execute python scripts.  This command can be inserted into any FXL file, including those executed automatically by FaceFX Studio such as autoexec.fxl.

See Also

Python Callbacks
Python Functions


Version Number: 
2010