kfcurve.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_KFCURVE_H_
00005 #define _FBXSDK_KFCURVE_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 1999 - 2007 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material
00013  (collectively the "Data") in these files contain unpublished information
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by
00015  Canada and United States of America federal copyright law and by international
00016  treaties.
00017 
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE,
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE.
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE.
00028 
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE.
00039 
00040 **************************************************************************************/
00041 #include <kfcurve/kfcurve_h.h>
00042 
00043 #include <klib/karrayul.h>
00044 #include <klib/ktime.h>
00045 #include <object/e/keventbase.h>
00046 
00047 
00048 #ifndef K_PLUGIN
00049     #include <object/i/iobject.h>
00050     #include <object/i/ifbobjectholder.h>
00051 #endif
00052 
00053 #ifndef K_PLUGIN
00054     #include <klib/kdebug.h>
00055 #endif
00056 
00057 #include <kbaselib_forward.h>
00058 #ifndef MB_FBXSDK
00059 #include <kbaselib_nsuse.h>
00060 #endif
00061 
00062 #ifdef K_PLUGIN
00063     #define KFCURVE_INLINE
00064 #else
00065     #define KFCURVE_INLINE inline
00066 #endif
00067 
00068 #include <kfcurve/kfcurve_nsbegin.h>
00069 
00070     #define KFCURVE_FLOAT
00071     #ifdef KFCURVE_FLOAT
00072         typedef float kFCurveDouble;
00073     #else
00074         typedef double kFCurveDouble;
00075     #endif
00076 
00077 
00078     K_FORWARD(KFCurve);
00079 
00080     #define IKFCurveID 43763635
00081 
00082     typedef HKFCurve HIKFCurve;
00083     typedef class KFCURVE_DLL KArrayTemplate< KFCurve * > KArrayKFCurve;
00084 
00085     // Recording memory functions declaration
00086     KFCURVE_DLL kULong GetRecordingMemory();
00087     KFCURVE_DLL void WatchFree(void* pPtr, kULong pSize);
00088     KFCURVE_DLL void* WatchMalloc(kULong pSize);
00089 
00091     enum
00092     {
00093         KFCURVE_INTERPOLATION_CONSTANT    = 0x00000002,     
00094         KFCURVE_INTERPOLATION_LINEAR      = 0x00000004,     
00095         KFCURVE_INTERPOLATION_CUBIC       = 0x00000008,     
00096         KFCURVE_INTERPOLATION_ALL         = KFCURVE_INTERPOLATION_CONSTANT|KFCURVE_INTERPOLATION_LINEAR|KFCURVE_INTERPOLATION_CUBIC,
00097         KFCURVE_INTERPOLATION_COUNT       = 3
00098     };                                                
00099 
00101     enum
00102     {
00103         KFCURVE_CONSTANT_STANDARD         = 0x00000000,
00104         KFCURVE_CONSTANT_NEXT             = 0x00000100,
00105         KFCURVE_CONSTANT_ALL              = KFCURVE_CONSTANT_STANDARD | KFCURVE_CONSTANT_NEXT,
00106         KFCURVE_CONSTANT_COUNT            = 2
00107     };
00108 
00110     enum
00111     {
00112         KFCURVE_TANGEANT_AUTO             = 0x00000100,     
00113         KFCURVE_TANGEANT_TCB              = 0x00000200,     
00114         KFCURVE_TANGEANT_USER             = 0x00000400,     
00115         KFCURVE_GENERIC_BREAK             = 0x00000800,     
00116     KFCURVE_GENERIC_CLAMP             = 0x00001000,     
00117         KFCURVE_TANGEANT_BREAK            = KFCURVE_TANGEANT_USER|KFCURVE_GENERIC_BREAK,
00118         KFCURVE_TANGEANT_AUTO_BREAK   = KFCURVE_TANGEANT_AUTO|KFCURVE_GENERIC_BREAK,
00119     KFCURVE_TANGEANT_ALL              = KFCURVE_TANGEANT_AUTO|KFCURVE_TANGEANT_TCB|KFCURVE_TANGEANT_USER|KFCURVE_GENERIC_BREAK|KFCURVE_GENERIC_CLAMP,
00120     KFCURVE_TANGEANT_TYPE_MASK        = KFCURVE_TANGEANT_AUTO|KFCURVE_TANGEANT_TCB|KFCURVE_TANGEANT_USER|KFCURVE_TANGEANT_BREAK, // Break is part of the modes for historic reasons, should be part of overrides
00121     KFCURVE_TANGEANT_OVERRIDES_MASK   = KFCURVE_GENERIC_CLAMP
00122     // KFCURVE_TANGEANT_COUNT             = 4
00123     };
00124 
00126     enum 
00127     {
00128         KFCURVE_SELECT_POINT              = 0x00010000, 
00129         KFCURVE_SELECT_LEFT               = 0x00020000, 
00130         KFCURVE_SELECT_RIGHT              = 0x00040000, 
00131         KFCURVE_SELECT_ALL                = KFCURVE_SELECT_POINT|KFCURVE_SELECT_LEFT|KFCURVE_SELECT_RIGHT
00132     };
00133 
00135     enum
00136     {
00137         KFCURVE_MARKED_FOR_MANIP          = 0x00080000,
00138         KFCURVE_MARKED_ALL                = KFCURVE_MARKED_FOR_MANIP
00139     };
00140 
00142     enum 
00143     {
00144         KFCURVE_TANGEANT_SHOW_NONE        = 0x00000000, 
00145         KFCURVE_TANGEANT_SHOW_LEFT        = 0x00100000, 
00146         KFCURVE_TANGEANT_SHOW_RIGHT       = 0x00200000, 
00147         KFCURVE_TANGEANT_SHOW_BOTH        = KFCURVE_TANGEANT_SHOW_LEFT|KFCURVE_TANGEANT_SHOW_RIGHT
00148     };
00149 
00151 enum
00152 {
00153     KFCURVE_CONTINUITY                = 0x00000000,
00154     KFCURVE_CONTINUITY_FLAT           = 0x00100000,
00155     KFCURVE_CONTINUITY_BREAK          = 0x00200000,
00156     KFCURVE_CONTINUITY_INSERT         = 0x00400000   // Used to prevent the curve shape from changing when inserting a key
00157 };
00158 
00160     enum 
00161     {
00162         KFCURVE_WEIGHTED_NONE             = 0x00000000, 
00163         KFCURVE_WEIGHTED_RIGHT            = 0x01000000, 
00164         KFCURVE_WEIGHTED_NEXT_LEFT        = 0x02000000, 
00165         KFCURVE_WEIGHTED_ALL              = KFCURVE_WEIGHTED_RIGHT|KFCURVE_WEIGHTED_NEXT_LEFT
00166     };
00167 
00168     // !Velocity mode
00169     enum
00170     {
00171         KFCURVE_VELOCITY_NONE             = 0x00000000,
00172         KFCURVE_VELOCITY_RIGHT            = 0x10000000,
00173         KFCURVE_VELOCITY_NEXT_LEFT        = 0x20000000,
00174         KFCURVE_VELOCITY_ALL              = KFCURVE_VELOCITY_RIGHT | KFCURVE_VELOCITY_NEXT_LEFT
00175     };
00176 
00177 
00178     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00179 
00180     #define KFCURVE_WEIGHT_DIVIDER       9999       // precise enough and can be divided by 3 without error
00181     #define KFCURVE_DEFAULT_WEIGHT       ((kFCurveDouble)(1.0/3.0))
00182     #define KFCURVE_MIN_WEIGHT           ((kFCurveDouble)(1.0/KFCURVE_WEIGHT_DIVIDER))
00183     #define KFCURVE_MAX_WEIGHT           ((kFCurveDouble)0.99)
00184     #define KFCURVE_DEFAULT_VELOCITY     0.0 
00185 
00186     #endif // DOXYGEN_SHOULD_SKIP_THIS
00187 
00188 
00190     enum EKFCurveDataIndex
00191     {
00192         // User and Break tangent mode (data are doubles).
00193         KFCURVEKEY_RIGHT_SLOPE          = 0, 
00194         KFCURVEKEY_NEXT_LEFT_SLOPE      = 1, 
00195 
00196         // User and Break tangent break mode (data are kInt16 thken from mwight and converted to doubles).
00197         KFCURVEKEY_WEIGHTS              = 2, 
00198         KFCURVEKEY_RIGHT_WEIGHT         = 2, 
00199         KFCURVEKEY_NEXT_LEFT_WEIGHT     = 3, 
00200 
00201         // Velocity mode
00202         KFCURVEKEY_VELOCITY             = 4,
00203         KFCURVEKEY_RIGHT_VELOCITY       = 4,
00204         KFCURVEKEY_NEXT_LEFT_VELOCITY   = 5, 
00205 
00206         // TCB tangent mode (data are floats).
00207         KFCURVEKEY_TCB_TENSION          = 0, 
00208         KFCURVEKEY_TCB_CONTINUITY       = 1, 
00209         KFCURVEKEY_TCB_BIAS             = 2,
00210 
00211         KFCURVEKEY_RIGHT_AUTO           = 0,
00212         KFCURVEKEY_NEXT_LEFT_AUTO       = 1
00213     };
00214 
00216     enum 
00217     {
00218         KFCURVE_EXTRAPOLATION_CONST             = 1, 
00219         KFCURVE_EXTRAPOLATION_REPETITION        = 2, 
00220         KFCURVE_EXTRAPOLATION_MIRROR_REPETITION = 3, 
00221         KFCURVE_EXTRAPOLATION_KEEP_SLOPE        = 4
00222     };
00223 
00224     enum 
00225     {
00226         KFCURVE_BEZIER  = 0, 
00227         KFCURVE_SAMPLE  = 1, 
00228         KFCURVE_ISO     = 2
00229     };
00230 
00231     typedef kUInt kFCurveInterpolation;
00232     typedef kUInt kFCurveConstantMode;
00233     typedef kUInt kFCurveTangeantMode;
00234     typedef kUInt kFCurveTangeantWeightMode;
00235     typedef kUInt kFCurveTangeantVelocityMode;
00236     typedef kUInt kFCurveExtrapolationMode;
00237     typedef kUInt kFCurveTangeantVisibility;
00238     typedef int kFCurveIndex;
00239 
00240     enum 
00241     {
00242         KFCURVEEVENT_NONE       =0, // default event value
00243         KFCURVEEVENT_CANDIDATE  =1 << 0, // curve value (not candidate) changed
00244         KFCURVEEVENT_UNUSED1    =1 << 1,
00245         KFCURVEEVENT_UNUSED2    =1 << 2,
00246         KFCURVEEVENT_UNUSED3    =1 << 3,
00247         KFCURVEEVENT_KEY        =1 << 4, // key changed (add, removed, edited); see bits 11-15 for precisions
00248         KFCURVEEVENT_DEPRECATED5 =1 << 5,
00249         KFCURVEEVENT_UNUSED6    =1 << 6,
00250         KFCURVEEVENT_UNUSED7    =1 << 7,
00251         KFCURVEEVENT_SELECTION  =1 << 8, // key selection changed
00252         KFCURVEEVENT_DESTROY    =1 << 9, // fcurve destruction
00253         KFCURVEEVENT_DEPRECATED10 =1 << 10,
00254         KFCURVEEVENT_KEYADD     =1 << 11,
00255         KFCURVEEVENT_KEYREMOVE  =1 << 12,
00256         KFCURVEEVENT_EDITVALUE  =1 << 13,
00257         KFCURVEEVENT_EDITTIME   =1 << 14,
00258         KFCURVEEVENT_EDITOTHER  =1 << 15,
00259     };
00260 
00261 
00262     // Curve event class.
00263     class KFCURVE_DLL KFCurveEvent : public KEventBase
00264     {
00265     public:
00266         // Curve event type, the enum stated above allow composition of type (bitfield). 
00267         // Stored in mType
00268 
00269         // Start key index.
00270         int mKeyIndexStart; 
00271 
00272         //  Stop key index.
00273         int mKeyIndexStop; 
00274 
00275         // Count of events.
00276         int mEventCount;
00277 
00278         // Clear curve event.
00279         KFCURVE_INLINE void Clear (); 
00280         
00281         // Add a curve event of type pWhat to a curve event object.
00282         KFCURVE_INLINE void Add (int pWhat, int pIndex);
00283     };
00284 
00285     typedef void (*kFCurveCallback) (KFCurve *pFCurve, KFCurveEvent *FCurveEvent, void* pObject);
00286 
00291     class KFCURVE_DLL KFCurveTangeantInfo 
00292     {
00293     public:
00294         KFCURVE_INLINE KFCurveTangeantInfo();
00295 
00296         kFCurveDouble mDerivative;
00297         kFCurveDouble mWeight;
00298         bool         mWeighted;
00299         kFCurveDouble mVelocity;
00300         bool          mHasVelocity;
00301         kFCurveDouble mAuto;  // The auto parameter!
00302     };
00303 
00313     class KFCURVE_DLL KFCurveKey 
00314     {
00315     public:
00316         KFCurveKey()
00317         {
00318             Init();
00319         }
00320 
00321     public:
00322         
00348         KFCURVE_INLINE void Set 
00349         (
00350             KTime pTime, 
00351             kFCurveDouble pValue, 
00352             kFCurveInterpolation pInterpolation = KFCURVE_INTERPOLATION_CUBIC, 
00353             kFCurveTangeantMode pTangentMode = KFCURVE_TANGEANT_AUTO, 
00354             kFCurveDouble pData0 = 0.0,
00355             kFCurveDouble pData1 = 0.0,
00356             kFCurveTangeantWeightMode pTangentWeightMode = KFCURVE_WEIGHTED_NONE, 
00357             kFCurveDouble pWeight0                             = KFCURVE_DEFAULT_WEIGHT,
00358             kFCurveDouble pWeight1                             = KFCURVE_DEFAULT_WEIGHT,
00359             kFCurveDouble pVelocity0 = KFCURVE_DEFAULT_VELOCITY,
00360             kFCurveDouble pVelocity1 = KFCURVE_DEFAULT_VELOCITY
00361         );
00362         
00370         KFCURVE_INLINE void SetTCB 
00371         (
00372             KTime pTime, 
00373             kFCurveDouble pValue, 
00374             float pData0 = 0.0f, 
00375             float pData1 = 0.0f, 
00376             float pData2 = 0.0f
00377         );
00378         
00382         KFCURVE_INLINE void Set(KFCurveKey& pSource);
00383         
00389         KFCURVE_INLINE kFCurveInterpolation GetInterpolation();
00390         
00397         KFCURVE_INLINE void SetInterpolation(kFCurveInterpolation pInterpolation);
00398 
00406         KFCURVE_INLINE kFCurveConstantMode GetConstantMode();
00407 
00418     KFCURVE_INLINE kFCurveTangeantMode GetTangeantMode( bool pIncludeOverrides = false );
00419 
00427         KFCURVE_INLINE kFCurveTangeantWeightMode GetTangeantWeightMode();
00428 
00436         KFCURVE_INLINE kFCurveTangeantVelocityMode GetTangeantVelocityMode();
00437 
00444         KFCURVE_INLINE void SetConstantMode(kFCurveConstantMode pMode);
00445 
00455         KFCURVE_INLINE void SetTangeantMode(kFCurveTangeantMode pTangent);
00456             
00470         KFCURVE_INLINE void SetTangeantWeightMode(kFCurveTangeantWeightMode pTangentWeightMode, kFCurveTangeantWeightMode pMask = KFCURVE_WEIGHTED_ALL );
00471 
00485         KFCURVE_INLINE void SetTangeantVelocityMode(kFCurveTangeantVelocityMode pTangentVelocityMode, kFCurveTangeantVelocityMode pMask = KFCURVE_VELOCITY_ALL );
00486 
00487             
00502         KFCURVE_INLINE kFCurveDouble GetDataDouble(EKFCurveDataIndex pIndex);
00503         
00519         KFCURVE_INLINE void SetDataDouble(EKFCurveDataIndex pIndex, kFCurveDouble pValue);
00520         
00526         KFCURVE_INLINE float GetDataFloat(EKFCurveDataIndex pIndex);
00527 
00534         KFCURVE_INLINE void SetDataFloat(EKFCurveDataIndex pIndex, float pValue);
00535 
00539         KFCURVE_INLINE float* GetDataPtr();
00540 
00542         KFCURVE_INLINE kFCurveDouble GetValue();
00543 
00545         KFCURVE_INLINE void SetValue(kFCurveDouble pValue);
00546 
00550         KFCURVE_INLINE void IncValue(kFCurveDouble pValue);
00551 
00555         KFCURVE_INLINE void MultValue(kFCurveDouble pValue);
00556 
00562         KFCURVE_INLINE void MultTangeant(kFCurveDouble pValue);
00563 
00567         KFCURVE_INLINE KTime GetTime();
00568 
00572         KFCURVE_INLINE void SetTime(KTime pTime);
00573 
00577         KFCURVE_INLINE void IncTime(KTime pTime);
00578 
00582         KFCURVE_INLINE void SetSelected(bool pSelected);    
00583 
00587         KFCURVE_INLINE bool GetSelected();
00588 
00592         KFCURVE_INLINE void SetMarkedForManipulation(bool pMark);   
00593 
00597         KFCURVE_INLINE bool GetMarkedForManipulation();
00598 
00606         KFCURVE_INLINE void SetTangeantVisibility (kFCurveTangeantVisibility pVisibility);  
00607         
00615         KFCURVE_INLINE kFCurveTangeantVisibility GetTangeantVisibility ();
00616 
00620         KFCURVE_INLINE void SetBreak(bool pVal); 
00621 
00625         KFCURVE_INLINE bool GetBreak(); 
00626 
00627 
00628 
00629 
00631     //
00632     //  WARNING!
00633     //
00634     //  Anything beyond these lines may not be documented accurately and is 
00635     //  subject to change without notice.
00636     //
00638 
00639         KFCURVE_INLINE void Init();
00640 
00641     #ifndef DOXYGEN_SHOULD_SKIP_THIS
00642 
00643     private:
00644 
00645         kFCurveDouble mValue;       
00646         KTime mTime;    
00647         kUInt mFlags;
00648 
00649     #ifdef KFCURVE_FLOAT
00650         float  mData[4];
00651     #else 
00652         double  mData[2];
00653         kInt16  mWeight[2];
00654         kInt16  mVelocity[2];
00655     #endif  
00656 
00657     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00658 
00659     };
00660 
00661 
00662     const int KEY_BLOCK_SIZE    = 1024;
00663     const int KEY_BLOCK_COUNT   = KEY_BLOCK_SIZE/sizeof (KFCurveKey);
00664 
00665     const int KEY_LIST_BLOCK_SIZE   = 256;
00666     const int KEY_LIST_BLOCK_COUNT  = KEY_LIST_BLOCK_SIZE/sizeof (KFCurveKey *);
00667 
00668 
00675     #ifdef K_PLUGIN
00676     class KFCURVE_DLL KFCurve
00677     #else 
00678     class KFCURVE_DLL KFCurve : public IFBObjectHolder
00679     #endif
00680     {
00681 
00682     public:
00683 
00688 
00690         KFCurve();
00691 
00693         virtual ~KFCurve();
00694 
00695         #ifdef K_PLUGIN
00696             void Destroy(int Local=0);
00697         #else
00698             IObject_Declare(Implementation)
00699         #endif
00700 
00702 
00706         float* GetColor();
00707         
00711         void SetColor(float *pColor);
00712 
00717         void SetValue(kFCurveDouble pValue);
00718 
00723         KFCURVE_INLINE kFCurveDouble GetValue() const;
00724 
00729 
00733         void ResizeKeyBuffer(int pKeyCount);
00734 
00739         void KeyModifyBegin ();
00740         
00744         void KeyModifyEnd ();
00745 
00755         K_DEPRECATED void KeyModifyBegin (int pKeyCount);
00756         
00764         K_DEPRECATED void KeyModifyEnd (int pKeyCount);
00765 
00767         int KeyGetCount ();
00768 
00770         int KeyGetSelectionCount ();
00771 
00772         // Select all keys.
00773         void KeySelectAll ();
00774         
00775         // Unselect all keys.
00776         void KeyUnselectAll ();
00777 
00782         KFCurveKey KeyGet(kFCurveIndex pIndex);
00783         
00790         K_DEPRECATED KFCURVE_INLINE KFCurveKey& KeyGetRaw(kFCurveIndex pIndex);
00791 
00800         K_DEPRECATED KFCURVE_INLINE KFCurveKey* KeyGetPtr(kFCurveIndex pIndex);     
00801 
00803         void KeyClear ();
00804         
00806         void KeyShrink();
00807 
00814         bool    KeySet(kFCurveIndex pIndex, KFCurveKey& pKey);
00815         KFCURVE_INLINE bool KeySet(kFCurveIndex pIndex, KFCurve* pSourceCurve, int pSourceIndex);
00816         
00824         int KeyMove(kFCurveIndex pIndex, KTime pTime);
00825         
00833         bool KeyMoveOf (bool pSelectedOnly, KTime pDeltaTime, kFCurveDouble pDeltaValue);
00834         
00841         bool KeyMoveValueTo (bool pSelectedOnly, kFCurveDouble pValue);
00842         
00849         bool KeyScaleValue (bool pSelectedOnly, kFCurveDouble pMultValue);
00850 
00857         bool KeyScaleTangeant (bool pSelectedOnly, kFCurveDouble pMultValue);
00858 
00865         bool KeyScaleValueAndTangeant (bool pSelectedOnly, kFCurveDouble pMultValue);
00866 
00871         bool KeyRemove(kFCurveIndex pIndex);
00872 
00888         int KeyInsert ( KTime pTime, kFCurveIndex* pLast = NULL );
00889 
00906         int KeyAdd (KTime pTime, KFCurveKey& pKey, kFCurveIndex* pLast = NULL);
00907         int KeyAdd(KTime pTime, KFCurve* pSourceCurve, int pSourceIndex, kFCurveIndex* pLast = NULL);
00908         
00923         int KeyAdd (KTime pTime, kFCurveIndex* pLast = NULL);
00924 
00932         int KeyAppend(KTime pAtTime, KFCurve* pSourceCurve, int pSourceIndex);
00933 
00943         int KeyAppendFast( KTime pTime, kFCurveDouble pValue );
00944         
00955         double KeyFind (KTime pTime, kFCurveIndex* pLast = NULL);   
00956 
00958 
00959         /************************************************************************************************/
00960         /************************************************************************************************/
00961         /************************************************************************************************/
00962         /************************************************************************************************/
00963         /************************************************************************************************/
00964         /************************************************************************************************/
00965 
00966 
00971 
00997         KFCURVE_INLINE void KeySet 
00998         (
00999             kFCurveIndex pKeyIndex,
01000             KTime pTime, 
01001             kFCurveDouble pValue, 
01002             kFCurveInterpolation pInterpolation = KFCURVE_INTERPOLATION_CUBIC, 
01003             kFCurveTangeantMode pTangentMode = KFCURVE_TANGEANT_AUTO, 
01004             kFCurveDouble pData0 = 0.0,
01005             kFCurveDouble pData1 = 0.0,
01006             kFCurveTangeantWeightMode pTangentWeightMode = KFCURVE_WEIGHTED_NONE, 
01007             kFCurveDouble pWeight0                             = KFCURVE_DEFAULT_WEIGHT,
01008             kFCurveDouble pWeight1                             = KFCURVE_DEFAULT_WEIGHT,
01009             kFCurveDouble pVelocity0 = KFCURVE_DEFAULT_VELOCITY,
01010             kFCurveDouble pVelocity1 = KFCURVE_DEFAULT_VELOCITY
01011         );
01012         
01020         KFCURVE_INLINE void KeySetTCB 
01021         (
01022             kFCurveIndex pKeyIndex,
01023             KTime pTime, 
01024             kFCurveDouble pValue, 
01025             float pData0 = 0.0f, 
01026             float pData1 = 0.0f, 
01027             float pData2 = 0.0f
01028         );
01029             
01035         KFCURVE_INLINE kFCurveInterpolation KeyGetInterpolation(kFCurveIndex pKeyIndex);
01036         
01043         KFCURVE_INLINE void KeySetInterpolation(kFCurveIndex pKeyIndex, kFCurveInterpolation pInterpolation);
01044 
01052         KFCURVE_INLINE kFCurveConstantMode KeyGetConstantMode(kFCurveIndex pKeyIndex);
01053 
01064     KFCURVE_INLINE kFCurveTangeantMode KeyGetTangeantMode(kFCurveIndex pKeyIndex, bool pIncludeOverrides = false );
01065 
01073         KFCURVE_INLINE kFCurveTangeantWeightMode KeyGetTangeantWeightMode(kFCurveIndex pKeyIndex);
01074 
01082         KFCURVE_INLINE kFCurveTangeantVelocityMode KeyGetTangeantVelocityMode(kFCurveIndex pKeyIndex);
01083 
01090         KFCURVE_INLINE void KeySetConstantMode(kFCurveIndex pKeyIndex, kFCurveConstantMode pMode);
01091 
01101         KFCURVE_INLINE void KeySetTangeantMode(kFCurveIndex pKeyIndex, kFCurveTangeantMode pTangent);
01102             
01116         KFCURVE_INLINE void KeySetTangeantWeightMode(kFCurveIndex pKeyIndex, kFCurveTangeantWeightMode pTangentWeightMode, kFCurveTangeantWeightMode pMask = KFCURVE_WEIGHTED_ALL );
01117 
01131         KFCURVE_INLINE void KeySetTangeantVelocityMode(kFCurveIndex pKeyIndex, kFCurveTangeantVelocityMode pTangentVelocityMode, kFCurveTangeantVelocityMode pMask = KFCURVE_VELOCITY_ALL );
01132 
01133             
01148         KFCURVE_INLINE kFCurveDouble KeyGetDataDouble(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex);
01149         
01165         KFCURVE_INLINE void KeySetDataDouble(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex, kFCurveDouble pValue);
01166         
01172         KFCURVE_INLINE float KeyGetDataFloat(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex);
01173 
01180         KFCURVE_INLINE void KeySetDataFloat(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex, float pValue);
01181 
01185         KFCURVE_INLINE const float* KeyGetDataPtr(kFCurveIndex pKeyIndex);
01186 
01188         KFCURVE_INLINE kFCurveDouble KeyGetValue(kFCurveIndex pKeyIndex);
01189 
01191         KFCURVE_INLINE void KeySetValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01192 
01196         KFCURVE_INLINE void KeyIncValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01197 
01201         KFCURVE_INLINE void KeyMultValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01202 
01208         KFCURVE_INLINE void KeyMultTangeant(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01209 
01213         KFCURVE_INLINE KTime KeyGetTime(kFCurveIndex pKeyIndex);
01214 
01218         KFCURVE_INLINE void KeySetTime(kFCurveIndex pKeyIndex, KTime pTime);
01219 
01223         KFCURVE_INLINE void KeyIncTime(kFCurveIndex pKeyIndex, KTime pTime);
01224 
01228         KFCURVE_INLINE void KeySetSelected(kFCurveIndex pKeyIndex, bool pSelected); 
01229 
01233         KFCURVE_INLINE bool KeyGetSelected(kFCurveIndex pKeyIndex);
01234 
01238         KFCURVE_INLINE void KeySetMarkedForManipulation(kFCurveIndex pKeyIndex, bool pMark);    
01239 
01243         KFCURVE_INLINE bool KeyGetMarkedForManipulation(kFCurveIndex pKeyIndex);
01244 
01252         KFCURVE_INLINE void KeySetTangeantVisibility (kFCurveIndex pKeyIndex, kFCurveTangeantVisibility pVisibility);   
01253         
01261         KFCURVE_INLINE kFCurveTangeantVisibility KeyGetTangeantVisibility (kFCurveIndex pKeyIndex);
01262 
01266         KFCURVE_INLINE void KeySetBreak(kFCurveIndex pKeyIndex, bool pVal); 
01267 
01271         KFCURVE_INLINE bool KeyGetBreak(kFCurveIndex pKeyIndex); 
01272 
01274 
01275         /************************************************************************************************/
01276         /************************************************************************************************/
01277         /************************************************************************************************/
01278         /************************************************************************************************/
01279         /************************************************************************************************/
01280         /************************************************************************************************/
01281 
01286 
01292         void KeyTangeantSetInterpolation(bool pSelectedOnly, kFCurveInterpolation pInterpolation);
01293         
01300         void KeyTangeantSetMode(bool pSelectedOnly, kFCurveTangeantMode pTangentMode);
01301         
01308         kFCurveDouble KeyGetLeftDerivative(kFCurveIndex pIndex);
01309         
01319         void KeySetLeftDerivative(kFCurveIndex pIndex, kFCurveDouble pValue);
01320 
01328     kFCurveDouble KeyGetLeftAuto(kFCurveIndex pIndex, bool pApplyOvershootProtection = false);
01329 
01339         void KeySetLeftAuto(kFCurveIndex pIndex, kFCurveDouble pValue); 
01340         
01347         KFCurveTangeantInfo KeyGetLeftDerivativeInfo(kFCurveIndex pIndex);
01348         
01359     void KeySetLeftDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false);
01360 
01361 
01371         void KeyIncLeftDerivative(kFCurveIndex pIndex, kFCurveDouble pInc);
01372         
01379         kFCurveDouble KeyGetRightDerivative(kFCurveIndex pIndex);
01380         
01390         void KeySetRightDerivative(kFCurveIndex pIndex, kFCurveDouble pValue);
01391 
01399     kFCurveDouble KeyGetRightAuto(kFCurveIndex pIndex, bool pApplyOvershootProtection = false);
01400         
01410         void KeySetRightAuto(kFCurveIndex pIndex, kFCurveDouble pValue);
01411         
01412         
01419         KFCurveTangeantInfo KeyGetRightDerivativeInfo(kFCurveIndex pIndex);
01420         
01430     void KeySetRightDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false);
01431 
01432 
01442         void KeyIncRightDerivative(kFCurveIndex pIndex, kFCurveDouble pInc);
01443         
01445         kFCurveDouble KeyGetRightBezierTangeant(kFCurveIndex pIndex);
01446         
01456         void KeySetLeftBezierTangeant(kFCurveIndex pIndex, kFCurveDouble pValue);
01457 
01459         kFCurveDouble KeyGetLeftBezierTangeant(kFCurveIndex pIndex);
01460         
01470         void KeySetRightBezierTangeant(kFCurveIndex pIndex, kFCurveDouble pValue);
01471 
01472 
01481         void KeyMultDerivative(kFCurveIndex pIndex, kFCurveDouble pMultValue);
01482 
01489         bool KeyIsLeftTangeantWeighted(kFCurveIndex pIndex);
01490 
01497         bool KeyIsRightTangeantWeighted(kFCurveIndex pIndex);
01498         
01506         void   KeySetLeftTangeantWeightedMode( kFCurveIndex pIndex, bool pWeighted );
01507 
01515         void   KeySetRightTangeantWeightedMode( kFCurveIndex pIndex, bool pWeighted );
01516 
01523         kFCurveDouble KeyGetLeftTangeantWeight(kFCurveIndex pIndex);
01524 
01531         kFCurveDouble KeyGetRightTangeantWeight(kFCurveIndex pIndex);
01532 
01541         void   KeySetLeftTangeantWeight( kFCurveIndex pIndex, kFCurveDouble pWeight );
01542 
01551         void   KeySetRightTangeantWeight( kFCurveIndex pIndex, kFCurveDouble pWeight );
01552 
01559         bool KeyIsLeftTangeantVelocity(kFCurveIndex pIndex);
01560 
01567         bool KeyIsRightTangeantVelocity(kFCurveIndex pIndex);
01568         
01576         void   KeySetLeftTangeantVelocityMode( kFCurveIndex pIndex, bool pVelocity );
01577 
01585         void   KeySetRightTangeantVelocityMode( kFCurveIndex pIndex, bool pVelocity);
01586 
01593         kFCurveDouble KeyGetLeftTangeantVelocity(kFCurveIndex pIndex);
01594 
01601         kFCurveDouble KeyGetRightTangeantVelocity(kFCurveIndex pIndex);
01602 
01611         void   KeySetLeftTangeantVelocity( kFCurveIndex pIndex, kFCurveDouble pVelocity );
01612 
01621         void   KeySetRightTangeantVelocity( kFCurveIndex pIndex, kFCurveDouble pVelocity );
01622         
01624 
01636 
01638         KFCURVE_INLINE void SetPreExtrapolation(kFCurveExtrapolationMode pExtrapolation);
01639             
01641         KFCURVE_INLINE kFCurveExtrapolationMode GetPreExtrapolation();
01642         
01647         KFCURVE_INLINE void SetPreExtrapolationCount(kULong pCount);
01648         
01653         KFCURVE_INLINE kULong GetPreExtrapolationCount();
01654         
01656         KFCURVE_INLINE void SetPostExtrapolation(kFCurveExtrapolationMode pExtrapolation);
01657         
01659         KFCURVE_INLINE kFCurveExtrapolationMode GetPostExtrapolation();
01660         
01665         KFCURVE_INLINE void SetPostExtrapolationCount(kULong pCount);
01666             
01671         KFCURVE_INLINE kULong GetPostExtrapolationCount();
01672 
01679         int KeyGetCountAll();
01680         
01692         double KeyFindAll(KTime pTime, kFCurveIndex* pLast = NULL);
01693 
01703         K_DEPRECATED KFCurveKey& KeyGetRawAll(kFCurveIndex pIndex);
01704         
01712         K_DEPRECATED KTime KeyGetTimeAll(kFCurveIndex pIndex);
01713         
01715 
01720         
01733         kFCurveDouble Evaluate (KTime pTime, kFCurveIndex* pLast = NULL);
01734 
01744         kFCurveDouble EvaluateIndex( double pIndex);
01745         
01754         kFCurveDouble EvaluateLeftDerivative (KTime pTime, kFCurveIndex* pLast = NULL);
01755         
01764         kFCurveDouble EvaluateRightDerivative (KTime pTime, kFCurveIndex* pLast = NULL);
01765 
01774         int FindPeaks(kFCurveIndex pLeftKeyIndex, KTime& pPeakTime1, KTime& pPeakTime2);
01775 
01784         int FindPeaks(kFCurveIndex pLeftKeyIndex, kFCurveDouble& pPeak1, kFCurveDouble& pPeak2);
01785 
01796         int FindPeaks(kFCurveIndex pLeftKeyIndex, KTime& pPeakTime1, kFCurveDouble& pPeak1, KTime& pPeakTime2, kFCurveDouble& pPeak2);
01797 
01808         K_DEPRECATED KTime KeyGetAverageRate(bool* pIsIso = NULL, KTime* pIsoPeriod = NULL, KTime* pMaxPeriod = NULL);
01809         
01815         void KeyGetPeriods(KTime& pAveragePeriod, KTime& pMinPeriod, KTime& pMaxPeriod);
01816         
01818 
01823 
01831         HKFCurve Copy(KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE);
01832 
01839         void CopyFrom(KFCurve& pSource, bool pWithKeys = true);
01840 
01848     void Replace(HKFCurve pSource, KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
01849 
01861     void ReplaceForQuaternion(HKFCurve pSource, KTime pStart, KTime pStop, kFCurveDouble pScaleStart, kFCurveDouble pScaleStop, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
01862 
01880     void ReplaceForEulerXYZ(HKFCurve pSource, KTime pStart, KTime pStop, kFCurveDouble pAddFromStart, kFCurveDouble pAddAfterStop, bool pValueSubOffsetAfterStart, bool pValueSubOffsetAfterStop, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );   
01881 
01894         void Insert(HKFCurve pSource, KTime pInsertTime, kFCurveDouble pFirstKeyLeftDerivative, bool pFirstKeyIsWeighted = false, kFCurveDouble pFirstKeyWeight = KFCURVE_DEFAULT_WEIGHT);
01895 
01905         void Insert(HKFCurve pSource, KTime pInsertTime, KFCurveTangeantInfo pFirstKeyLeftDerivative );
01906 
01916         bool Delete(kFCurveIndex pStartIndex , kFCurveIndex pStopIndex);                                    
01917         
01925         bool Delete (KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE);
01926 
01931         bool IsKeyInterpolationPureCubicAuto(kFCurveIndex pKeyIndex);
01932 
01933     #ifndef K_PLUGIN
01934 
01941         void ExtractKeysIndex( KArraykInt &pArray, int pMinIndex, int pMaxIndex, double pMinValue =  -K_DOUBLE_MAX, double pMaxValue =  K_DOUBLE_MAX);
01942     #endif
01943 
01945 
01947     //
01948     //  WARNING!
01949     //
01950     //  Anything beyond these lines may not be documented accurately and is 
01951     //  subject to change without notice.
01952     //
01954 
01955     #ifndef DOXYGEN_SHOULD_SKIP_THIS
01956 
01957         bool    FbxStore (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = true, bool pIsVersion5 = false );
01958         bool    FbxRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false );
01959         bool    FbxInternalRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false );
01960 
01961         double CandidateEvaluate (KTime pTime, kFCurveIndex* pLast = NULL);
01962         bool CandidateClear ();
01963         bool CandidateSet (KTime pTime, double pValue);
01964         bool IsCandidate ();
01965         double CandidateGet ();
01966         KTime CandidateGetTime ();
01967         
01968         bool CandidateKey
01969         (
01970             kFCurveIndex    *pLast              = NULL, 
01971             int pInterpolation = KFCURVE_INTERPOLATION_CUBIC, 
01972             int pTanMode = KFCURVE_TANGEANT_USER, 
01973         int pContinuity = KFCURVE_CONTINUITY,
01974             bool            pTangeantOverride   = true,
01975             KTime           pCandidateTime      = KTIME_INFINITE,
01976             double          pKeyIndexTolerance  = 0.0
01977         );
01978 
01979         bool NormalsSeemsToComeFromAPlot();
01980 
01981         void SetWasData (int pType);
01982         int GetWasData ();
01983         int GuessWasData (KTime* pStart = NULL, KTime* pStep = NULL);
01984 
01985         void KeyTangeantHide ();
01986 
01987         int GetUpdateId ();
01988         int GetValuesUpdateId ();
01989 
01990         void CallbackRegister (kFCurveCallback pCallback, void* pObject);
01991         void CallbackUnregister (kFCurveCallback pCallback, void* pObject);
01992         void CallbackEnable (bool pEnable);
01993         void CallbackClear ();
01994 
01995     private:
01996         void IncrementUpdateId(int pInc);
01997         void CallbackAddEvent (int pWhat, int pIndexStart);
01998 
01999         int MapIndexAll (int pIndex, int &pWhere);
02000         void InitBuffers (int pKeyCount);
02001 
02002         bool CheckCurve();
02003     void IsClamped( int pIndex, bool &pLeftClamped, bool &pRightClamped ); // Return true if the specified key is an auto clamp that is currently clamped
02004 
02005         float mColor[3];
02006 
02007         kFCurveDouble mValue;
02008 
02009         int mUpdateId;
02010         bool mCallbackEnable;
02011         bool mInternalCallbackEnable; // Internal use, to replace many callback by one
02012         int mKeyModifyGuard;
02013 
02014         KFCurveKey** mFCurveKeysList;
02015 
02016         int mFCurveKeyCount;    
02017         int mFCurveKeySize; 
02018         int mFCurveLastBlockIndex;  
02019 
02020 
02021         kUInt mPreExtrapolation;
02022         kULong mPreExtrapolationCount;
02023         kUInt mPostExtrapolation;
02024         kULong mPostExtrapolationCount;
02025 
02026         int mWasType;
02027 
02028         kFCurveIndex mLastSearchIndex;
02029 
02030         KTime mCandidateTime;
02031         kFCurveDouble mCandidateValue;
02032 
02033         KFCurveEvent mEvent;
02034         KArrayUL mCallbackFunctions;   // no delete on object must use array ul
02035         KArrayUL mCallbackObjects;     // no delete on object must use array ul
02036 
02037         // FBObjectHolder for FBSDK reference
02038         #ifndef K_PLUGIN
02039             KFBObjectHolder mFBObjectHolder;
02040             KFCURVE_INLINE KFBObjectHolder& GetFBHolder ();
02041         #endif
02042 
02043         KFCURVE_INLINE KFCurveKey* InternalKeyGetPtr(kFCurveIndex pIndex);
02044 
02045     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
02046 
02047     };
02048 
02049 
02050     #ifndef K_PLUGIN
02051         #include <kfcurve/kfcurveinline.h>
02052     #endif
02053 
02054 
02057     KFCURVE_DLL HKFCurve KFCurveCreate();
02058 
02059     // Create a function curve, FBX SDK internal use only.
02060     KFCURVE_DLL HKFCurve KFCurveCreate(KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false);
02061 
02062     // Create a function curve, FBX SDK internal use only.
02063     KFCURVE_DLL HKFCurve KFCurveCreate(KFbx* pFbx, HKFCurve pCurve, bool pOnlyDefaults = false, bool pColor = false);
02064 
02065 #include <kfcurve/kfcurve_nsend.h>
02066 
02067 
02068 #endif // #ifndef _FBXSDK_KFCURVE_H_
02069 
02070