Plotting Character Animation With A MotionBuilder Python Script .
Posted On February 9, 2017
Let’s go over how to use Python to plot animation onto a character’s Control Rig. The interesting part of this is the “plot options” and how we call back on them when we plot.
from pyfbsdk import * # Defining our Characater as the currnetly selected one lCharacter = FBApplication().CurrentCharacter # Defining the Plot option that will be used PlotCtrlRigTakeOptions = FBPlotOptions() # To use Constant Key Reduction on the plot (True or False) PlotCtrlRigTakeOptions.ConstantKeyReducerKeepOneKey = False # To go through all takes in the scene and plot the data (True or False) PlotCtrlRigTakeOptions.PlotAllTakes = False # Do you wish to plot onto frames (True or False) PlotCtrlRigTakeOptions.PlotOnFrame = True # Set the plot period PlotCtrlRigTakeOptions.PlotPeriod = FBTime( 0, 0, 0, 1 ) PlotCtrlRigTakeOptions.PlotTranslationOnRootOnly = False PlotCtrlRigTakeOptions.PreciseTimeDiscontinuities = False # What filter to use on the plot (Unroll, GimabalKill or None) PlotCtrlRigTakeOptions.RotationFilterToApply = FBRotationFilter.kFBRotationFilterUnroll # Use Constant Kye Reduction (True or False) PlotCtrlRigTakeOptions.UseConstantKeyReducer = False # Plotting to the selected character - note "kFBCharacterPlotOnControlRig" and "PlotCtrlRigTakeOptions". lCharacter.PlotAnimation (FBCharacterPlotWhere.kFBCharacterPlotOnControlRig,PlotCtrlRigTakeOptions )
These are the settings I use when I am processing large motion capture data down to smaller performances.
2 Comments
ok, but what I need to do, to plot only selected takes ?
Any idea ?
that can be done using an ‘if’ statement:
for take in FBSystem().Scene.Takes:
if take.Selected == True:
print take.Name