Filters are objects which can be applied on a FCurve, or the animation node associated with an animated object property, to modify shape and number of keys. Filters can be created from the GUI, using the Filters tool, or programmatically with an instance of a FBFilterManager.The filter properties can be found in the object's PropertyList data member. They will use the same name, and be of the same type, as what can be seen in the GUI.Instances of FBFilter should be created with the help of the class FBFilterManager. Only internal application code should call the FBFilter's class constructor.Sample C++ code:
FBFilterManager lFilterManager; // Create a filter instace. HFBFilter lFilter = lFilterManager.CreateFilter( "Key Reducing" ); if( lFilter ) { // Create a FCurve and populate it with keys. FBFCurve lCurve( "Temp Curve" ); for( int lIdx = 1; lIdx < 10; ++lIdx ) { FBTime lTime( 0, 0, 0, lIdx * 5 ); lCurve.KeyAdd( lTime, lIdx * 5 ); } FBTrace( "Keys before: %d\n", lCurve.Keys.GetCount() ); // Should be 9. // Apply the key reducing filter. lFilter->Apply( &lCurve ); FBTrace( "Keys after: %d\n", lCurve.Keys.GetCount() ); // Should be 2. }
Sample Python code:
from pyfbsdk import * # Find a given model in the scene. lModel = FBFindModelByName( 'Cube' ) if lModel: # Create a Key Reducing filter. lFilter = FBFilterManager().CreateFilter( 'Key Reducing' ) if lFilter: # Set the filter's precision to 2.0, and apply it to # the object's translation animation. lFilter.PropertyList.Find( 'Precision' ).Data = 2.0 lFilter.Apply( lModel.Translation.GetAnimationNode(), True )
Public Member Functions |
|
FBFilter () | |
Constructor. |
|
bool | Apply (FBFCurve pCurve) |
Apply the filter to an FCurve. |
|
bool | Apply (FBAnimationNode pNode, bool pRecursive) |
Apply the filter to an animation node.
|
|
Reset () | |
Reset properties. |
|
Public Attributes |
|
FBTime | Start |
Read Write Property: Start time of
the filtering region |
|
FBTime | Stop |
Read Write Property: Stop time of the
filtering region |
FBFilter | ( | ) |
Constructor.
Apply the filter to an FCurve.
This is one of the two apply method that is meant to be called by client code. The FCurve can be a standalone independant FCurve, or can be associated to an object's animated property.
pCurve | FCurve to apply filter to. |
bool Apply | ( | FBAnimationNode | pNode, | |
bool | pRecursive | |||
) |
Apply the filter to an animation node.
This is the other apply method and it can be used on an object's animation node.
pNode | Node to apply filter to. | |
pRecursive | Recursively apply filter on child nodes? |
Reset | ( | ) |
Reset properties.