![]() | MFnAnimCurve () | ||||||||||
![]() | MFnAnimCurve ( MObject & object, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | ~MFnAnimCurve () | ||||||||||
![]() | type () const | ||||||||||
![]() | MFnAnimCurve (const MPlug &plug, MStatus *ReturnStatus = NULL) | ||||||||||
![]() | AnimCurveType | ||||||||||
![]() | TangentType | ||||||||||
![]() | InfinityType
| ||||||||||
![]() | create ( const MObject & node, const MObject & attribute, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | create ( const MObject & node, const MObject & attribute, AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | create ( const MPlug & plug, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | create ( const MPlug & plug, AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | create ( AnimCurveType animCurveType, MDGModifier * modifier = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | animCurveType ( MStatus *ReturnStatus = NULL) const | ||||||||||
![]() | timedAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus = NULL) const | ||||||||||
![]() | unitlessAnimCurveTypeForPlug ( MPlug & plug, MStatus *ReturnStatus = NULL) const | ||||||||||
![]() | evaluate ( const MTime &atTime, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | evaluate ( const MTime &atTime, double & value ) const | ||||||||||
![]() | evaluate ( const MTime &atTime, MTime &timeValue ) const | ||||||||||
![]() | evaluate ( const double &atUnitlessInput, double & value ) const | ||||||||||
![]() | evaluate ( const double &atUnitlessInput, MTime &timeValue ) const | ||||||||||
![]() | isStatic ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | numKeyframes ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | numKeys ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | remove ( unsigned int index, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | addKeyframe ( const MTime & time , double value , MAnimCurveChange * change = NULL ) | ||||||||||
![]() | addKeyframe ( const MTime & time , double value , TangentType tangentInType, TangentType tangentOutType, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | addKey ( const MTime & time , double value , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | addKey ( const MTime & timeInput, const MTime & timeValue, TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | addKey ( double unitlessInput , double value , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | addKey ( double unitlessInput , const MTime & time , TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , MAnimCurveChange * change = NULL, MStatus * ReturnStatus = NULL ) | ||||||||||
![]() | addKeys ( MTimeArray * timeArray, MDoubleArray * valueArray, TangentType tangentInType = kTangentGlobal , TangentType tangentOutType = kTangentGlobal , bool keepExistingKeys = false, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | find ( const MTime & time , unsigned int &index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | find ( double unitlessInput , unsigned int & index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | findClosest ( const MTime & time , MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | findClosest ( double unitlessInput , MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | time ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | value ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | unitlessInput ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | setValue ( unsigned int index, double value , MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setTime ( unsigned int index, const MTime & time , MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setUnitlessInput ( unsigned int index, double unitlessInput , MAnimCurveChange * change = NULL ) | ||||||||||
![]() | isTimeInput ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | isUnitlessInput ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | inTangentType ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | outTangentType ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | setInTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setOutTangentType ( unsigned int index, TangentType tangentType, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | getTangent ( unsigned int index, float &x, float &y, bool inTangent) const | ||||||||||
![]() | getTangent ( unsigned int index, MAngle &angle, double &weight, bool inTangent ) const | ||||||||||
![]() | setTangent ( unsigned int index, float x, float y, bool inTangent, MAnimCurveChange * change = NULL, bool convertUnits=true ) | ||||||||||
![]() | setTangent ( unsigned int index, const MAngle & angle, double weight, bool inTangent, MAnimCurveChange * change = NULL, bool convertUnits=true ) | ||||||||||
![]() | setAngle ( unsigned int index, const MAngle & angle, bool inTangent, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setWeight ( unsigned int index, double weight, bool inTangent, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | weightsLocked ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | tangentsLocked ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | setWeightsLocked ( unsigned int index, bool locked, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setTangentsLocked ( unsigned int index, bool locked, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | preInfinityType ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | postInfinityType ( MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | setPreInfinityType ( InfinityType infinityType, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | setPostInfinityType ( InfinityType infinityType, MAnimCurveChange * change = NULL ) | ||||||||||
![]() | isWeighted ( MStatus *ReturnStatus = NULL) const | ||||||||||
![]() | setIsWeighted (bool isWeighted, MAnimCurveChange *change = NULL) | ||||||||||
![]() | isBreakdown ( unsigned int index, MStatus * ReturnStatus = NULL ) const | ||||||||||
![]() | setIsBreakdown ( unsigned int index, bool isBreakdown , MAnimCurveChange *change = NULL) | ||||||||||
![]() | MFnAnimCurve ( const MObject & object, MStatus * ReturnStatus = NULL ) |
![]() | type () const | ||||
![]() | MAttrClass
| ||||
![]() | create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL ) | ||||
![]() | create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL ) | ||||
![]() | create ( const MString & type , MStatus * ReturnStatus = NULL ) | ||||
![]() | create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL ) | ||||
![]() | typeId ( MStatus * ReturnStatus = NULL ) const | ||||
![]() | typeName ( MStatus * ReturnStatus = NULL ) const | ||||
![]() | name ( MStatus * ReturnStatus = NULL ) const | ||||
![]() | setName ( const MString & name , MStatus * ReturnStatus = NULL ) | ||||
![]() | getConnections ( MPlugArray & array ) const | ||||
![]() | attributeCount ( MStatus * ReturnStatus=NULL) const | ||||
![]() | attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const | ||||
![]() | reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const | ||||
![]() | attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const | ||||
![]() | attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const | ||||
![]() | getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const | ||||
![]() | getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const | ||||
![]() | findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const | ||||
![]() | findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const | ||||
![]() | findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const | ||||
![]() | findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const | ||||
![]() | addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr ) | ||||
![]() | removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr ) | ||||
![]() | userNode ( MStatus * ReturnStatus=NULL ) const | ||||
![]() | isFromReferencedFile ( MStatus * ReturnStatus=NULL) const | ||||
![]() | isShared ( MStatus * ReturnStatus=NULL) const | ||||
![]() | hasUniqueName ( MStatus * ReturnStatus=NULL) const | ||||
![]() | parentNamespace ( MStatus * ReturnStatus=NULL) const | ||||
![]() | isLocked ( MStatus * ReturnStatus=NULL) const | ||||
![]() | setLocked ( bool locked ) | ||||
![]() | classification ( const MString & nodeTypeName ) | ||||
![]() | isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const | ||||
![]() | allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL ) | ||||
![]() | deallocateFlag (const MString pluginName, unsigned int flag) | ||||
![]() | deallocateAllFlags (const MString pluginName) | ||||
![]() | setFlag (unsigned int flag, bool state) | ||||
![]() | isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const | ||||
![]() | isDefaultNode ( MStatus * ReturnStatus=NULL) const | ||||
![]() | setDoNotWrite ( bool flag ) | ||||
![]() | canBeWritten ( MStatus * ReturnStatus=NULL) const | ||||
![]() | hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const | ||||
![]() | getAliasAttr (bool force, MStatus * ReturnStatus=NULL) | ||||
![]() | setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL) | ||||
![]() | findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const | ||||
![]() | getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL) | ||||
![]() | plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL) | ||||
![]() | public | ||||
![]() | getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL) |
![]() | type () const |
![]() | hasObj ( MFn::Type ) const |
![]() | hasObj ( const MObject & ) const |
![]() | object ( MStatus * ReturnStatus = NULL ) const |
![]() | setObject ( MObject & object ) |
![]() | setObject ( const MObject & object ) |
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 belowAnimation 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
float x,y; animCurveFn.getTangent(i,x,y,true); MTime convert(1.0, MTime::kSeconds); x *= (float) convert.as(MTime::uiUnit());Arguments
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
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
Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. | doc++ Copyright |