Basic interface to derived class of actions for parameter curve actions.
#include <AlParamAction.h> class AlParamAction : public AlAction AlParamAction(); virtual ~AlParamAction(); virtual AlObject* copyWrapper() const; virtual AlObjectType type() const; AlKeyframe* firstKeyframe() const; AlKeyframe* lastKeyframe() const; statusCode addKeyframe( double, double, AlKeyframe *&, boolean = TRUE, AlTangentType = kTangentFlat, AlTangentType = kTangentFlat ); statusCode addKeyframe( double, double, AlKeyframe &, boolean = TRUE, AlTangentType = kTangentFlat, AlTangentType = kTangentFlat ); statusCode addKeyframe( double, double, boolean = TRUE, AlTangentType = kTangentFlat, AlTangentType = kTangentFlat ); int numberOfKeyframes() const; statusCode applyIteratorToKeyframes( AlIterator*, int& ); statusCode addKeyframeRange( int, double*, double*, boolean = TRUE, AlTangentType* = NULL, AlTangentType* = NULL ); statusCode deleteKeyframeRange( double, double );
An AlParamAction is derived from an AlAction. This particular action has a list of AlKeyframes which are CVs on a Poon-Ross spline. This spline is basically a Hermite-linear spline. That is, it is a Hermite in y (the vertical axis) and a linear in x (the horizontal axis).
In order to create an AlParamAction, you must have at least one valid, created AlKeyframe that will be the first keyframe of the action. After the AlParamAction is created, you can add other keyframes to the AlParamAction. Note that two AlKeyframes cannot have the same location. If you add a keyframe to the action that has the same location as an existing keyframe of the action, the existing keyframe will be deleted. Since an AlKeyframe is created at (0, 0), you cannot create a bunch of AlKeyframes, add them to the AlParamAction, and then modify their locations later, because the AlParamAction will only have one keyframe (the others will have been deleted as each successive keyframe with the same location is added to the AlParamAction). You must set the location of the AlKeyframe before adding it to the AlParamAction.
If you copy an AlParamAction, all the keyframes (and the keyframes’ streams) will also be copied. If you delete an AlParamAction, all its Keyframes will be deleted.
statusCode AlParamAction::addKeyframe( double location, double value, AlKeyframe &kf, boolean recompute, AlTangentType intan, AlTangentType outtan )
Similar to addKeyframe, but returns the newly created AlKeyframe in ’kf’. This avoids the creation and deletion of wrappers when creating many keys.
AlKeyframe key; for( int i =0; i < 100; i++ ) { param->addKeyframe( i, 1, key, ....) }
statusCode AlParamAction::addKeyframe( double location, double value, AlKeyframe *& kf, boolean recompute, AlTangentType intan, AlTangentType outtan )
Similar to addKeyframe, but allocates a wrapper and returns the newly created AlKeyframe. It is up to you to delete these wrappers. Use this overloaded form if you wish to have the wrapper created for you.
Below is an example code fragment
Alkeyframe *key1, *key2, *key3; param->addKeyframe( 0, 1, key1, .... param->addKeyframe( 1, 1, key2, .... param->addKeyframe( 2, 1, key3, .... ... delete key1; delete key2; delete key3;
statusCode AlParamAction::addKeyframe( double location, double value, boolean recompute, AlTangentType intan, AlTangentType outtan )
Adds a keyframe to the parameter curve’s list of keyframes. If the parameter curve already has another keyframe at the same location as this keyframe, then the existing keyframe at this location will be deleted and replaced with this keyframe. If this object does not yet reference an actual Parameter Curve, a new curve will be created.
statusCode AlParamAction::applyIteratorToKeyframes( AlIterator* iter, int &rc )
Applies the given AlIterator to all keyframes in the action. The second argument will be set to the return value of the last application of the iterator’s function. See the AlIterator class for more information.
statusCode AlParamAction::deleteKeyframeRange( double minValue, double maxValue )
Deletes all keyframes whose "time"s are greater or equal to the "minValue" given, and less than or equal to the "maxValue" given.
statusCode AlParamAction::addKeyframeRange( int size, double location[], double value[], boolean recompute, AlTangentType intan[], AlTangentType outtan[])
Adds a block of keyframes to the parameter curve's list keyframes. If the parameter curve already has a keyframe at the same location as one of the added keyframes, then the method will fail. If this object does not yet reference an actual Parameter Curve, a new curve will be created.If intan and outan are NULL, kTangentFlat is assumed.