FBX SDK Reference Guide: kfcurve.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_KFCURVE_H_
00005 #define _FBXSDK_KFCURVE_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright  2001 - 2008 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 
00747         int KeyGetCount ();
00748 
00750         int KeyGetSelectionCount ();
00751 
00752         // Select all keys.
00753         void KeySelectAll ();
00754         
00755         // Unselect all keys.
00756         void KeyUnselectAll ();
00757 
00762         KFCurveKey KeyGet(kFCurveIndex pIndex);
00763         
00765         void KeyClear ();
00766         
00768         void KeyShrink();
00769 
00776         bool    KeySet(kFCurveIndex pIndex, KFCurveKey& pKey);
00777         KFCURVE_INLINE bool KeySet(kFCurveIndex pIndex, KFCurve* pSourceCurve, int pSourceIndex);
00778         
00786         int KeyMove(kFCurveIndex pIndex, KTime pTime);
00787         
00795         bool KeyMoveOf (bool pSelectedOnly, KTime pDeltaTime, kFCurveDouble pDeltaValue);
00796         
00803         bool KeyMoveValueTo (bool pSelectedOnly, kFCurveDouble pValue);
00804         
00811         bool KeyScaleValue (bool pSelectedOnly, kFCurveDouble pMultValue);
00812 
00819         bool KeyScaleTangeant (bool pSelectedOnly, kFCurveDouble pMultValue);
00820 
00827         bool KeyScaleValueAndTangeant (bool pSelectedOnly, kFCurveDouble pMultValue);
00828 
00833         bool KeyRemove(kFCurveIndex pIndex);
00834 
00850         int KeyInsert ( KTime pTime, kFCurveIndex* pLast = NULL );
00851 
00868         int KeyAdd (KTime pTime, KFCurveKey& pKey, kFCurveIndex* pLast = NULL);
00869         int KeyAdd(KTime pTime, KFCurve* pSourceCurve, int pSourceIndex, kFCurveIndex* pLast = NULL);
00870         
00885         int KeyAdd (KTime pTime, kFCurveIndex* pLast = NULL);
00886 
00894         int KeyAppend(KTime pAtTime, KFCurve* pSourceCurve, int pSourceIndex);
00895 
00905         int KeyAppendFast( KTime pTime, kFCurveDouble pValue );
00906         
00917         double KeyFind (KTime pTime, kFCurveIndex* pLast = NULL);   
00918 
00920 
00921         /************************************************************************************************/
00922         /************************************************************************************************/
00923         /************************************************************************************************/
00924         /************************************************************************************************/
00925         /************************************************************************************************/
00926         /************************************************************************************************/
00927 
00928 
00933 
00960         KFCURVE_INLINE void KeySet 
00961         (
00962             kFCurveIndex pKeyIndex,
00963             KTime pTime, 
00964             kFCurveDouble pValue, 
00965             kFCurveInterpolation pInterpolation = KFCURVE_INTERPOLATION_CUBIC, 
00966             kFCurveTangeantMode pTangentMode = KFCURVE_TANGEANT_AUTO, 
00967             kFCurveDouble pData0 = 0.0,
00968             kFCurveDouble pData1 = 0.0,
00969             kFCurveTangeantWeightMode pTangentWeightMode = KFCURVE_WEIGHTED_NONE, 
00970             kFCurveDouble pWeight0                             = KFCURVE_DEFAULT_WEIGHT,
00971             kFCurveDouble pWeight1                             = KFCURVE_DEFAULT_WEIGHT,
00972             kFCurveDouble pVelocity0 = KFCURVE_DEFAULT_VELOCITY,
00973             kFCurveDouble pVelocity1 = KFCURVE_DEFAULT_VELOCITY
00974         );
00975         
00984         KFCURVE_INLINE void KeySetTCB 
00985         (
00986             kFCurveIndex pKeyIndex,
00987             KTime pTime, 
00988             kFCurveDouble pValue, 
00989             float pData0 = 0.0f, 
00990             float pData1 = 0.0f, 
00991             float pData2 = 0.0f
00992         );
00993             
01001         KFCURVE_INLINE kFCurveInterpolation KeyGetInterpolation(kFCurveIndex pKeyIndex);
01002         
01010         KFCURVE_INLINE void KeySetInterpolation(kFCurveIndex pKeyIndex, kFCurveInterpolation pInterpolation);
01011 
01020         KFCURVE_INLINE kFCurveConstantMode KeyGetConstantMode(kFCurveIndex pKeyIndex);
01021 
01032     KFCURVE_INLINE kFCurveTangeantMode KeyGetTangeantMode(kFCurveIndex pKeyIndex, bool pIncludeOverrides = false );
01033 
01041         KFCURVE_INLINE kFCurveTangeantWeightMode KeyGetTangeantWeightMode(kFCurveIndex pKeyIndex);
01042 
01050         KFCURVE_INLINE kFCurveTangeantVelocityMode KeyGetTangeantVelocityMode(kFCurveIndex pKeyIndex);
01051 
01059         KFCURVE_INLINE void KeySetConstantMode(kFCurveIndex pKeyIndex, kFCurveConstantMode pMode);
01060 
01071         KFCURVE_INLINE void KeySetTangeantMode(kFCurveIndex pKeyIndex, kFCurveTangeantMode pTangent);
01072             
01087         KFCURVE_INLINE void KeySetTangeantWeightMode(kFCurveIndex pKeyIndex, kFCurveTangeantWeightMode pTangentWeightMode, kFCurveTangeantWeightMode pMask = KFCURVE_WEIGHTED_ALL );
01088 
01103         KFCURVE_INLINE void KeySetTangeantVelocityMode(kFCurveIndex pKeyIndex, kFCurveTangeantVelocityMode pTangentVelocityMode, kFCurveTangeantVelocityMode pMask = KFCURVE_VELOCITY_ALL );
01104 
01105             
01121         KFCURVE_INLINE kFCurveDouble KeyGetDataDouble(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex);
01122         
01139         KFCURVE_INLINE void KeySetDataDouble(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex, kFCurveDouble pValue);
01140         
01147         KFCURVE_INLINE float KeyGetDataFloat(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex);
01148 
01156         KFCURVE_INLINE void KeySetDataFloat(kFCurveIndex pKeyIndex, EKFCurveDataIndex pIndex, float pValue);
01157 
01161         KFCURVE_INLINE const float* KeyGetDataPtr(kFCurveIndex pKeyIndex);
01162 
01164         KFCURVE_INLINE kFCurveDouble KeyGetValue(kFCurveIndex pKeyIndex);
01165 
01167         KFCURVE_INLINE void KeySetValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01168 
01173         KFCURVE_INLINE void KeyIncValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01174 
01179         KFCURVE_INLINE void KeyMultValue(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01180 
01187         KFCURVE_INLINE void KeyMultTangeant(kFCurveIndex pKeyIndex, kFCurveDouble pValue);
01188 
01193         KFCURVE_INLINE KTime KeyGetTime(kFCurveIndex pKeyIndex);
01194 
01199         KFCURVE_INLINE void KeySetTime(kFCurveIndex pKeyIndex, KTime pTime);
01200 
01205         KFCURVE_INLINE void KeyIncTime(kFCurveIndex pKeyIndex, KTime pTime);
01206 
01211         KFCURVE_INLINE void KeySetSelected(kFCurveIndex pKeyIndex, bool pSelected); 
01212 
01216         KFCURVE_INLINE bool KeyGetSelected(kFCurveIndex pKeyIndex);
01217 
01222         KFCURVE_INLINE void KeySetMarkedForManipulation(kFCurveIndex pKeyIndex, bool pMark);    
01223 
01227         KFCURVE_INLINE bool KeyGetMarkedForManipulation(kFCurveIndex pKeyIndex);
01228 
01237         KFCURVE_INLINE void KeySetTangeantVisibility (kFCurveIndex pKeyIndex, kFCurveTangeantVisibility pVisibility);   
01238         
01246         KFCURVE_INLINE kFCurveTangeantVisibility KeyGetTangeantVisibility (kFCurveIndex pKeyIndex);
01247 
01251         KFCURVE_INLINE void KeySetBreak(kFCurveIndex pKeyIndex, bool pVal); 
01252 
01256         KFCURVE_INLINE bool KeyGetBreak(kFCurveIndex pKeyIndex); 
01257 
01259 
01260         /************************************************************************************************/
01261         /************************************************************************************************/
01262         /************************************************************************************************/
01263         /************************************************************************************************/
01264         /************************************************************************************************/
01265         /************************************************************************************************/
01266 
01271 
01277         void KeyTangeantSetInterpolation(bool pSelectedOnly, kFCurveInterpolation pInterpolation);
01278         
01285         void KeyTangeantSetMode(bool pSelectedOnly, kFCurveTangeantMode pTangentMode);
01286         
01293         kFCurveDouble KeyGetLeftDerivative(kFCurveIndex pIndex);
01294         
01304         void KeySetLeftDerivative(kFCurveIndex pIndex, kFCurveDouble pValue);
01305 
01313     kFCurveDouble KeyGetLeftAuto(kFCurveIndex pIndex, bool pApplyOvershootProtection = false);
01314 
01324         void KeySetLeftAuto(kFCurveIndex pIndex, kFCurveDouble pValue); 
01325         
01332         KFCurveTangeantInfo KeyGetLeftDerivativeInfo(kFCurveIndex pIndex);
01333         
01345     void KeySetLeftDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false);
01346 
01347 
01357         void KeyIncLeftDerivative(kFCurveIndex pIndex, kFCurveDouble pInc);
01358         
01365         kFCurveDouble KeyGetRightDerivative(kFCurveIndex pIndex);
01366         
01376         void KeySetRightDerivative(kFCurveIndex pIndex, kFCurveDouble pValue);
01377 
01385     kFCurveDouble KeyGetRightAuto(kFCurveIndex pIndex, bool pApplyOvershootProtection = false);
01386         
01396         void KeySetRightAuto(kFCurveIndex pIndex, kFCurveDouble pValue);
01397         
01398         
01405         KFCurveTangeantInfo KeyGetRightDerivativeInfo(kFCurveIndex pIndex);
01406         
01417     void KeySetRightDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false);
01418 
01419 
01429         void KeyIncRightDerivative(kFCurveIndex pIndex, kFCurveDouble pInc);
01430         
01432         kFCurveDouble KeyGetRightBezierTangeant(kFCurveIndex pIndex);
01433         
01443         void KeySetLeftBezierTangeant(kFCurveIndex pIndex, kFCurveDouble pValue);
01444 
01446         kFCurveDouble KeyGetLeftBezierTangeant(kFCurveIndex pIndex);
01447         
01457         void KeySetRightBezierTangeant(kFCurveIndex pIndex, kFCurveDouble pValue);
01458 
01459 
01468         void KeyMultDerivative(kFCurveIndex pIndex, kFCurveDouble pMultValue);
01469 
01476         bool KeyIsLeftTangeantWeighted(kFCurveIndex pIndex);
01477 
01484         bool KeyIsRightTangeantWeighted(kFCurveIndex pIndex);
01485         
01493         void   KeySetLeftTangeantWeightedMode( kFCurveIndex pIndex, bool pWeighted );
01494 
01502         void   KeySetRightTangeantWeightedMode( kFCurveIndex pIndex, bool pWeighted );
01503 
01510         kFCurveDouble KeyGetLeftTangeantWeight(kFCurveIndex pIndex);
01511 
01518         kFCurveDouble KeyGetRightTangeantWeight(kFCurveIndex pIndex);
01519 
01528         void   KeySetLeftTangeantWeight( kFCurveIndex pIndex, kFCurveDouble pWeight );
01529 
01538         void   KeySetRightTangeantWeight( kFCurveIndex pIndex, kFCurveDouble pWeight );
01539 
01546         bool KeyIsLeftTangeantVelocity(kFCurveIndex pIndex);
01547 
01554         bool KeyIsRightTangeantVelocity(kFCurveIndex pIndex);
01555         
01563         void   KeySetLeftTangeantVelocityMode( kFCurveIndex pIndex, bool pVelocity );
01564 
01572         void   KeySetRightTangeantVelocityMode( kFCurveIndex pIndex, bool pVelocity);
01573 
01580         kFCurveDouble KeyGetLeftTangeantVelocity(kFCurveIndex pIndex);
01581 
01588         kFCurveDouble KeyGetRightTangeantVelocity(kFCurveIndex pIndex);
01589 
01598         void   KeySetLeftTangeantVelocity( kFCurveIndex pIndex, kFCurveDouble pVelocity );
01599 
01608         void   KeySetRightTangeantVelocity( kFCurveIndex pIndex, kFCurveDouble pVelocity );
01609         
01611 
01623 
01625         KFCURVE_INLINE void SetPreExtrapolation(kFCurveExtrapolationMode pExtrapolation);
01626             
01628         KFCURVE_INLINE kFCurveExtrapolationMode GetPreExtrapolation();
01629         
01634         KFCURVE_INLINE void SetPreExtrapolationCount(kULong pCount);
01635         
01640         KFCURVE_INLINE kULong GetPreExtrapolationCount();
01641         
01643         KFCURVE_INLINE void SetPostExtrapolation(kFCurveExtrapolationMode pExtrapolation);
01644         
01646         KFCURVE_INLINE kFCurveExtrapolationMode GetPostExtrapolation();
01647         
01652         KFCURVE_INLINE void SetPostExtrapolationCount(kULong pCount);
01653             
01658         KFCURVE_INLINE kULong GetPostExtrapolationCount();
01659 
01666         int KeyGetCountAll();
01667         
01679         double KeyFindAll(KTime pTime, kFCurveIndex* pLast = NULL);
01680 
01682 
01687         
01700         kFCurveDouble Evaluate (KTime pTime, kFCurveIndex* pLast = NULL);
01701 
01711         kFCurveDouble EvaluateIndex( double pIndex);
01712         
01721         kFCurveDouble EvaluateLeftDerivative (KTime pTime, kFCurveIndex* pLast = NULL);
01722         
01731         kFCurveDouble EvaluateRightDerivative (KTime pTime, kFCurveIndex* pLast = NULL);
01732 
01741         int FindPeaks(kFCurveIndex pLeftKeyIndex, KTime& pPeakTime1, KTime& pPeakTime2);
01742 
01751         int FindPeaks(kFCurveIndex pLeftKeyIndex, kFCurveDouble& pPeak1, kFCurveDouble& pPeak2);
01752 
01763         int FindPeaks(kFCurveIndex pLeftKeyIndex, KTime& pPeakTime1, kFCurveDouble& pPeak1, KTime& pPeakTime2, kFCurveDouble& pPeak2);
01764 
01770         void KeyGetPeriods(KTime& pAveragePeriod, KTime& pMinPeriod, KTime& pMaxPeriod);
01771         
01773 
01778 
01786         HKFCurve Copy(KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE);
01787 
01794         void CopyFrom(KFCurve& pSource, bool pWithKeys = true);
01795 
01804     void Replace(HKFCurve pSource, KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
01805 
01818     void ReplaceForQuaternion(HKFCurve pSource, KTime pStart, KTime pStop, kFCurveDouble pScaleStart, kFCurveDouble pScaleStop, bool pUseExactGivenSpan = false, bool pKeyStartEndOnNoKey = true, KTime pTimeSpanOffset = KTIME_ZERO );
01819 
01838     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 );   
01839 
01852         void Insert(HKFCurve pSource, KTime pInsertTime, kFCurveDouble pFirstKeyLeftDerivative, bool pFirstKeyIsWeighted = false, kFCurveDouble pFirstKeyWeight = KFCURVE_DEFAULT_WEIGHT);
01853 
01863         void Insert(HKFCurve pSource, KTime pInsertTime, KFCurveTangeantInfo pFirstKeyLeftDerivative );
01864 
01874         bool Delete(kFCurveIndex pStartIndex , kFCurveIndex pStopIndex);                                    
01875         
01883         bool Delete (KTime pStart = KTIME_MINUS_INFINITE, KTime pStop = KTIME_INFINITE);
01884 
01889         bool IsKeyInterpolationPureCubicAuto(kFCurveIndex pKeyIndex);
01890 
01891     #ifndef K_PLUGIN
01892 
01899         void ExtractKeysIndex( KArraykInt &pArray, int pMinIndex, int pMaxIndex, double pMinValue =  -K_DOUBLE_MAX, double pMaxValue =  K_DOUBLE_MAX);
01900     #endif
01901 
01903 
01905     //
01906     //  WARNING!
01907     //
01908     //  Anything beyond these lines may not be documented accurately and is 
01909     //  subject to change without notice.
01910     //
01912 
01913     #ifndef DOXYGEN_SHOULD_SKIP_THIS
01914 
01915         bool    FbxStore (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = true, bool pIsVersion5 = false );
01916         bool    FbxRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false );
01917         bool    FbxInternalRetrieve (KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false );
01918 
01919         double CandidateEvaluate (KTime pTime, kFCurveIndex* pLast = NULL);
01920         bool CandidateClear ();
01921         bool CandidateSet (KTime pTime, double pValue);
01922         bool IsCandidate ();
01923         double CandidateGet ();
01924         KTime CandidateGetTime ();
01925         
01926         bool CandidateKey
01927         (
01928             kFCurveIndex    *pLast              = NULL, 
01929             int pInterpolation = KFCURVE_INTERPOLATION_CUBIC, 
01930             int pTanMode = KFCURVE_TANGEANT_USER, 
01931         int pContinuity = KFCURVE_CONTINUITY,
01932             bool            pTangeantOverride   = true,
01933             KTime           pCandidateTime      = KTIME_INFINITE,
01934             double          pKeyIndexTolerance  = 0.0
01935         );
01936 
01937         bool NormalsSeemsToComeFromAPlot();
01938 
01939         void SetWasData (int pType);
01940         int GetWasData ();
01941         int GuessWasData (KTime* pStart = NULL, KTime* pStep = NULL);
01942 
01943         void KeyTangeantHide ();
01944 
01945         int GetUpdateId ();
01946         int GetValuesUpdateId ();
01947 
01948         void CallbackRegister (kFCurveCallback pCallback, void* pObject);
01949         void CallbackUnregister (kFCurveCallback pCallback, void* pObject);
01950         void CallbackEnable (bool pEnable);
01951         void CallbackClear ();
01952 
01953     private:
01954         void IncrementUpdateId(int pInc);
01955         void CallbackAddEvent (int pWhat, int pIndexStart);
01956 
01957         int MapIndexAll (int pIndex, int &pWhere);
01958         void InitBuffers (int pKeyCount);
01959 
01960         bool CheckCurve();
01961     void IsClamped( int pIndex, bool &pLeftClamped, bool &pRightClamped ); // Return true if the specified key is an auto clamp that is currently clamped
01962 
01963         float mColor[3];
01964 
01965         kFCurveDouble mValue;
01966 
01967         int mUpdateId;
01968         bool mCallbackEnable;
01969         bool mInternalCallbackEnable; // Internal use, to replace many callback by one
01970         int mKeyModifyGuard;
01971 
01972         KFCurveKey** mFCurveKeysList;
01973 
01974         int mFCurveKeyCount;    
01975         int mFCurveKeySize; 
01976         int mFCurveLastBlockIndex;  
01977 
01978 
01979         kUInt mPreExtrapolation;
01980         kULong mPreExtrapolationCount;
01981         kUInt mPostExtrapolation;
01982         kULong mPostExtrapolationCount;
01983 
01984         int mWasType;
01985 
01986         kFCurveIndex mLastSearchIndex;
01987 
01988         KTime mCandidateTime;
01989         kFCurveDouble mCandidateValue;
01990 
01991         KFCurveEvent mEvent;
01992         KArrayUL mCallbackFunctions;   // no delete on object must use array ul
01993         KArrayUL mCallbackObjects;     // no delete on object must use array ul
01994 
01995         // FBObjectHolder for FBSDK reference
01996         #ifndef K_PLUGIN
01997             KFBObjectHolder mFBObjectHolder;
01998             KFCURVE_INLINE KFBObjectHolder& GetFBHolder ();
01999         #endif
02000 
02001         KFCURVE_INLINE KFCurveKey* InternalKeyGetPtr(kFCurveIndex pIndex);
02002 
02003     #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
02004 
02005     };
02006 
02007 
02008     #ifndef K_PLUGIN
02009         #include <kfcurve/kfcurveinline.h>
02010     #endif
02011 
02012 
02015     KFCURVE_DLL HKFCurve KFCurveCreate();
02016 
02017     // Create a function curve, FBX SDK internal use only.
02018     KFCURVE_DLL HKFCurve KFCurveCreate(KFbx* pFbx, bool pOnlyDefaults = false, bool pColor = false);
02019 
02020     // Create a function curve, FBX SDK internal use only.
02021     KFCURVE_DLL HKFCurve KFCurveCreate(KFbx* pFbx, HKFCurve pCurve, bool pOnlyDefaults = false, bool pColor = false);
02022 
02023 #include <kfcurve/kfcurve_nsend.h>
02024 
02025 
02026 #endif // #ifndef _FBXSDK_KFCURVE_H_
02027 
02028