class MFnAnimCurve

Jump to documentation

: public MFnDependencyNode Anim Curve Function Set (OpenMayaAnim) (OpenMayaAnim.py)

Inheritance:

MFnAnimCurve < MFnDependencyNode < MFnBase

public members:

MFnAnimCurve ()
MFnAnimCurve ( MObject & object, MStatus * ReturnStatus = NULL )
virtual ~MFnAnimCurve ()
virtual MFn::Type type () const
MFnAnimCurve (const MPlug &plug, MStatus *ReturnStatus = NULL)
enum AnimCurveType
kAnimCurveTA
kAnimCurveTA = 0
kAnimCurveTL
kAnimCurveTL
kAnimCurveTT
kAnimCurveTT
kAnimCurveTU
kAnimCurveTU
kAnimCurveUA
kAnimCurveUA
kAnimCurveUL
kAnimCurveUL
kAnimCurveUT
kAnimCurveUT
kAnimCurveUU
kAnimCurveUU
kAnimCurveUnknown
kAnimCurveUnknown
enum TangentType
kTangentGlobal
kTangentFixed
kTangentLinear
kTangentFlat
kTangentSmooth
kTangentStep
kTangentSlow
OBSOLETE kTangentSlow should not be used. Using this tangent type may produce unwanted and unexpected results.
kTangentFast
OBSOLETE kTangentFast should not be used. Using this tangent type may produce unwanted and unexpected results.
kTangentClamped
kTangentPlateau
kTangentStepNext
enum InfinityType
kConstant
kLinear
kCycle
kCycleRelative
kOscillate
MObject create ( const MObject & node, const MObject & attribute, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL )
MObject create ( const MObject & node, const MObject & attribute, AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL )
MObject create ( const MPlug & plug, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL )
MObject create ( const MPlug & plug, AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL )
MObject create ( AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL )
AnimCurveType animCurveType ( MStatus *ReturnStatus = NULL) const
AnimCurveType timedAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus = NULL) const
AnimCurveType unitlessAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus = NULL) const
double evaluate ( const MTime &atTime, MStatus * ReturnStatus = NULL ) const
MStatus evaluate ( const MTime &atTime, double & value ) const
MStatus evaluate ( const MTime &atTime, MTime &timeValue ) const
MStatus evaluate ( const double &atUnitlessInput, double & value ) const
MStatus evaluate ( const double &atUnitlessInput, MTime &timeValue ) const
bool isStatic ( MStatus * ReturnStatus = NULL ) const
unsigned int numKeyframes ( MStatus * ReturnStatus = NULL ) const
unsigned int numKeys ( MStatus * ReturnStatus = NULL ) const
MStatus remove ( unsigned int index, MAnimCurveChange * change = NULL )
MStatus addKeyframe ( const MTime & time , double value , MAnimCurveChange * change = NULL )
MStatus addKeyframe ( const MTime & time , double value , TangentType tangentInType, TangentType tangentOutType, MAnimCurveChange * change = NULL )
unsigned int addKey ( const MTime & time , double value , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL )
unsigned int addKey ( const MTime & timeInput, const MTime & timeValue, TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL )
unsigned int addKey ( double unitlessInput , double value , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL )
unsigned int addKey ( double unitlessInput , const MTime & time , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL )
MStatus addKeys ( MTimeArray * timeArray, MDoubleArray * valueArray, TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , bool keepExistingKeys = false, MAnimCurveChange * change = NULL )
bool find ( const MTime & time , unsigned int &index, MStatus * ReturnStatus = NULL ) const
bool find ( double unitlessInput , unsigned int & index, MStatus * ReturnStatus = NULL ) const
unsigned int findClosest ( const MTime & time , MStatus * ReturnStatus = NULL ) const
unsigned int findClosest ( double unitlessInput , MStatus * ReturnStatus = NULL ) const
MTime time ( unsigned int index, MStatus * ReturnStatus = NULL ) const
double value ( unsigned int index, MStatus * ReturnStatus = NULL ) const
double unitlessInput ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus setValue ( unsigned int index, double value , MAnimCurveChange * change = NULL )
MStatus setTime ( unsigned int index, const MTime & time , MAnimCurveChange * change = NULL )
MStatus setUnitlessInput ( unsigned int index, double unitlessInput , MAnimCurveChange * change = NULL )
bool isTimeInput ( MStatus * ReturnStatus = NULL ) const
bool isUnitlessInput ( MStatus * ReturnStatus = NULL ) const
TangentType inTangentType ( unsigned int index, MStatus * ReturnStatus = NULL ) const
TangentType outTangentType ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus setInTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change = NULL )
MStatus setOutTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change = NULL )
MStatus getTangent ( unsigned int index, float &x, float &y, bool inTangent) const
MStatus getTangent ( unsigned int index, MAngle &angle, double &weight, bool inTangent ) const
MStatus setTangent ( unsigned int index, float x, float y, bool inTangent, MAnimCurveChange * change = NULL, bool convertUnits=true )
MStatus setTangent ( unsigned int index, const MAngle & angle, double weight, bool inTangent, MAnimCurveChange * change = NULL, bool convertUnits=true )
MStatus setAngle ( unsigned int index, const MAngle & angle, bool inTangent, MAnimCurveChange * change = NULL )
MStatus setWeight ( unsigned int index, double weight, bool inTangent, MAnimCurveChange * change = NULL )
bool weightsLocked ( unsigned int index, MStatus * ReturnStatus = NULL ) const
bool tangentsLocked ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus setWeightsLocked ( unsigned int index, bool locked, MAnimCurveChange * change = NULL )
MStatus setTangentsLocked ( unsigned int index, bool locked, MAnimCurveChange * change = NULL )
InfinityType preInfinityType ( MStatus * ReturnStatus = NULL ) const
InfinityType postInfinityType ( MStatus * ReturnStatus = NULL ) const
MStatus setPreInfinityType ( InfinityType infinityType, MAnimCurveChange * change = NULL )
MStatus setPostInfinityType ( InfinityType infinityType, MAnimCurveChange * change = NULL )
bool isWeighted ( MStatus *ReturnStatus = NULL) const
MStatus setIsWeighted (bool isWeighted, MAnimCurveChange *change = NULL)
bool isBreakdown ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus setIsBreakdown ( unsigned int index, bool isBreakdown , MAnimCurveChange *change = NULL)
MFnAnimCurve ( const MObject & object, MStatus * ReturnStatus = NULL )

