class MItKeyframe

Jump to documentation

Keyframe Iterator (OpenMayaAnim) (OpenMayaAnim.py)

public members:

enum TangentType
kTangentGlobal
kTangentFixed
kTangentLinear
kTangentFlat
kTangentSmooth
kTangentStep
kTangentSlow
kTangentFast
kTangentClamped
kTangentPlateau
kTangentStepNext
MItKeyframe ( MObject & animCurveNode, MStatus * ReturnStatus = NULL )
~MItKeyframe ()
MStatus reset ( MObject & animCurveNode )
MStatus reset ()
MStatus next ()
bool isDone ( MStatus * ReturnStatus = NULL )
MTime time ( MStatus * ReturnStatus = NULL )
MStatus setTime ( MTime time )
double value ( MStatus * ReturnStatus = NULL )
MStatus setValue ( double value )
TangentType inTangentType ( MStatus * ReturnStatus = NULL )
TangentType outTangentType ( MStatus * ReturnStatus = NULL )
MStatus setInTangentType ( TangentType tangentType )
MStatus setOutTangentType ( TangentType tangentType )
MStatus getTangentOut ( float &x, float &y )
MStatus getTangentIn ( float &x, float &y )
bool tangentsLocked ( MStatus * ReturnStatus = NULL ) const
MStatus setTangentsLocked ( bool locked )

Documentation

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.

Description

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.

Functions

MItKeyframe:: MItKeyframe ( MObject & animCurveNode, MStatus * ReturnStatus )

Description

Class Constructor

Creates an iterator and attaches it to the given Anim Curve Node.

Arguments

  • animCurveNode Target Node for attachment of iterator
  • ReturnStatus Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure creating iterator - Node does not exist, is not accessible or is not a Anim Curve

MItKeyframe:: ~MItKeyframe ()

Description

Class Destructor

No additional action.

MStatus MItKeyframe:: reset ( MObject & animCurveNode )

Description

Detaches the iterator from the current Anim Curve Node and attaches it to the given Node. Resets to the first keyframe (index = 0).

Arguments

  • animCurveNode New target Node for attachment to iterator

Return Value

  • ReturnStatus Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure reseting iterator - Node does not exist, is not accessible or is not a Anim Curve

MStatus MItKeyframe:: reset ()

Description

Resets the keyframe index to 0 (first keyframe) on the Anim Curve Node to which the iterator is attached.

Arguments

  • Nil

Return Value

  • ReturnStatus Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure reseting iterator - Node does not exist or is not accessible

MStatus MItKeyframe:: next ()

Description

Moves to the next keyframe on the Anim Curve Node to which the iterator is attached.

Arguments

  • Nil

Return Value

  • ReturnStatus Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure finding next keyframe - Node does not exist or is not accessible

bool MItKeyframe:: isDone ( MStatus * ReturnStatus )

Description

Indicates that the iterator is at the last keyframe on the Anim Curve Node to which the iterator is attached (index = number of keyframes - 1).

Arguments

  • ReturnStatus Status Code (see below)

Return Value

  • true Done
  • false Not done

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MTime MItKeyframe:: time ( MStatus * ReturnStatus )

Description

Determines the time of the current keyframe.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • Time (in seconds) of the current keyframe

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MItKeyframe:: setTime ( MTime time )

Description

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.

Arguments

  • time Time to which the current keyframe time is to be set.

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for time - time out of range and/or re-ordering of keyframes required
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible

double MItKeyframe:: value ( MStatus * ReturnStatus )

Description

Determines the value of the current keyframe.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • Value of the current keyframe

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MItKeyframe:: setValue ( double value )

Description

Sets the value of the current keyframe.

Arguments

  • time Value to which the current keyframe time is to be set.

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible

MItKeyframe::TangentType MItKeyframe:: inTangentType ( MStatus * ReturnStatus )

Description

Determines the type of the tangent to the curve entering the current keyframe.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • Type of the tangent

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or keyframe does not exist or is not aacessible, or index is invalid

MItKeyframe::TangentType MItKeyframe:: outTangentType ( MStatus * ReturnStatus )

Description

Determines the type of the tangent to the curve leaving the current keyframe.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • Type of the tangent

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or keyframe does not exist or is not aacessible, or index is invalid

MStatus MItKeyframe:: setInTangentType ( TangentType tangentType )

Description

Sets the type of the tangent to the curve entering the current keyframe.

Arguments

  • tangentType Type to which the tangent is to be set

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MItKeyframe:: setOutTangentType ( TangentType tangentType )

Description

Sets the type of the tangent to the curve entering the current keyframe.

Arguments

  • tangentType Type to which the tangent is to be set

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MItKeyframe:: getTangentOut ( float &x, float &y )

Description

Determines the x,y value of the tangent to the curve leaving the current keyframe.

Arguments

  • x Delta x of the slope of the tangent
  • y Delta y of the slope of the tangent

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or keyframe does not exist or is not aacessible, or index is invalid

MStatus MItKeyframe:: getTangentIn ( float &x, float &y )

Description

Determines the x,y value of the tangent to the curve entering the current keyframe.

Arguments

  • x Delta x of the slope of the tangent
  • y Delta y of the slope of the tangent

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or keyframe does not exist or is not aacessible, or index is invalid

bool MItKeyframe:: tangentsLocked ( MStatus * ReturnStatus ) const

Description

Determines whether the tangents are locked at this keyframe.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • true if the tangents are locked
  • false if the tangents are not locked

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or keyframe does not exist or is not aacessible, or index is invalid

MStatus MItKeyframe:: setTangentsLocked ( bool locked )

Description

Lock or unlock the tangents at this keyframe.

Arguments

  • locked true if the tangents are to be locked, false otherwise

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Iterator holds invalid keyframe index (index >= number of keyframes) - iterator is invalid or index is invalid
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright