00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVE_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVE_H
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include <fbxfilesdk/components/kfcurve/kfcurve.h>
00043 #include <fbxfilesdk/kfbxplugins/kfbxanimcurvebase.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00045
00046 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00047
00056 class KFbxAnimCurveDef {
00057
00058 public:
00059 static const int kWEIGHT_DIVIDER = 9999;
00060 static const float kDEFAULT_WEIGHT;
00061 static const float kMIN_WEIGHT;
00062 static const float kMAX_WEIGHT;
00063 static const float kDEFAULT_VELOCITY;
00064
00074 typedef enum {
00075 eTANGENT_AUTO = KFCURVE_TANGEANT_AUTO,
00076 eTANGENT_TCB = KFCURVE_TANGEANT_TCB,
00077 eTANGENT_USER = KFCURVE_TANGEANT_USER,
00078 eTANGENT_BREAK = KFCURVE_TANGEANT_BREAK,
00079 eTANGENT_AUTO_BREAK = KFCURVE_TANGEANT_AUTO_BREAK,
00080 eTANGENT_GENERIC_CLAMP = KFCURVE_GENERIC_CLAMP,
00081 eTANGENT_GENERIC_TIME_INDEPENDENT = KFCURVE_GENERIC_TIME_INDEPENDENT
00082
00083 } ETangentMode;
00084
00091 typedef enum {
00092 eINTERPOLATION_CONSTANT = KFCURVE_INTERPOLATION_CONSTANT,
00093 eINTERPOLATION_LINEAR = KFCURVE_INTERPOLATION_LINEAR,
00094 eINTERPOLATION_CUBIC = KFCURVE_INTERPOLATION_CUBIC,
00095 eINTERPOLATION_ALL = KFCURVE_INTERPOLATION_ALL
00096 } EInterpolationType;
00097
00104 typedef enum {
00105 eWEIGHTED_NONE = KFCURVE_WEIGHTED_NONE,
00106 eWEIGHTED_RIGHT = KFCURVE_WEIGHTED_RIGHT,
00107 eWEIGHTED_NEXT_LEFT = KFCURVE_WEIGHTED_NEXT_LEFT,
00108 eWEIGHTED_ALL = KFCURVE_WEIGHTED_ALL
00109 } EWeightedMode;
00110
00116 typedef enum {
00117 eCONSTANT_STANDARD = KFCURVE_CONSTANT_STANDARD,
00118 eCONSTANT_NEXT = KFCURVE_CONSTANT_NEXT,
00119 eCONSTANT_ALL = KFCURVE_CONSTANT_ALL
00120 } EConstantMode;
00121
00122 typedef enum {
00123 eVELOCITY_NONE = KFCURVE_VELOCITY_NONE,
00124 eVELOCITY_RIGHT = KFCURVE_VELOCITY_RIGHT,
00125 eVELOCITY_NEXT_LEFT = KFCURVE_VELOCITY_NEXT_LEFT,
00126 eVELOCITY_ALL = KFCURVE_VELOCITY_ALL
00127 } EVelocityMode;
00128
00129 typedef enum {
00130 eTANGENT_SHOW_NONE = KFCURVE_TANGEANT_SHOW_NONE,
00131 eTANGENT_SHOW_LEFT = KFCURVE_TANGEANT_SHOW_LEFT,
00132 eTANGENT_SHOW_RIGHT = KFCURVE_TANGEANT_SHOW_RIGHT,
00133 eTANGENT_SHOW_BOTH = KFCURVE_TANGEANT_SHOW_BOTH
00134 } ETangentVisibility;
00135
00136 typedef enum {
00137
00138 eRIGHT_SLOPE = KFCURVEKEY_RIGHT_SLOPE,
00139 eNEXT_LEFT_SLOPE = KFCURVEKEY_NEXT_LEFT_SLOPE,
00140
00141
00142 eWEIGHTS = KFCURVEKEY_WEIGHTS,
00143 eRIGHT_WEIGHT = KFCURVEKEY_RIGHT_WEIGHT,
00144 eNEXT_LEFT_WEIGHT = KFCURVEKEY_NEXT_LEFT_WEIGHT,
00145
00146
00147 eVELOCITY = KFCURVEKEY_VELOCITY,
00148 eRIGHT_VELOCITY = KFCURVEKEY_RIGHT_VELOCITY,
00149 eNEXT_LEFT_VELOCITY = KFCURVEKEY_NEXT_LEFT_VELOCITY,
00150
00151
00152 eTCB_TENSION = KFCURVEKEY_TCB_TENSION,
00153 eTCB_CONTINUITY = KFCURVEKEY_TCB_CONTINUITY,
00154 eTCB_BIAS = KFCURVEKEY_TCB_BIAS,
00155
00156 } EKFbxAnimCurveDataIndex;
00157 };
00158
00165 class KFBX_DLL KFbxAnimCurveKeyImpl
00166 {
00167 public:
00170 virtual ~KFbxAnimCurveKeyImpl() {};
00171
00174 virtual KFbxAnimCurveKeyImpl& operator=(const KFbxAnimCurveKeyImpl& pFKey) = 0;
00175
00180 virtual void Set(KTime pTime, float pValue) = 0;
00181
00189 virtual void SetTCB(KTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0;
00190
00194 virtual float GetValue() const = 0;
00195
00199 virtual void SetValue(float pValue) = 0;
00200
00204 virtual KFbxAnimCurveDef::EInterpolationType GetInterpolation() const = 0;
00205
00209 virtual void SetInterpolation (KFbxAnimCurveDef::EInterpolationType pInterpolation) = 0;
00210
00214 virtual KFbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false) const = 0;
00215
00219 virtual void SetTangentMode (KFbxAnimCurveDef::ETangentMode pTangentMode) = 0;
00220
00228 virtual KFbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const = 0;
00229
00242 virtual void SetTangentWeightMode(KFbxAnimCurveDef::EWeightedMode pTangentWeightMode, KFbxAnimCurveDef::EWeightedMode pMask = KFbxAnimCurveDef::eWEIGHTED_ALL ) = 0;
00243
00251 virtual KFbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const = 0;
00252
00265 virtual void SetTangentVelocityMode(KFbxAnimCurveDef::EVelocityMode pTangentVelocityMode, KFbxAnimCurveDef::EVelocityMode pMask = KFbxAnimCurveDef::eVELOCITY_ALL ) = 0;
00266
00274 virtual KFbxAnimCurveDef::EConstantMode GetConstantMode() const = 0;
00275
00279 virtual void SetConstantMode(KFbxAnimCurveDef::EConstantMode pMode) = 0;
00280
00285 virtual float GetDataFloat(KFbxAnimCurveDef::EKFbxAnimCurveDataIndex pIndex) const = 0;
00286
00291 virtual void SetDataFloat(KFbxAnimCurveDef::EKFbxAnimCurveDataIndex pIndex, float pValue) = 0;
00292
00300 virtual void SetTangentVisibility (KFbxAnimCurveDef::ETangentVisibility pVisibility) = 0;
00301
00309 virtual KFbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const = 0;
00310
00315 virtual void SetBreak(bool pVal) = 0;
00316
00320 virtual bool GetBreak() const = 0;
00321 };
00322
00323 class KFBX_DLL KFbxAnimCurveKey : public KFbxAnimCurveKeyBase
00324 {
00325
00326 public:
00327
00330 KFbxAnimCurveKey() : KFbxAnimCurveKeyBase()
00331 {
00332 K_ASSERT(mAllocatorFct != NULL);
00333 mImpl = (*mAllocatorFct)();
00334 }
00335
00339 KFbxAnimCurveKey(KTime pTime) : KFbxAnimCurveKeyBase()
00340 {
00341 K_ASSERT(mAllocatorFct != NULL);
00342 mImpl = (*mAllocatorFct)();
00343 SetTime(pTime);
00344 }
00345
00350 KFbxAnimCurveKey(KTime pTime, float pVal) : KFbxAnimCurveKeyBase()
00351 {
00352 K_ASSERT(mAllocatorFct != NULL);
00353 mImpl = (*mAllocatorFct)();
00354 Set(pTime, pVal);
00355 }
00356
00359 KFbxAnimCurveKey(KFbxAnimCurveKey const& pFKey) : KFbxAnimCurveKeyBase()
00360 {
00361 K_ASSERT(mCopyAllocatorFct != NULL);
00362 SetTime(pFKey.GetTime());
00363 mImpl = mCopyAllocatorFct(pFKey.GetImpl());
00364 }
00365
00368 ~KFbxAnimCurveKey()
00369 {
00370 K_ASSERT(mDeallocatorFct != NULL);
00371 (*mDeallocatorFct)(mImpl);
00372 }
00373
00376 KFbxAnimCurveKey& operator=(const KFbxAnimCurveKey& pFKey)
00377 {
00378 K_ASSERT(mImpl);
00379 if (mImpl)
00380 {
00381 *mImpl = *(pFKey.GetImpl());
00382 }
00383 SetTime(pFKey.GetTime());
00384 return *this;
00385 }
00386
00390 KTime GetTime() const
00391 {
00392 return KFbxAnimCurveKeyBase::GetTime();
00393 }
00394
00398 void SetTime(const KTime& pTime)
00399 {
00400 KFbxAnimCurveKeyBase::SetTime(pTime);
00401 }
00402
00407 void Set(KTime pTime, float pValue)
00408 {
00409 KFbxAnimCurveKeyBase::SetTime(pTime);
00410 mImpl->Set(pTime, pValue);
00411 }
00412
00420 void SetTCB(KTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f)
00421 {
00422 KFbxAnimCurveKeyBase::SetTime(pTime);
00423 mImpl->SetTCB(pTime, pValue, pData0, pData1, pData2);
00424 }
00425
00429 float GetValue() const
00430 {
00431 return mImpl->GetValue();
00432 }
00433
00437 void SetValue(float pValue)
00438 {
00439 mImpl->SetValue(pValue);
00440 }
00441
00445 KFbxAnimCurveDef::EInterpolationType GetInterpolation()
00446 {
00447 return mImpl->GetInterpolation();
00448 }
00449
00453 void SetInterpolation (KFbxAnimCurveDef::EInterpolationType pInterpolation)
00454 {
00455 mImpl->SetInterpolation(pInterpolation);
00456 }
00457
00461 KFbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false)
00462 {
00463 return mImpl->GetTangentMode(pIncludeOverrides);
00464 }
00465
00469 void SetTangentMode (KFbxAnimCurveDef::ETangentMode pTangentMode)
00470 {
00471 mImpl->SetTangentMode(pTangentMode);
00472 }
00473
00481 KFbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const
00482 {
00483 return mImpl->GetTangentWeightMode();
00484 }
00485
00498 void SetTangentWeightMode(KFbxAnimCurveDef::EWeightedMode pTangentWeightMode, KFbxAnimCurveDef::EWeightedMode pMask = KFbxAnimCurveDef::eWEIGHTED_ALL )
00499 {
00500 mImpl->SetTangentWeightMode(pTangentWeightMode, pMask);
00501 }
00502
00503
00511 KFbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const
00512 {
00513 return mImpl->GetTangentVelocityMode();
00514 }
00515
00528 void SetTangentVelocityMode(KFbxAnimCurveDef::EVelocityMode pTangentVelocityMode, KFbxAnimCurveDef::EVelocityMode pMask = KFbxAnimCurveDef::eVELOCITY_ALL )
00529 {
00530 mImpl->SetTangentVelocityMode(pTangentVelocityMode, pMask);
00531 }
00532
00540 KFbxAnimCurveDef::EConstantMode GetConstantMode() const
00541 {
00542 return mImpl->GetConstantMode();
00543 }
00544
00548 void SetConstantMode(KFbxAnimCurveDef::EConstantMode pMode)
00549 {
00550 mImpl->SetConstantMode(pMode);
00551 }
00552
00557 float GetDataFloat(KFbxAnimCurveDef::EKFbxAnimCurveDataIndex pIndex) const
00558 {
00559 return mImpl->GetDataFloat(pIndex);
00560 }
00561
00566 void SetDataFloat(KFbxAnimCurveDef::EKFbxAnimCurveDataIndex pIndex, float pValue)
00567 {
00568 mImpl->SetDataFloat(pIndex, pValue);
00569 }
00570
00578 void SetTangentVisibility (KFbxAnimCurveDef::ETangentVisibility pVisibility)
00579 {
00580 mImpl->SetTangentVisibility(pVisibility);
00581 }
00582
00590 KFbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const
00591 {
00592 return mImpl->GetTangentVisibility();
00593 }
00594
00599 void SetBreak(bool pVal)
00600 {
00601 mImpl->SetBreak(pVal);
00602 }
00603
00607 bool GetBreak() const
00608 {
00609 return mImpl->GetBreak();
00610 }
00611
00615 KFbxAnimCurveKeyImpl* GetImpl() const
00616 {
00617 return mImpl;
00618 }
00619
00623 static void SetAllocatorFct(KFbxAnimCurveKeyImpl* (*pAllocatorFct)());
00624
00628 static void SetCopyAllocatorFct(KFbxAnimCurveKeyImpl* (*pCopyAllocatorFct)(KFbxAnimCurveKeyImpl*));
00629
00633 static void SetDeallocatorFct(void (*pDeallocatorFct)(KFbxAnimCurveKeyImpl*));
00634
00635 private:
00636 static KFbxAnimCurveKeyImpl* (*mAllocatorFct)();
00637 static KFbxAnimCurveKeyImpl* (*mCopyAllocatorFct)(KFbxAnimCurveKeyImpl*);
00638 static void (*mDeallocatorFct)(KFbxAnimCurveKeyImpl*);
00639 KFbxAnimCurveKeyImpl* mImpl;
00640 };
00641
00642
00643
00651 class KFbxScene;
00652 class KFBX_DLL KFbxAnimCurve : public KFbxAnimCurveBase
00653 {
00654 KFBXOBJECT_DECLARE_ABSTRACT(KFbxAnimCurve, KFbxAnimCurveBase);
00655
00656 public:
00657
00658 static KFbxAnimCurve* Create(KFbxScene* pContainer, char const *pName);
00659
00668 virtual void ResizeKeyBuffer(int pKeyCount) = 0;
00669
00674 virtual void KeyModifyBegin () = 0;
00675
00680 virtual void KeyModifyEnd () = 0;
00681
00683 virtual void KeyClear () = 0;
00684
00688 virtual int KeyGetCount () const = 0;
00689
00707 virtual int KeyAdd (KTime pTime, KFbxAnimCurveKeyBase& pKey, int* pLast = NULL) = 0;
00714 virtual int KeyAdd (KTime pTime, int* pLast = NULL) = 0;
00715
00724 virtual bool KeySet(int pIndex, KFbxAnimCurveKeyBase& pKey) = 0;
00725
00730 virtual bool KeyRemove(int pIndex) = 0;
00731
00748 virtual int KeyInsert ( KTime pTime, int* pLast = NULL ) = 0;
00749
00760 virtual double KeyFind (KTime pTime, int* pLast = NULL) = 0;
00761
00766 virtual bool KeyScaleValue (float pMultValue) = 0;
00767
00772 virtual bool KeyScaleValueAndTangent (float pMultValue) = 0;
00774
00796 virtual void KeySet(int pKeyIndex,KTime pTime, float pValue, KFbxAnimCurveDef::EInterpolationType pInterpolation = KFbxAnimCurveDef::eINTERPOLATION_CUBIC, KFbxAnimCurveDef::ETangentMode pTangentMode = KFbxAnimCurveDef::eTANGENT_AUTO, float pData0 = 0.0,float pData1 = 0.0,KFbxAnimCurveDef::EWeightedMode pTangentWeightMode = KFbxAnimCurveDef::eWEIGHTED_NONE, float pWeight0 = KFbxAnimCurveDef::kDEFAULT_WEIGHT,float pWeight1 = KFbxAnimCurveDef::kDEFAULT_WEIGHT,float pVelocity0 = KFbxAnimCurveDef::kDEFAULT_VELOCITY,float pVelocity1 = KFbxAnimCurveDef::kDEFAULT_VELOCITY) = 0;
00797
00806 virtual void KeySetTCB(int pKeyIndex,KTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0;
00807
00812 virtual KFbxAnimCurveDef::EInterpolationType KeyGetInterpolation(int pKeyIndex) const = 0;
00813
00818 virtual void KeySetInterpolation(int pKeyIndex, KFbxAnimCurveDef::EInterpolationType pInterpolation) = 0;
00819
00826 virtual KFbxAnimCurveDef::EConstantMode KeyGetConstantMode(int pKeyIndex) const = 0;
00827
00835 virtual KFbxAnimCurveDef::ETangentMode KeyGetTangentMode(int pKeyIndex, bool pIncludeOverrides = false ) const = 0;
00836
00842 virtual void KeySetConstantMode(int pKeyIndex, KFbxAnimCurveDef::EConstantMode pMode) = 0;
00843
00849 virtual void KeySetTangentMode(int pKeyIndex, KFbxAnimCurveDef::ETangentMode pTangent) = 0;
00850
00856 virtual KFbxAnimCurveKey KeyGet(int pIndex) const = 0;
00857
00862 virtual float KeyGetValue(int pKeyIndex) const = 0;
00863
00868 virtual void KeySetValue(int pKeyIndex, float pValue) = 0;
00869
00874 virtual void KeyIncValue(int pKeyIndex, float pValue) = 0;
00875
00880 virtual void KeyMultValue(int pKeyIndex, float pValue) = 0;
00881
00888 virtual void KeyMultTangent(int pKeyIndex, float pValue) = 0;
00889
00894 virtual KTime KeyGetTime(int pKeyIndex) const = 0;
00895
00900 virtual void KeySetTime(int pKeyIndex, KTime pTime) = 0;
00901
00907 virtual void KeySetBreak(int pKeyIndex, bool pVal) = 0;
00908
00913 virtual bool KeyGetBreak(int pKeyIndex) const = 0;
00915
00926 virtual float KeyGetLeftDerivative(int pIndex) = 0;
00927
00935 virtual void KeySetLeftDerivative(int pIndex, float pValue) = 0;
00936
00944 virtual float KeyGetLeftAuto(int pIndex, bool pApplyOvershootProtection = false) = 0;
00945
00952 virtual KFCurveTangeantInfo KeyGetLeftDerivativeInfo(int pIndex) = 0;
00953
00964 virtual void KeySetLeftDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false) = 0;
00965
00972 virtual float KeyGetRightDerivative(int pIndex) = 0;
00973
00981 virtual void KeySetRightDerivative(int pIndex, float pValue) = 0;
00982
00990 virtual float KeyGetRightAuto(int pIndex, bool pApplyOvershootProtection = false) = 0;
00991
00998 virtual KFCurveTangeantInfo KeyGetRightDerivativeInfo(int pIndex) = 0;
00999
01010 virtual void KeySetRightDerivativeInfo(kFCurveIndex pIndex, KFCurveTangeantInfo pValue, bool pForceDerivative = false) = 0;
01011
01018 virtual bool KeyIsLeftTangentWeighted(int pIndex) const = 0;
01019
01026 virtual bool KeyIsRightTangentWeighted(int pIndex) const = 0;
01027
01033 virtual float KeyGetLeftTangentWeight(int pIndex) const = 0;
01034
01040 virtual float KeyGetRightTangentWeight(int pIndex) const = 0;
01041
01051 virtual void KeySetLeftTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0;
01052
01062 virtual void KeySetRightTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0;
01063
01069 virtual float KeyGetLeftTangentVelocity( int pIndex) const = 0;
01070
01076 virtual float KeyGetRightTangentVelocity( int pIndex) const = 0;
01077
01079
01095 virtual float Evaluate (KTime pTime, int* pLast = NULL) = 0;
01096
01105 virtual float EvaluateIndex( double pIndex) = 0;
01106
01115 virtual float EvaluateLeftDerivative (KTime pTime, int* pLast = NULL) = 0;
01116
01125 virtual float EvaluateRightDerivative (KTime pTime, int* pLast = NULL) = 0;
01127
01139 virtual bool GetTimeInterval(KTime& pStart, KTime& pStop) = 0;
01140
01145 virtual KFCurve* GetKFCurve() = 0;
01146
01153 virtual void CopyFrom(KFbxAnimCurve& pSource, bool pWithKeys = true) = 0;
01155
01156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01158 // WARNING!
01159
01160
01162
01163 virtual bool Store(KFbx* pFileObject) = 0;
01164 virtual bool Retrieve(KFbx* pFileObject) = 0;
01165
01166 protected:
01167 KFbxAnimCurve(KFbxSdkManager& pManager, char const* pName);
01168
01169 virtual void Construct(const KFbxAnimCurveBase* pFrom);
01170 virtual void Destruct(bool pRecursive, bool pDependents);
01171
01172 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
01173 };
01174
01175 #include <fbxfilesdk/fbxfilesdk_nsend.h>
01176
01177 #endif // FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVE_H