Inherited from MFnDependencyNode:

public members:

virtual MFn::Type type () const
enum MAttrClass
kGlobalDynamicAttr
kLocalDynamicAttr
MObject create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL )
MTypeId typeId ( MStatus * ReturnStatus = NULL ) const
MString typeName ( MStatus * ReturnStatus = NULL ) const
MString name ( MStatus * ReturnStatus = NULL ) const
MString setName ( const MString & name , MStatus * ReturnStatus = NULL )
MStatus getConnections ( MPlugArray & array ) const
unsigned int attributeCount ( MStatus * ReturnStatus=NULL) const
MObject attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MAttrClass attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MStatus getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const
MStatus getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const
MPlug findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MStatus addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MPxNode * userNode ( MStatus * ReturnStatus=NULL ) const
bool isFromReferencedFile ( MStatus * ReturnStatus=NULL) const
bool isShared ( MStatus * ReturnStatus=NULL) const
bool hasUniqueName ( MStatus * ReturnStatus=NULL) const
MString parentNamespace ( MStatus * ReturnStatus=NULL) const
bool isLocked ( MStatus * ReturnStatus=NULL) const
MStatus setLocked ( bool locked )
static MString classification ( const MString & nodeTypeName )
bool isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const
static unsigned int allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL )
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
static MStatus deallocateAllFlags (const MString pluginName)
MStatus setFlag (unsigned int flag, bool state)
bool isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const
bool isDefaultNode ( MStatus * ReturnStatus=NULL) const
MStatus setDoNotWrite ( bool flag )
bool canBeWritten ( MStatus * ReturnStatus=NULL) const
bool hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const
MObject getAliasAttr (bool force, MStatus * ReturnStatus=NULL)
bool setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL)
bool findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const
bool getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL)
MString plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL)
public
bool getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL)

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Create, query and edit Anim Curve Nodes and the keys internal to those Nodes.

Create an Anim Curve Node and connect its output to any animatable attribute on another Node.

Evaluate an Anim Curve at a particular time.

Determine the number of keys held by an Anim Curve.

Determine the time and value of individual keys, as well as the (angle,weight) or (x,y) values and type of key tangents. The in-tangent refers to the tangent entering the key. The out-tangent refers to the tangent leaving the key.

Find the index of the key at, or closest to a particular time.

Set the time and value of individual keys, as well as the type of the tangent to the curve entering (in-tangent) and leaving (out-tangent) the key, specify the tangent as either (angle,weight) or (x,y).

Add and remove keys from an Anim Curve.

Description

Anim Curves are implemented as Dependency Graph (DG) Nodes. Each Node can have indexed keys.

There are eight different types of Anim Curve nodes:

		timeToAngular (animCurveTA)
		timeToLinear (animCurveTL)
		timeToTime (animCurveTT)
		timeToUnitless (animCurveTU)
		unitlessToAngular (animCurveUA)
		unitlessToLinear (animCurveUL)
		unitlessToTime (animCurveUT)
		unitlessToUnitless (animCurveUU)
Specifying the correct AnimCurveType during creation will avoid implicit unit conversion nodes.

Use the Anim Curve Function Set to create Anim Curve Nodes and connect them to animatable attributes on DG Nodes, as well as to query and edit an Anim Curve Node and its keys.

On creation, an Anim Curve Function Set may be attached to a given Anim Curve or it may be unattached. The Function Set may be attached to a different Anim Curve Node using the setObject() methods inherited from the Base Function Set (MFnBase) or with the create() methods.

Use the create() methods of an Anim Curve Function Set to create a new Anim Curve Node, attach the Function Set to the new Node and connect the output of the Node to a specific animatable Attribute or Plug of another Node. Additionally, the output of an Anim Curve Node may be attached to an Attribute or Plug of another DG Node using the DG Modifier method MDGModifier::connect().

Use the evaluate() methods to determine the value of an Anim Curve at a particular time or a given unitless input.

Use the addKey() and remove() methods to add and remove keys to and from an Anim Curve.

The query and edit methods of the Anim Curve Function Set act on keys at a specific 0-based index. [Note that the numKeys() method returns a 1-based value]. Keys can be accessed either randomly (via a 0-based index) or serially (using the find() and findClosest() methods).

Use the find() or findClosest() methods to determine the index of a key at or closest to a specific time respectively.

Use the specific query methods to determine the time, value and tangent information for a key at a given index.

Use the specific edit methods to set the time, value and tangent information for a key at a given index.

There are methods for setting the x,y values for the in- and out-tangents, as well as setting their angles and weights.

Setting the time of a key will fail if the new time would require a re-ordering of the keys. Use the remove() and addKey() methods to re-order the keys. Or use the keyframe command from mel.

The Maya developer's kit ships with example code (animDemo) which demonstrates how to evaluate a Maya animation curve independent from Maya. The animation parameter curves in Maya are defined by a restricted set of cubic two-dimensional Bezier curves. It is defined by four points. P1 = (x1, y1) is the (key,value) pair for the first key. P2 = (x2, y2) is a point which defines the outgoing tangent direction at P1. P4 = (x4, y4) defines the second key and P3 = (x3, y3) is a point which defines the incoming tangent direction at P4. There are some basic restrictions for the x coordinates of these points: x1 <= x2 <= x3 <= x4.

The 2-dimensional Bezier curve is defined as

    F(u) = [ u^3 u^2 u 1 ] * B * | P1 |   ,  0 <= u <= 1
                                 | P2 |
                                 | P3 |
                                 | P4 |

         = [ B0(u) B1(u) B2(u) B3(u) ] * | x1 y1 |
                                         | x2 y2 |
                                         | x3 y3 |
                                         | x4 y4 |

