#include <MItKeyframe.h>
Keyframe Iterator.
Iterate over the keyframes of a particular Anim Curve Node, and query and edit the keyframe to which the iterator points.
Determine the time and value of the keyframe, as well as the x,y values and type of the tangent to the curve entering (in tangent) and leaving (out tangent) the keyframe.
Set the time and value of the keyframe, and the type of the tangents.
Anim Curves are implemented as Dependency Graph (DG) Nodes. Each Node has multiple ordered and indexed keyframes.
Use the Keyframe Iterator to systematically visit, and query and/or edit the keyframes of a Anim Curve Node.
Use the Keyframe Iterator in conjunction with the Anim Curve Function Set (MFnAnimCurve) to edit Anim Curve Nodes.
On creation the iterator is attached to a Anim Curve Node. The iterator may be detached from its current Node and attached to another Anim Curve Node using the reset() method.
Though keyframes within a Node are ordered and indexed, the iterator maintains the index of the current Node internally and does not export it. Use the Anim Curve Function Set to access the index for a keyframe. The index is zero-based. When an iterator is first attached to a Node, either on creation or reset, the index is set to zero. There is an overloaded version of the reset() method which does not cause the iterator to change Nodes, but merely resets the index.
Use the next(), reset() and isDone() methods to perform iterations.
Use the specific query methods to determine the time, value and tangent information for the keyframe under the iterator.
Use specific edit methods to set the time and value , as well as the incoming and outgoing tangent type (MItKeyframe::TangentType) of the keyframe under the iterator.
There is no method for setting the x,y value of either of the tangents.
Setting the time of a keyframe will fail if the new time would require a re-ordering of the keyframes. Use the Anim Curve Functiion Set methods MFnAnimCurve::remove() and MFnAnimCurve::addKeyFrame() to re-order the keyframes.
Public Types | |
enum | TangentType { kTangentGlobal = 0, kTangentFixed, kTangentLinear, kTangentFlat, kTangentSmooth, kTangentStep, kTangentSlow, kTangentFast, kTangentClamped, kTangentPlateau, kTangentStepNext, kTangentAuto } |
Tangent types. More... | |
typedef double | TangentValue |
Defines the value type of the tangent. | |
Public Member Functions | |
MItKeyframe (MObject &animCurveNode, MStatus *ReturnStatus=NULL) | |
Class Constructor. More... | |
~MItKeyframe () | |
Class Destructor. More... | |
MStatus | reset (MObject &animCurveNode) |
Detaches the iterator from the current Anim Curve Node and attaches it to the given Node. More... | |
MStatus | reset () |
Resets the keyframe index to 0 (first keyframe) on the Anim Curve Node to which the iterator is attached. More... | |
MStatus | next () |
Moves to the next keyframe on the Anim Curve Node to which the iterator is attached. More... | |
bool | isDone (MStatus *ReturnStatus=NULL) |
Indicates that the iterator has moved beyond the last keyframe on the Anim Curve Node to which the iterator is attached. More... | |
MTime | time (MStatus *ReturnStatus=NULL) |
Determines the time of the current keyframe. More... | |
MStatus | setTime (MTime time) |
Sets the time of the current keyframe. More... | |
double | value (MStatus *ReturnStatus=NULL) |
Determines the value of the current keyframe. More... | |
MStatus | setValue (double value) |
Sets the value of the current keyframe. More... | |
TangentType | inTangentType (MStatus *ReturnStatus=NULL) |
Determines the type of the tangent to the curve entering the current keyframe. More... | |
TangentType | outTangentType (MStatus *ReturnStatus=NULL) |
Determines the type of the tangent to the curve leaving the current keyframe. More... | |
MStatus | setInTangentType (TangentType tangentType) |
Sets the type of the tangent to the curve entering the current keyframe. More... | |
MStatus | setOutTangentType (TangentType tangentType) |
Sets the type of the tangent to the curve entering the current keyframe. More... | |
MStatus | getTangentOut (TangentValue &x, TangentValue &y) |
Determines the x,y value of the tangent to the curve leaving the current keyframe. More... | |
MStatus | getTangentIn (TangentValue &x, TangentValue &y) |
Determines the x,y value of the tangent to the curve entering the current keyframe. More... | |
bool | tangentsLocked (MStatus *ReturnStatus=NULL) const |
Determines whether the tangents are locked at this keyframe. More... | |
MStatus | setTangentsLocked (bool locked) |
Lock or unlock the tangents at this keyframe. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
enum TangentType |
Tangent types.
OPENMAYA_MAJOR_NAMESPACE_OPEN MItKeyframe | ( | MObject & | animCurveNode, |
MStatus * | ReturnStatus = NULL |
||
) |
Class Constructor.
Creates an iterator and attaches it to the given Anim Curve Node.
[in] | animCurveNode | Target Node for attachment of iterator |
[out] | ReturnStatus | Status Code (see below) |
~MItKeyframe | ( | ) |
Class Destructor.
No additional action.
Detaches the iterator from the current Anim Curve Node and attaches it to the given Node.
Resets to the first keyframe (index = 0).
[in] | animCurveNode | New target Node for attachment to iterator |
MStatus reset | ( | ) |
Resets the keyframe index to 0 (first keyframe) on the Anim Curve Node to which the iterator is attached.
MStatus next | ( | ) |
Moves to the next keyframe on the Anim Curve Node to which the iterator is attached.
Attempting to move beyond the last keyframe has no effect (and returns success).
bool isDone | ( | MStatus * | ReturnStatus = NULL | ) |
Indicates that the iterator has moved beyond the last keyframe on the Anim Curve Node to which the iterator is attached.
If isDone() returns true, attempting to access the curve via the iterator's time(), value() etc. methods will return an 'index out of range' error.
[out] | ReturnStatus | Status Code (see below) |
Determines the time of the current keyframe.
[out] | ReturnStatus | Status Code (see below). |
Sets the time of the current keyframe.
This will fail if setting the time would require re-ordering of the keyframes.
Tangents may be changed so that the curve remains monotonic with respect to time.
[in] | time | Time to which the current keyframe time is to be set. |
double value | ( | MStatus * | ReturnStatus = NULL | ) |
Determines the value of the current keyframe.
[out] | ReturnStatus | Status Code (see below). |
MStatus setValue | ( | double | value | ) |
Sets the value of the current keyframe.
[in] | value | Value to which the current keyframe time is to be set. |
MItKeyframe::TangentType inTangentType | ( | MStatus * | ReturnStatus = NULL | ) |
Determines the type of the tangent to the curve entering the current keyframe.
[out] | ReturnStatus | Status Code (see below). |
MItKeyframe::TangentType outTangentType | ( | MStatus * | ReturnStatus = NULL | ) |
Determines the type of the tangent to the curve leaving the current keyframe.
[out] | ReturnStatus | Status Code (see below). |
MStatus setInTangentType | ( | TangentType | tangentType | ) |
Sets the type of the tangent to the curve entering the current keyframe.
[in] | tangentType | Type to which the tangent is to be set |
MStatus setOutTangentType | ( | TangentType | tangentType | ) |
Sets the type of the tangent to the curve entering the current keyframe.
[in] | tangentType | Type to which the tangent is to be set |
MStatus getTangentOut | ( | TangentValue & | x, |
TangentValue & | y | ||
) |
Determines the x,y value of the tangent to the curve leaving the current keyframe.
[out] | x | Delta x of the slope of the tangent |
[out] | y | Delta y of the slope of the tangent |
MStatus getTangentIn | ( | TangentValue & | x, |
TangentValue & | y | ||
) |
Determines the x,y value of the tangent to the curve entering the current keyframe.
[out] | x | Delta x of the slope of the tangent |
[out] | y | Delta y of the slope of the tangent |
bool tangentsLocked | ( | MStatus * | ReturnStatus = NULL | ) | const |
Determines whether the tangents are locked at this keyframe.
[out] | ReturnStatus | Status Code (see below). |
MStatus setTangentsLocked | ( | bool | locked | ) |
Lock or unlock the tangents at this keyframe.
[in] | locked | true if the tangents are to be locked, false otherwise |
|
static |
Returns the name of this class.