Basic interface to Alias keyframes on parameter.
#include <AlKeyframe.h> class AlKeyframe : public AlObject AlKeyframe(); virtual ~AlKeyframe(); virtual statusCode deleteObject(); virtual AlObject* copyWrapper() const; virtual AlObjectType type() const; boolean isLocked() const; statusCode setLock(boolean); AlKeyframe* prev() const; AlKeyframe* next() const; statusCode prevD(); statusCode nextD(); double value() const; double location() const; double inTangent() const; double outTangent() const; statusCode tangentTypes( AlTangentType&, AlTangentType& ) const; statusCode setValue(double, boolean = TRUE ); statusCode setLocation(double, boolean = TRUE ); statusCode setInTangent(double); statusCode setOutTangent(double); statusCode setTangentTypes(AlTangentType, AlTangentType, boolean = TRUE );
AlKeyframe represents a keyframe belonging to an AlParamAction. The keyframe class does not have a create method. New keyframes are created using the AlParamAction::addKeyframe() methods (this is faster than creating the keyframes, then adding them to the paramaction).
A keyframe cannot belong to more than one action. Thus attempting to add a keyframe that has already been added to an AlParamAction will fail.
If an AlKeyframe is deleted and if the AlKeyframe belongs to an AlParamAction and it is the last keyframe of that parameter curve action, then the AlParamAction will also be deleted. This ensures that no AlParamAction parameter curves will exist with no keyframes.
If a keyframe is added to an AlParamAction, and another keyframe already exists in that AlParamAction with the same location as the keyframe to be added, then the existing keyframe in the AlParamAction will be deleted.
The method that applies tangent types to a keyframe (that is, setTangentTypes()) does not make much sense if the keyframe is not part of an AlParamAction. It is best to add all the desired keyframes to an AlParamAction, and then walk the list of keyframes, and call the tangent methods.
You can lock a keyframe by calling the method AlKeyframe::setLock(TRUE). If an AlKeyframe is locked, then none of the AlKeyframe methods that change its location, value, or tangents will succeed. The keyframe is non-modifiable. You can unlock the keyframe again by calling AlKeyframe::setLock(FALSE).
statusCode AlKeyframe::setLocation(double newTime, boolean recompute)
Sets the time of the keyframe to be the value given by newTime. If this keyframe is part of a parameter curve action, the list of keyframes may be reordered to reflect the new position of the keyframe. If the given newTime has the same value as the time of an existing keyframe, then this keyframe will not be moved.
statusCode AlKeyframe::setValue(double newVal, boolean recompute)
statusCode AlKeyframe::setInTangent(double inTangent)
Sets the in-tangent of the keyframe to the given value. The tangent value must be in the range -90.0 < inTangent < 90.0.
If the given tangent value is outside this range, it is clamped to within this range.
This method requires the AlKeyframe to have been attached to an AlParamAction; otherwise, an assertion will fail.
double AlKeyframe::outTangent() const
Returns the value of the out-tangent of the keyframe. The value will be between 90.0 and -90.0, where 0.0 represents a flat (horizontal) tangent pointing to the right, 90.0 means the tangent points straight up, and -90.0 means the tangent points straight down. This method returns 0.0 if the keyframe is invalid.
statusCode AlKeyframe::setOutTangent(double outTangent)
Sets the out-tangent of the keyframe to the given value. The tangent value must be in the range -90.0 < outTangent < 90.0.
If the given tangent value is outside this range, it is clamped to within this range.
This method requires the AlKeyframe to have been attached to an AlParamAction; otherwise, an assertion will fail.
statusCode AlKeyframe::prevD()
If this keyframe belongs to a parameter curve action (AlParamAction), and it is not the first keyframe in that action, this function will set the information for this AlKeyframe to refer to the previous keyframe in the action, and return sSuccess. Otherwise, the information in this object is unchanged and sFailure is returned.
statusCode AlKeyframe::nextD()
If this keyframe belongs to a parameter curve action (AlParamAction), and it is not the last keyframe in that action, this function will set the information for this AlKeyframe to refer to the next keyframe in the action, and return sSuccess. Otherwise, the information in this object is unchanged and sFailure is returned.
statusCode AlKeyframe::setTangentTypes(AlTangentType inTangentType, AlTangentType outTangentType, boolean recompute )
Sets the in and out tangents of this keyframe to a specific type. Use kTangentUnchanged if you want either to remain unchanged.
This method requires the AlKeyframe to have been attached to an AlParamAction, otherwise an assertion will fail.
Note that this function sets the tangents on a segment. So depending on your choice of tangents, the tangents of the keyframe’s neighbors may be changed.
statusCode AlKeyframe::tangentTypes(AlTangentType& inTangentType, AlTangentType& outTangentType) const