where B is the Bezier Basis matrix  | -1  3  -3  1 |
                                    |  3 -6   3  0 |
                                    | -3  3   0  0 |
                                    |  1  0   0  0 |

F(u) yields a vector of two cubic polynomials [ Fx(u) Fy(u) ] which define an (x, y) position on the parameter curve for some u in the range [0,1].

For an animation parameter curve, we are given the x position and want to know its corresponding y position. To do this we use x = Fx(u) and solve for u. Fx(u) is cubic and the restrictions on valid values for x2 and x3 guarantee there will be only one real root value for u. Once we know u, we can plug it into Fy(u) to get the y value.

One important note is how the outgoing and incoming tangents directions for a key are saved internally and in the Maya Ascii file format. Instead of being specified as points, the tangent directions are specified as vectors. The outgoing tangent direction at P1 is specified and saved as the vector 3*(P2 - P1) and the incoming tangent direction is specified and saved as the vector 3*(P4 - P3).

An animation curve is basically a restricted form of a bezier curve for which the keys serve as the control points and have tangent information embedded within them. There are two different methods for converting tangent information into the control points of the bezier hull and we have taken to calling the two methods weighted and non-weighted tangents.

The animation curve is evaluated in a piecewise manner, which means that each segment between two keys is evaluated on its own, without regards to any other segment. The only time keys outside of a segment are considered is when tangent values are calculated for the spline, clamped and plateau tangent types.

When evaluating an animation curve, a two stage process is used:

	1.	the evaluation time is examined to determine if it falls within
		the range of the animation curve, and if it does not evaluation is based
		upon the infinity settings for the animation curve
	2.	if the evaluation time falls within the range of the animation
		curve, the bezier parameters of the curve are computed and used
		as described below

Animation curves may have either weighted or non-weighted tangents. With non-weighted tangents, tangents are implemented as vectors and P2 and P3 are internally adjusted to account for the time difference between P1 and P4.

When evaluating a time within a segment, the following algortithms are used:

For weighted tangents:
	where x is the start of the segment
	given the bezier x parameters a', b', c', d', find the parameter t 
	which satisfies the formula:
		(time - x) = (t^3 * a') + (t^2 + b') + (t * c') + d'
	with t (and the bezier y parameters a, b, c, d) compute the value as:
		v = (t^3 * a) + (t^2 + b) + (t * c) + d

For non-weighted tangents:
	where x is the start of the segment
	compute the parameter t as time - x
	with t (and the bezier y parameters a, b, c, d) compute the value as:
		v = (t^3 * a) + (t^2 + b) + (t * c) + d

Functions

MFnAnimCurve:: MFnAnimCurve ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnAnimCurve:: MFnAnimCurve ( MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given MObject.

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnAnimCurve:: MFnAnimCurve ( const MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given constant MObject.

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnAnimCurve:: ~MFnAnimCurve ()

Description

The class destructor.

MFn::Type MFnAnimCurve:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kAnimCurve

MFnAnimCurve:: MFnAnimCurve (const MPlug &plug, MStatus *ReturnStatus )
Description

Class constructor that initializes the function set to the single Anim Curve Node connected to the given MPlug. It is possible for a plug to be connected to more than one Anim Curve Node (for example the plug may be connected to a choice node and then several Anim Curves may be connected to the choice node). In this case the function set will attach to one of the Anim Curve Nodes and return MS::kNotImplemented.

Arguments

  • plug the MPlug to find a single Anim Curve Node
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MPlug does not represent a valid Maya object or if the function set is not allowed to attach to the Anim Curve Node
    • MS::kNotFound if the MPlug is not connected to an Anim Curve Node
    • MS::kNotImplemented if the MPlug is connected to more than one Anim Curve Node. The function set will be attached to one of the Anim Curve Nodes.

MObject MFnAnimCurve:: create ( const MObject & node, const MObject & attribute, MDGModifier * modifier , MStatus * ReturnStatus )

Description

Creates a new Anim Curve Node, attaches the Function Set to the new Node (detaching from the current Node) and connects the output of the new Anim Curve Node to an animatable Attribute on another DG Node. This method will fail if the target Attribute is not animatable, or if a connection to the target Attribute already exists.

Once the new Anim Curve Node has been created, the create() method finds the Plug associated with the target Attribute, makes sure the Attribute is animatable and then makes the connection.

The creation and connection of DG Nodes are DG operations. Operations on the DG are performed by DG Modifiers (MDGModifier). A DG Modifier provides methods for editing the DG, however, the operations are not performed immediately. DG operations must be undoable, therefore, the DG Modifier maintains a queue of pending DG operations which are performed when the MDGModifer::doIt() method is invoked. Subsequently, the queue of DG operations becomes the undo queue. When the MDGModifier::undoIt() method is invoked all of the operations on the queue are undone. DG operations on the queue can be done and undone as often as required as long as the Modifier exists and no other changes to the DG make the operations invalid. Once the Modifier holding the queue is destroyed, the queue is lost.

If a DG Modifier is passed as a parameter to this create() method, then that Modifier will be invoked to perform the creation and connection operations. At the completion of the create() method, the Modifier holds the necessary information to undo the operations, therefore, the caller of the create() method can undo the creation and connection if necessary.

If no Modifier is passed in, the create() method instantiates its own Modifier, uses it to perform the DG operations and then destroys the Modifier. The creation and connection, in this case, are not undoable by the caller.

Arguments

  • node DG Node to which the output of the new Anim Curve Node is to be connected
  • attribute Attribute on the given node to which the output of the new Anim Curve Node is to be connected
  • modifier Modifier to be used so undo capability is retained by caller
  • ReturnStatus Status Code (see below)

Return Value

  • The new Anim Curve Node

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for node and/or attribute - Node and/or Attribute inaccessible or non-existent, Attribute already connected as destination (fan-in not allowed), or Attribute is not animatable.

  • MS::kInsufficientMemory Insufficient memory to create new Node or temporary DG Modifier
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Could not modify DG

MObject MFnAnimCurve:: create ( const MObject & node, const MObject & attribute, AnimCurveType animCurveType, MDGModifier * modifier , MStatus * ReturnStatus )

Description

Creates a new Anim Curve Node, attaches the Function Set to the new Node (detaching from the current Node) and connects the output of the new Anim Curve Node to an animatable Attribute on another DG Node. This method will fail if the target Attribute is not animatable, or if a connection to the target Attribute already exists.

Once the new Anim Curve Node has been created, the create() method finds the Plug associated with the target Attribute, makes sure the Attribute is animatable and then makes the connection.

The creation and connection of DG Nodes are DG operations. Operations on the DG are performed by DG Modifiers (MDGModifier). A DG Modifier provides methods for editing the DG, however, the operations are not performed immediately. DG operations must be undoable, therefore, the DG Modifier maintains a queue of pending DG operations which are performed when the MDGModifer::doIt() method is invoked. Subsequently, the queue of DG operations becomes the undo queue. When the MDGModifier::undoIt() method is invoked all of the operations on the queue are undone. DG operations on the queue can be done and undone as often as required as long as the Modifier exists and no other changes to the DG make the operations invalid. Once the Modifier holding the queue is destroyed, the queue is lost.

If a DG Modifier is passed as a parameter to this create() method, then that Modifier will be invoked to perform the creation and connection operations. At the completion of the create() method, the Modifier holds the necessary information to undo the operations, therefore, the caller of the create() method can undo the creation and connection if necessary.

If no Modifier is passed in, the create() method instantiates its own Modifier, uses it to perform the DG operations and then destroys the Modifier. The creation and connection, in this case, are not undoable by the caller.

Arguments

  • node DG Node to which the output of the new Anim Curve Node is to be connected
  • attribute Attribute on the given node to which the output of the new Anim Curve Node is to be connected
  • animCurveType The animCurve Type to be created
  • modifier Modifier to be used so undo capability is retained by caller
  • ReturnStatus Status Code (see below)

Return Value

  • The new Anim Curve Node

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for node and/or attribute - Node and/or Attribute inaccessible or non-existent, Attribute already connected as destination (fan-in not allowed), or Attribute is not animatable.

  • MS::kInsufficientMemory Insufficient memory to create new Node or temporary DG Modifier
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Could not modify DG

MObject MFnAnimCurve:: create ( const MPlug & plug, MDGModifier * modifier , MStatus * ReturnStatus )

Description

Creates a new Anim Curve Node, attaches the Function Set to the new Node (detaching from the current Node) and connects the output of the new Anim Curve Node to the Plug on an animatable Attribute on another DG Node. This method will fail if the target Attribute is not animatable, or if a connection to the target Attribute already exists.

If a DG Modifier is passed as a parameter to this create() method, then that Modifier will be invoked to perform the creation and connection operations. At the completion of the create() method, the Modifier holds the necessary information to undo the operations, therefore, the caller of the create() method can undo the creation and connection if necessary.

If no Modifier is passed in, the create() method instantiates its own Modifier, uses it to perform the DG operations and then destroys the Modifier. The creation and connection, in this case, are not undoable by the caller.

Arguments

  • plug Plug to which the output of the new Anim Curve Node is to be connected
  • modifier Modifier to be used so undo capability is retained by caller
  • ReturnStatus Status Code (see below)

Return Value

  • The new Anim Curve Node

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for plug - Attribute already connected as destination (fan-in not allowed), or Attribute is not animatable.

  • MS::kInsufficientMemory Insufficient memory to create new Node or temporary DG Modifier
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Could not modify DG

MObject MFnAnimCurve:: create ( const MPlug & plug, AnimCurveType animCurveType, MDGModifier * modifier , MStatus * ReturnStatus )

Description

Creates a new Anim Curve Node, attaches the Function Set to the new Node (detaching from the current Node) and connects the output of the new Anim Curve Node to the Plug on an animatable Attribute on another DG Node. This method will fail if the target Attribute is not animatable, or if a connection to the target Attribute already exists.

If a DG Modifier is passed as a parameter to this create() method, then that Modifier will be invoked to perform the creation and connection operations. At the completion of the create() method, the Modifier holds the necessary information to undo the operations, therefore, the caller of the create() method can undo the creation and connection if necessary.

If no Modifier is passed in, the create() method instantiates its own Modifier, uses it to perform the DG operations and then destroys the Modifier. The creation and connection, in this case, are not undoable by the caller.

Arguments

  • plug Plug to which the output of the new Anim Curve Node is to be connected
  • animCurveType The animCurve type to be created
  • modifier Modifier to be used so undo capability is retained by caller
  • ReturnStatus Status Code (see below)

Return Value

  • The new Anim Curve Node

Status Codes

  • MS::kSuccess Success
  • MS::kInvalidParameter Invalid parameter passed for plug - Attribute already connected as destination (fan-in not allowed), or Attribute is not animatable.

  • MS::kInsufficientMemory Insufficient memory to create new Node or temporary DG Modifier
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Could not modify DG

MObject MFnAnimCurve:: create ( AnimCurveType animCurveType, MDGModifier * modifier , MStatus * ReturnStatus )

Description

Creates a new Anim Curve Node, attaches the Function Set to the new Node (detaching from the current Node) but does not attempt to connect the new Anim Curve Node.

If a DG Modifier is passed as a parameter to this create() method, then that Modifier will be invoked to perform the creation and connection operations. At the completion of the create() method, the Modifier holds the necessary information to undo the operations, therefore, the caller of the create() method can undo the creation and connection if necessary.

If no Modifier is passed in, the create() method instantiates its own Modifier, uses it to perform the DG operations and then destroys the Modifier. The creation and connection, in this case, are not undoable by the caller.

Arguments

  • animCurveType The type of Anim Curve to be created
  • modifier Modifier to be used so undo capability is retained by caller
  • ReturnStatus Status Code (see below)

Return Value

  • The new Anim Curve Node

Status Codes

  • MS::kSuccess Success
  • MS::kInsufficientMemory Insufficient memory to create new Node or temporary DG Modifier
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Could not modify DG

MFnAnimCurve::AnimCurveType MFnAnimCurve:: animCurveType ( MStatus * ReturnStatus ) const

Description

Returns the animCurve type

Arguments

  • ReturnStatus Status Code (see below)

Return Value

The animCurve type.

Status Codes

  • MS::kSuccess the animCurve type was returned successfully
  • MS::kFailure the animCurve type was not returned successfully

MFnAnimCurve::AnimCurveType MFnAnimCurve:: timedAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus) const

Description

Returns the timed animCurve type appropriate for the specified plug.

Arguments

  • plug plug
  • ReturnStatus Status Code (see below)

Return Value

The animCurve type.

Status Codes

  • MS::kSuccess the animCurve type was returned successfully
  • MS::kFailure the animCurve type was not returned successfully

MFnAnimCurve::AnimCurveType MFnAnimCurve:: unitlessAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus) const

Description

Returns the unitless animCurve type appropriate for the specified plug.

Arguments

  • plug plug
  • ReturnStatus Status Code (see below)

Return Value

The animCurve type.

Status Codes

  • MS::kSuccess the animCurve type was returned successfully
  • MS::kFailure the animCurve type was not returned successfully

double MFnAnimCurve:: evaluate ( const MTime &atTime, MStatus * ReturnStatus ) const

Description

Determines the interpolated output value of Anim Curves of type kAnimCurveTA, kAnimCurveTL and kAnimCurveTU at the specified time.

Arguments

  • atTime Time at which the Anim Curve is to be evaluated
  • ReturnStatus Status Code (see below).

Return Value

  • Interpolated value of Anim Curve at specified time

Status Codes

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

MStatus MFnAnimCurve:: evaluate ( const MTime &atTime, double & value ) const

Description

Determines the interpolated output value of Anim Curves of type kAnimCurveTA, kAnimCurveTL and kAnimCurveTU at the specified time.

Arguments

  • atTime Time at which the Anim Curve is to be evaluated
  • value Interpolated value of Anim Curve at specified time

Return Value

  • Status Code (see below).

Status Codes

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

MStatus MFnAnimCurve:: evaluate ( const MTime &atTime, MTime &timeValue ) const

Description

Determines the interpolated output value of Anim Curves of type kAnimCurveTT at the specified time.

Arguments

  • atTime Time at which the Anim Curve is to be evaluated
  • timeValue Interpolated output time of Anim Curve at specified time

Return Value

  • Status Code (see below).

Status Codes

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

MStatus MFnAnimCurve:: evaluate ( const double &atUnitlessInput, double & value ) const

Description

Determines the interpolated output value of Anim Curves of type kAnimCurveUA, kAnimCurveUL and kAnimCurveUU at the specified unitless input.

Arguments

  • atUnitlessInput Input value at which the Anim Curve is to be evaluated
  • value Interpolated output value of Anim Curve at specified input value

Return Value

  • Status Code (see below).

Status Codes

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

MStatus MFnAnimCurve:: evaluate ( const double &atUnitlessInput, MTime &timeValue ) const

Description

Determines the interpolated output value of Anim Curves of type kAnimCurveUT at the specified unitless input.

Arguments

  • atUnitlessInput Input value at which the Anim Curve is to be evaluated
  • timeValue Interpolated output time of Anim Curve at specified time

Return Value

  • Status Code (see below).

Status Codes

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

bool MFnAnimCurve:: isStatic ( MStatus * ReturnStatus ) const

Description

Determines whether or not the animCurve is static. The animCurve is considered to be static if it would return the same value regardless of the evaluation time. This basically means that the values of all the keys are the same and the y component of all the tangents is 0.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • true The curve is static.
  • false The curve is not static.

Status Codes

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

unsigned int MFnAnimCurve:: numKeyframes ( MStatus * ReturnStatus ) const

Description

OBSOLETE METHOD. Use MFnAnimCurve::numKeys instead.

unsigned int MFnAnimCurve:: numKeys ( MStatus * ReturnStatus ) const

Description

Determines the number of keys on the Anim Curve Node.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • Number of keys on the Anim Curve Node

Status Codes

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

MStatus MFnAnimCurve:: remove ( unsigned int index, MAnimCurveChange * change )

Description

Removes the key at the specified index.

Unlike the DG which is a (potentially) large complex collection of Nodes, Anim Curves are single Nodes. Thus Anim Curves can edit themselves and do not need a special modifier like the DG Modifier (MDGModifier). However, at times it is necessary to be able to undo and redo changes to Anim Curves. This is primarily to support the interactive editing of Anim Curves via the UI. Since it is impractical to cache the change information on the Node itself, the Anim Curve Change class (MAnimCurveChange) is used.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

If this method is called from within an MItKeyframe iterator, the results are undefined (i.e., it is likely that the incorrect key will be removed). This is because keys are automatically sorted (i.e., assigned new index values) everytime time they are modified in such a manner that could cause them to change order (e.g., they are moved, keys are inserted or removed, etc.).

Arguments

  • index Index of the key to be removed
  • delta Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

MStatus MFnAnimCurve:: addKeyframe ( const MTime & time , double value , MAnimCurveChange * change )

Description

Adds a new key with the given value at the specified time.

Tangent types are set to kTangentGlobal. If you immediately query this key for its tangent type (after it is added), it will not be kTangentGlobal, rather it will be the specific type referred to by kTangentGlobal.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • time Time at which the key is to be added
  • value Value to which the key is to be set
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

MStatus MFnAnimCurve:: addKeyframe ( const MTime & time , double value , TangentType tangentInType, TangentType tangentOutType, MAnimCurveChange * change )

Description

Adds a new key with the given value and tangent types at the specified time.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • time Time at which the key is to be added
  • value Value to which the key is to be set
  • tangentInType In tangent type for the key
  • tangentOutType Out tangent type for the key
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

unsigned int MFnAnimCurve:: addKey ( const MTime & time , double value , TangentType tangentInType , TangentType tangentOutType , MAnimCurveChange * change , MStatus * ReturnStatus )

Description

Adds a new key with the given value and tangent types at the specified time for curves of type kAnimCurveTA, kAnimCurveTL and kAnimCurveTU.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • time Time at which the key is to be added
  • value Value to which the key is to be set
  • tangentInType In tangent type for the key
  • tangentOutType Out tangent type for the key
  • change Anim Curve Change cache
  • ReturnStatus Status Code (see below)

Return Value

  • Index of the added key

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

unsigned int MFnAnimCurve:: addKey ( const MTime &timeInput, const MTime &timeValue, TangentType tangentInType , TangentType tangentOutType , MAnimCurveChange * change , MStatus * ReturnStatus )

Description

Adds a new key with the given output time value and tangent types at the specified input time for curves of type kAnimCurveTT.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • timeInput Time at which the key is to be added
  • timeValue Value to which the key is to be set
  • tangentInType In tangent type for the key
  • tangentOutType Out tangent type for the key
  • change Anim Curve Change cache
  • ReturnStatus Status Code (see below)

Return Value

  • Index of the added key

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

unsigned int MFnAnimCurve:: addKey ( double unitlessInput , double value , TangentType tangentInType , TangentType tangentOutType , MAnimCurveChange * change , MStatus * ReturnStatus )

Description

Adds a new key with the given value and tangent types at the specified unitless input for curves of type kAnimCurveUA, kAnimCurveUL and kAnimCurveUU.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • unitlessInput Unitless input at which the key is to be added
  • value Value to which the key is to be set
  • tangentInType In tangent type for the key
  • tangentOutType Out tangent type for the key
  • change Anim Curve Change cache
  • ReturnStatus Status Code (see below)

Return Value

  • Index of added key

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

unsigned int MFnAnimCurve:: addKey ( double unitlessInput , const MTime &timeValue, TangentType tangentInType , TangentType tangentOutType , MAnimCurveChange * change , MStatus * ReturnStatus )

Description

Adds a new key with the given output time value and tangent types at the specified unitless input for curves of type kAnimCurveUT.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • unitlessInput Unitless input at which the key is to be added
  • timeValue Value to which the key is to be set
  • tangentInType In tangent type for the key
  • tangentOutType Out tangent type for the key
  • change Anim Curve Change cache
  • ReturnStatus Status Code (see below)

Return Value

  • Index of added key

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

MStatus MFnAnimCurve:: addKeys ( MTimeArray * timeArray, MDoubleArray * valueArray, TangentType tangentInType , TangentType tangentOutType , bool keepExistingKeys , MAnimCurveChange * change )

Description

Add a set of new keys with the given corresponding values and tangent types at the specified times. This method only works for Anim Curves of type kAnimCurveTA, kAnimCurveTL and kAnimCurveTU.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

This method is tuned to provide best performance when:

  • - the plug-in application pre-cuts the keys in the time range where the new keys are to be added
  • - keepExistingKeys is set to false
  • - change is NULL (i.e. the operation is not undoable)
These optimisations are geared towards motion capture plug-ins where a large numbers of keys must be added to a curve in a single operation.

Note: The timeArray and valueArray arrays are owned by the calling function. This method will copy those arrays to internal structures for use. As such, It is up to the caller to ensure that the memory allocated for the above arrays are deallocated appropriately.

Arguments

  • timeArray Times at which keys are to be added
  • valueArray Values to which the keys is to be set
  • tangentInType In tangent type for all the added keys
  • tangentOutType Out tangent type for all the added keys
  • keepExistingKeys Specifies whether the new keys should be merged with existing keys, or if they should be cut prior to adding the new keys
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

bool MFnAnimCurve:: find ( const MTime & time , unsigned int &index, MStatus * ReturnStatus ) const

Description

Determines the index of the key which is set at the specified time.

Arguments

  • time Time for which a key index is required
  • index Key index at the specified time (implicit return)
  • ReturnStatus Status Code (see below)

Return Value

  • true Index found
  • false Index not found

Status Codes

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

bool MFnAnimCurve:: find ( double unitlessInput , unsigned int &index, MStatus * ReturnStatus ) const

Description

Determines the index of the key which is set at the specified unitless input value.

Arguments

  • unitlessInput Value for which a key index is required
  • index Key index at the specified time (implicit return)
  • ReturnStatus Status Code (see below)

Return Value

  • true Index found
  • false Index not found

Status Codes

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

unsigned int MFnAnimCurve:: findClosest ( const MTime & time , MStatus * ReturnStatus ) const

Description

Determines the index of the key which is set at the time closest to the specified time.

Arguments

  • time Time for which a key index is required
  • ReturnStatus Status Code (see below).

Return Value

  • Key index closest to the specified time

Status Codes

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

unsigned int MFnAnimCurve:: findClosest ( double unitlessInput , MStatus * ReturnStatus ) const

Description

Determines the index of the key which is set at the time closest to the specified unitless input value.

Arguments

  • unitlessInput Input value for which a key index is required
  • ReturnStatus Status Code (see below).

Return Value

  • Key index closest to the specified time

Status Codes

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

MTime MFnAnimCurve:: time ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines the time of the key at the specified index.

Arguments

  • index Index of the key for which the time is required
  • ReturnStatus Status Code (see below).

Return Value

  • Time (in seconds) of the key

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

double MFnAnimCurve:: value ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines the value of the key at the specified index. This method should only be used on Anim Curves of type kAnimCurve*A, kAnimCurve*L or kAnimCurve*U.

Arguments

  • index Index of the key for which the value is required
  • ReturnStatus Status Code (see below).

Return Value

  • Value of the key

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

double MFnAnimCurve:: unitlessInput ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines the unitless input value of the key at the specified index. This method should only be used on Anim Curves of type kAnimCurveU*.

Arguments

  • index Index of the key for which the input value is required
  • ReturnStatus Status Code (see below).

Return Value

  • Input value at which the key is set

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MFnAnimCurve:: setValue ( unsigned int index, double value , MAnimCurveChange * change )

Description

Sets the value of the key at the specified index. This method should only be used on Anim Curves of type kAnimCurve*A, kAnimCurve*L or kAnimCurve*U.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key for which the value is to be set
  • time Time to which the indexed key time is to be set
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible

MStatus MFnAnimCurve:: setTime ( unsigned int index, const MTime & time , MAnimCurveChange * change )

Description

Sets the time of the key at the specified index. This will fail if setting the time would require re-ordering of the keys. This method should only be used on Anim Curves of type kAnimCurveT*.

Tangents may be changed so that the curve remains monotonic with respect to time.

Arguments

  • index Index of the key for which the time is to be set
  • time Time to which the indexed key time is to be set
  • change Anim Curve Change cache

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 keys required
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible

MStatus MFnAnimCurve:: setUnitlessInput ( unsigned int index, double unitlessInput , MAnimCurveChange * change )

Description

Sets the value of the unitless input of the key at the specified index. This will fail if setting the value would require re-ordering of the keys. This methid should only be used on Anim Curves of type kAnimCurveU*.

Tangents may be changed so that the curve remains monotonic with respect to the unitless input.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key for which the unitless input value is to be set
  • unitlessInput Value to which the indexed key unitless input value is to be set
  • change Anim Curve Change cache

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 keys required
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible

bool MFnAnimCurve:: isTimeInput ( MStatus * ReturnStatus ) const

Description

Determines the input type of the animCurve.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • true The curve takes time as input.
  • false The curve does not take time as input.

Status Codes

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

bool MFnAnimCurve:: isUnitlessInput ( MStatus * ReturnStatus ) const

Description

Determines the input type of the animCurve.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • true The curve takes a unitless value as input.
  • false The curve does not take a unitless value as input.

Status Codes

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

MFnAnimCurve::TangentType MFnAnimCurve:: inTangentType ( unsigned int index, MStatus * ReturnStatus ) const

Description

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

Arguments

  • index Index of the key for which the tangent type is required
  • ReturnStatus Status Code (see below).

Return Value

  • Type of the tangent

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MFnAnimCurve::TangentType MFnAnimCurve:: outTangentType ( unsigned int index, MStatus * ReturnStatus ) const

Description

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

Arguments

  • index Index of the key for which the tangent type is required
  • ReturnStatus Status Code (see below).

Return Value

  • Type of the tangent

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setInTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change )

Description

Sets the type of the tangent to the curve entering the key at the specified index.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key for which the tangent type is to be set
  • tangentType Type to which the tangent is to be set
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setOutTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change )

Description

Sets the type of the tangent to the curve leaving the key at the specified index.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key for which the tangent type is to be set
  • tangentType Type to which the tangent is to be set
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: getTangent ( unsigned int index, float &x, float &y, bool inTangent ) const

Description

Determines the x,y value representing the vector of the in- or out-tangent (depending on the value of the inTangent parameter) to the curve for the key at the specified index. The values returned will be in Maya's internal units (seconds for time, centimeters for linear, radians for angles). The following examples demonstrates how to convert from internal units of seconds into the current user time unit.

	float x,y;
	animCurveFn.getTangent(i,x,y,true);
	MTime convert(1.0, MTime::kSeconds);
	x *= (float) convert.as(MTime::uiUnit());
	

Arguments

  • index Index of the key for which the tangent x,y value is required
  • x The x value of the slope of the tangent in seconds
  • y Absolute y value of the slope of the tangent
  • inTangent If true, the in-tangent is returned, else, the out-tangent is returned

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: getTangent ( unsigned int index, MAngle &angle, double &weight, bool inTangent ) const

Description

Determines the angle and weight of the in- or out-tangent to the curve for the key at the specified index.

Recall that tangents are stored as vectors internally and in the Maya Ascii file format. This means that the returned angle and weight will be converted from an (x,y) pair to represent the vector according to the following formula:

		angle = atan(y/x)
		weight = x/(3*cos(angle))
	

where x is in seconds and y is in centimeters for linear units and radians for angular units.

Arguments

  • index Index of the key for which the tangent x,y value is required
  • angle The tangent angle
  • weight The tangent weight
  • inTangent If true, the inTangent is returned, else, the outTangent is returned

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setTangent ( unsigned int index, float x, float y, bool inTangent, MAnimCurveChange * change , bool convertUnits )

Description

Sets the tangent for the key at the specified index. If convertUnits is true (the default) the x value will be scaled by the current UI time units and the y value will be scaled by the relevant UI units for the output type of the animation curve (i.e. linear units for a curve that outputs linear data, and so on).

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Note that if this method is called on a locked tangent (which they are by default), the corresponding out- or in-tangent will be modified as well (i.e., they will both be set to fixed). To prevent this from occurring, you must first unlock the tangent, make your modifications and then restore the lock setting for the tangent afterwards.

Arguments

  • index Index of the key for which the tangent type is to be set
  • x Absolute x value of the slope of the tangent
  • y Absolute y value of the slope of the tangent
  • inTangent If true, the inTangent is modified, else, the outTangent is modified
  • change Anim Curve Change cache
  • convertUnits) Whether to convert to UI units before setting

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setTangent ( unsigned int index, const MAngle &angle, double weight, bool inTangent, MAnimCurveChange * change , bool convertUnits )

Description

Sets the tangent for the key at the specified index. If convertUnits is true (the default) the x value will be scaled by the current UI time units and the y value will be scaled by the relevant UI units for the output type of the animation curve (i.e. linear units for a curve that outputs linear data, and so on).

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Recall that tangents are stored as vectors internally and in the Maya Ascii file format. This means that the provided angle and weight will be converted into an (x,y) pair to represent the vector according to the following formula:

		x = 3 * weight * cos(angle)
		y = 3 * weight * sin(angle)
	

Note that if this method is called on a locked tangent (which they are by default), the corresponding out- or in-tangent will be modified as well (i.e., they will both be set to fixed). To prevent this from occurring, you must first unlock the tangent, make your modifications and then restore the lock setting for the tangent afterwards.

Arguments

  • index Index of the key for which the tangent type is to be set
  • angle The angle to set the tangent
  • weight The weight to set the tangent
  • inTangent If true, the inTangent is modified, else, the outTangent is modified
  • change Anim Curve Change cache
  • convertUnits) Whether to convert to UI units before setting

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setAngle ( unsigned int index, const MAngle &angle, bool inTangent, MAnimCurveChange * change )

Description

Set the in- or out-angle of the tangent for the key at the given index

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Note that if this method is called on a locked tangent (which they are by default), the corresponding out- or in-tangent will be modified as well (i.e., they will both be set to fixed). To prevent this from occurring, you must first unlock the tangent, make your modifications and then restore the lock setting for the tangent afterwards.

Arguments

  • index Index of the key
  • angle The new in- or out-angle for the key's tangent
  • inTangent If true, set the in-tangent, else out-tangent
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setWeight ( unsigned int index, double weight, bool inTangent, MAnimCurveChange * change )

Description

Set the in- or out-weight of the tangent for the key at the given index

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Note that if this method is called on a locked weight (which they are by default), the corresponding out- or in-weight will be modified as well. To prevent this from occurring, you must first unlock the weight, make your modifications and then restore the lock setting for the weight afterwards.

Arguments

  • index Index of the key
  • weight The new in- or out-weight for the key's tangent
  • inTangent If true, set the in-tangent, else set out-tangent
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

bool MFnAnimCurve:: weightsLocked ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines whether the weights are locked at the given key.

Arguments

  • index Index of the key to check for locked weights
  • ReturnStatus Status Code (see below).

Return Value

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

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

bool MFnAnimCurve:: tangentsLocked ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines whether the tangents are locked at the given key.

Arguments

  • index Index of the key to check for locked tangents
  • 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::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setWeightsLocked ( unsigned int index, bool locked, MAnimCurveChange * change )

Description

Lock or unlock the weights at the given key.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key at which to set/unset the locks
  • locked true if the weights are to be locked, false otherwise
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MStatus MFnAnimCurve:: setTangentsLocked ( unsigned int index, bool locked, MAnimCurveChange * change )

Description

Lock or unlock the tangents at the given key.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • index Index of the key at which to set/unset the locks
  • locked true if the tangents are to be locked, false otherwise
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible, or key does not exist or is not accessible, or index is invalid

MFnAnimCurve::InfinityType MFnAnimCurve:: preInfinityType ( MStatus * ReturnStatus ) const

Description

Determines the behaviour of the curve for the range occurring before the first key.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • the current preInfinityType for the curve

Status Codes

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

MFnAnimCurve::InfinityType MFnAnimCurve:: postInfinityType ( MStatus * ReturnStatus ) const

Description

Determines the behaviour of the curve for the range occurring after the last key.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • the current postInfinityType for the curve

Status Codes

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

MStatus MFnAnimCurve:: setPreInfinityType ( MFnAnimCurve::InfinityType infinityType, MAnimCurveChange * change )

Description

Set the behaviour of the curve for the range occurring before the first key.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • InfinityType The infinity type to be set.
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

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

MStatus MFnAnimCurve:: setPostInfinityType ( MFnAnimCurve::InfinityType infinityType, MAnimCurveChange * change )

Description

Set the behaviour of the curve for the range occurring after the last key.

If an Anim Curve Change cache is provided to the method, the change to the Anim Curve is saved in the cache and is available to the caller for undo and redo.

If an Anim Curve Change cache is not provided (i.e., change == NULL), the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • InfinityType The infinity type to be set.
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

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

bool MFnAnimCurve:: isWeighted ( MStatus *ReturnStatus ) const

Description

Determines whether or not the curve has weighted tangents.

Arguments

  • ReturnStatus Status Code (see below).

Return Value

  • True if the curve has weighted tangents, False otherwise

Status Codes

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

MStatus MFnAnimCurve:: setIsWeighted (bool isWeighted, MAnimCurveChange *change )

Description

Sets whether or not the curve has weighted tangents.

Unlike the DG which is a (potentially) large complex collection of Nodes, Anim Curves are single Nodes. Thus Anim Curves can edit themselves and do not need a special modifier like the DG Modifier (MDGModifier). However, at times it is necessary to be able to undo and redo changes to Anim Curves. This is primarily to support the interactive editing of Anim Curves via the UI. Since it is impractical to cache the change information on the Node itself, the Anim Curve Change class (MAnimCurveChange) is used.

If a Anim Curve Change cache is provided to the method, the change to the Anim Curve is cached and made available to the caller for undo and redo.

If a Anim Curve Change cache is not provided, the method assumes that the caller does not need undo or redo information, therefore none is cached.

Arguments

  • isWeighted Whether or not the curve should have weighted tangents
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

bool MFnAnimCurve:: isBreakdown ( unsigned int index, MStatus * ReturnStatus ) const

Description

Determines whether or not a key is a breakdown.

Arguments

  • index The key's index
  • ReturnStatus Status Code (see below).

Return Value

  • True if the key is a breakdown, false otherwise.

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure querying Node - Node does not exist or is not accessible

MStatus MFnAnimCurve:: setIsBreakdown ( unsigned int index, bool isBreakdown , MAnimCurveChange * change )

Description

Sets the breakdown state of a key at a given index.

Arguments

  • index Index of the key whose breakdown state is to be modified
  • isBreakdown The new breakdown state for the key.
  • change Anim Curve Change cache

Return Value

  • Status Code (see below)

Status Codes

  • MS::kSuccess Success
  • MS::kIndexOutOfRange Invalid parameter passed for index - index out of range (index >= numKeys)
  • MS::kFailure Failure editing Node - Node does not exist or is not accessible, or change could not be cached

This class has no child classes.


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