00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_SCENE_ANIMATION_CURVE_H_
00014 #define _FBXSDK_SCENE_ANIMATION_CURVE_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/scene/animation/fbxanimcurvebase.h>
00020
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022
00023 class KFCurve;
00024
00026 class FBXSDK_DLL FbxAnimCurveDef
00027 {
00028 public:
00029 static const float sDEFAULT_WEIGHT;
00030 static const float sMIN_WEIGHT;
00031 static const float sMAX_WEIGHT;
00032 static const float sDEFAULT_VELOCITY;
00033
00035 enum ETangentMode
00036 {
00037 eTangentAuto = 0x00000100,
00038 eTangentTCB = 0x00000200,
00039 eTangentUser = 0x00000400,
00040 eTangentGenericBreak = 0x00000800,
00041 eTangentBreak = eTangentGenericBreak|eTangentUser,
00042 eTangentAutoBreak = eTangentGenericBreak|eTangentAuto,
00043 eTangentGenericClamp = 0x00001000,
00044 eTangentGenericTimeIndependent = 0x00002000,
00045 eTangentGenericClampProgressive = 0x00004000|eTangentGenericTimeIndependent
00046 };
00047
00049 enum EInterpolationType
00050 {
00051 eInterpolationConstant = 0x00000002,
00052 eInterpolationLinear = 0x00000004,
00053 eInterpolationCubic = 0x00000008
00054 };
00055
00057 enum EWeightedMode
00058 {
00059 eWeightedNone = 0x00000000,
00060 eWeightedRight = 0x01000000,
00061 eWeightedNextLeft = 0x02000000,
00062 eWeightedAll = eWeightedRight|eWeightedNextLeft
00063 };
00064
00066 enum EConstantMode
00067 {
00068 eConstantStandard = 0x00000000,
00069 eConstantNext = 0x00000100
00070 };
00071
00073 enum EVelocityMode
00074 {
00075 eVelocityNone = 0x00000000,
00076 eVelocityRight = 0x10000000,
00077 eVelocityNextLeft = 0x20000000,
00078 eVelocityAll = eVelocityRight|eVelocityNextLeft
00079 };
00080
00082 enum ETangentVisibility
00083 {
00084 eTangentShowNone = 0x00000000,
00085 eTangentShowLeft = 0x00100000,
00086 eTangentShowRight = 0x00200000,
00087 eTangentShowBoth = eTangentShowLeft|eTangentShowRight
00088 };
00089
00091 enum EDataIndex
00092 {
00093 eRightSlope = 0,
00094 eNextLeftSlope = 1,
00095 eWeights = 2,
00096 eRightWeight = 2,
00097 eNextLeftWeight = 3,
00098 eVelocity = 4,
00099 eRightVelocity = 4,
00100 eNextLeftVelocity = 5,
00101 eTCBTension = 0,
00102 eTCBContinuity = 1,
00103 eTCBBias = 2
00104 };
00105 };
00106
00107 struct FBXSDK_DLL FbxAnimCurveTangentInfo
00108 {
00109 inline FbxAnimCurveTangentInfo()
00110 {
00111 mDerivative = 0;
00112 mWeight = FbxAnimCurveDef::sDEFAULT_WEIGHT;
00113 mWeighted = false;
00114 mVelocity = FbxAnimCurveDef::sDEFAULT_VELOCITY;
00115 mHasVelocity = false;
00116 mAuto = 0;
00117 }
00118
00119 float mDerivative;
00120 float mWeight;
00121 float mVelocity;
00122 float mAuto;
00123 bool mWeighted;
00124 bool mHasVelocity;
00125 };
00126
00134 class FBXSDK_DLL FbxAnimCurveKey_Impl
00135 {
00136 public:
00139 virtual ~FbxAnimCurveKey_Impl() {};
00140
00143 virtual FbxAnimCurveKey_Impl& operator=(const FbxAnimCurveKey_Impl& pFKey) = 0;
00144
00149 virtual void Set(FbxTime pTime, float pValue) = 0;
00150
00162 virtual void SetTCB(FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0;
00163
00167 virtual float GetValue() const = 0;
00168
00172 virtual void SetValue(float pValue) = 0;
00173
00177 virtual FbxAnimCurveDef::EInterpolationType GetInterpolation() const = 0;
00178
00182 virtual void SetInterpolation (FbxAnimCurveDef::EInterpolationType pInterpolation) = 0;
00183
00190 virtual FbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false) const = 0;
00191
00195 virtual void SetTangentMode (FbxAnimCurveDef::ETangentMode pTangentMode) = 0;
00196
00201 virtual FbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const = 0;
00202
00236 virtual void SetTangentWeightMode(FbxAnimCurveDef::EWeightedMode pTangentWeightMode, FbxAnimCurveDef::EWeightedMode pMask = FbxAnimCurveDef::eWeightedAll ) = 0;
00237
00248 virtual void SetTangentWeightAndAdjustTangent(FbxAnimCurveDef::EDataIndex pIndex, double pWeight ) = 0;
00249
00254 virtual FbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const = 0;
00255
00265 virtual void SetTangentVelocityMode(FbxAnimCurveDef::EVelocityMode pTangentVelocityMode, FbxAnimCurveDef::EVelocityMode pMask = FbxAnimCurveDef::eVelocityAll ) = 0;
00266
00272 virtual FbxAnimCurveDef::EConstantMode GetConstantMode() const = 0;
00273
00278 virtual void SetConstantMode(FbxAnimCurveDef::EConstantMode pMode) = 0;
00279
00294 virtual float GetDataFloat(FbxAnimCurveDef::EDataIndex pIndex) const = 0;
00295
00307 virtual void SetDataFloat(FbxAnimCurveDef::EDataIndex pIndex, float pValue) = 0;
00308
00313 virtual void SetTangentVisibility (FbxAnimCurveDef::ETangentVisibility pVisibility) = 0;
00314
00319 virtual FbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const = 0;
00320
00327 virtual void SetBreak(bool pVal) = 0;
00328
00335 virtual bool GetBreak() const = 0;
00336 };
00337
00348 class FBXSDK_DLL FbxAnimCurveKey : public FbxAnimCurveKeyBase
00349 {
00350 public:
00353 FbxAnimCurveKey() : FbxAnimCurveKeyBase()
00354 {
00355 FBX_ASSERT(mAllocatorFct != NULL);
00356 mImpl = (*mAllocatorFct)();
00357 }
00358
00362 FbxAnimCurveKey(FbxTime pTime) : FbxAnimCurveKeyBase()
00363 {
00364 FBX_ASSERT(mAllocatorFct != NULL);
00365 mImpl = (*mAllocatorFct)();
00366 SetTime(pTime);
00367 }
00368
00373 FbxAnimCurveKey(FbxTime pTime, float pVal) : FbxAnimCurveKeyBase()
00374 {
00375 FBX_ASSERT(mAllocatorFct != NULL);
00376 mImpl = (*mAllocatorFct)();
00377 Set(pTime, pVal);
00378 }
00379
00382 FbxAnimCurveKey(FbxAnimCurveKey const& pFKey) : FbxAnimCurveKeyBase()
00383 {
00384 FBX_ASSERT(mCopyAllocatorFct != NULL);
00385 SetTime(pFKey.GetTime());
00386 mImpl = mCopyAllocatorFct(pFKey.GetImpl());
00387 }
00388
00391 ~FbxAnimCurveKey()
00392 {
00393 FBX_ASSERT(mDeallocatorFct != NULL);
00394 (*mDeallocatorFct)(mImpl);
00395 }
00396
00399 FbxAnimCurveKey& operator=(const FbxAnimCurveKey& pFKey)
00400 {
00401 FBX_ASSERT(mImpl);
00402 if (mImpl)
00403 {
00404 *mImpl = *(pFKey.GetImpl());
00405 }
00406 SetTime(pFKey.GetTime());
00407 return *this;
00408 }
00409
00413 FbxTime GetTime() const
00414 {
00415 return FbxAnimCurveKeyBase::GetTime();
00416 }
00417
00421 void SetTime(const FbxTime& pTime)
00422 {
00423 FbxAnimCurveKeyBase::SetTime(pTime);
00424 }
00425
00430 void Set(FbxTime pTime, float pValue)
00431 {
00432 FbxAnimCurveKeyBase::SetTime(pTime);
00433 mImpl->Set(pTime, pValue);
00434 }
00435
00447 void SetTCB(FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f)
00448 {
00449 FbxAnimCurveKeyBase::SetTime(pTime);
00450 mImpl->SetTCB(pTime, pValue, pData0, pData1, pData2);
00451 }
00452
00456 float GetValue() const
00457 {
00458 return mImpl->GetValue();
00459 }
00460
00464 void SetValue(float pValue)
00465 {
00466 mImpl->SetValue(pValue);
00467 }
00468
00469
00473 FbxAnimCurveDef::EInterpolationType GetInterpolation()
00474 {
00475 return mImpl->GetInterpolation();
00476 }
00477
00481 void SetInterpolation (FbxAnimCurveDef::EInterpolationType pInterpolation)
00482 {
00483 mImpl->SetInterpolation(pInterpolation);
00484 }
00485
00492 FbxAnimCurveDef::ETangentMode GetTangentMode(bool pIncludeOverrides = false)
00493 {
00494 return mImpl->GetTangentMode(pIncludeOverrides);
00495 }
00496
00500 void SetTangentMode (FbxAnimCurveDef::ETangentMode pTangentMode)
00501 {
00502 mImpl->SetTangentMode(pTangentMode);
00503 }
00504
00509 FbxAnimCurveDef::EWeightedMode GetTangentWeightMode() const
00510 {
00511 return mImpl->GetTangentWeightMode();
00512 }
00513
00547 void SetTangentWeightMode(FbxAnimCurveDef::EWeightedMode pTangentWeightMode, FbxAnimCurveDef::EWeightedMode pMask = FbxAnimCurveDef::eWeightedAll )
00548 {
00549 mImpl->SetTangentWeightMode(pTangentWeightMode, pMask);
00550 }
00551
00562 void SetTangentWeightAndAdjustTangent(FbxAnimCurveDef::EDataIndex pIndex, double pWeight )
00563 {
00564 mImpl->SetTangentWeightAndAdjustTangent(pIndex, pWeight);
00565 }
00566
00571 FbxAnimCurveDef::EVelocityMode GetTangentVelocityMode() const
00572 {
00573 return mImpl->GetTangentVelocityMode();
00574 }
00575
00585 void SetTangentVelocityMode(FbxAnimCurveDef::EVelocityMode pTangentVelocityMode, FbxAnimCurveDef::EVelocityMode pMask = FbxAnimCurveDef::eVelocityAll )
00586 {
00587 mImpl->SetTangentVelocityMode(pTangentVelocityMode, pMask);
00588 }
00589
00595 FbxAnimCurveDef::EConstantMode GetConstantMode() const
00596 {
00597 return mImpl->GetConstantMode();
00598 }
00599
00604 void SetConstantMode(FbxAnimCurveDef::EConstantMode pMode)
00605 {
00606 mImpl->SetConstantMode(pMode);
00607 }
00608
00623 float GetDataFloat(FbxAnimCurveDef::EDataIndex pIndex) const
00624 {
00625 return mImpl->GetDataFloat(pIndex);
00626 }
00627
00639 void SetDataFloat(FbxAnimCurveDef::EDataIndex pIndex, float pValue)
00640 {
00641 mImpl->SetDataFloat(pIndex, pValue);
00642 }
00643
00648 void SetTangentVisibility (FbxAnimCurveDef::ETangentVisibility pVisibility)
00649 {
00650 mImpl->SetTangentVisibility(pVisibility);
00651 }
00652
00657 FbxAnimCurveDef::ETangentVisibility GetTangentVisibility () const
00658 {
00659 return mImpl->GetTangentVisibility();
00660 }
00661
00668 void SetBreak(bool pVal)
00669 {
00670 mImpl->SetBreak(pVal);
00671 }
00672
00679 bool GetBreak() const
00680 {
00681 return mImpl->GetBreak();
00682 }
00683
00687 FbxAnimCurveKey_Impl* GetImpl() const
00688 {
00689 return mImpl;
00690 }
00691
00695 static void SetAllocatorFct(FbxAnimCurveKey_Impl* (*pAllocatorFct)());
00696
00700 static void SetCopyAllocatorFct(FbxAnimCurveKey_Impl* (*pCopyAllocatorFct)(FbxAnimCurveKey_Impl*));
00701
00705 static void SetDeallocatorFct(void (*pDeallocatorFct)(FbxAnimCurveKey_Impl*));
00706
00707 private:
00708 static FbxAnimCurveKey_Impl* (*mAllocatorFct)();
00709 static FbxAnimCurveKey_Impl* (*mCopyAllocatorFct)(FbxAnimCurveKey_Impl*);
00710 static void (*mDeallocatorFct)(FbxAnimCurveKey_Impl*);
00711 FbxAnimCurveKey_Impl* mImpl;
00712 };
00713
00714 class FbxScene;
00715
00779 class FBXSDK_DLL FbxAnimCurve : public FbxAnimCurveBase
00780 {
00781 FBXSDK_ABSTRACT_OBJECT_DECLARE(FbxAnimCurve, FbxAnimCurveBase);
00782
00783 public:
00794 static FbxAnimCurve* Create(FbxScene* pContainer, const char* pName);
00796
00805 virtual void ResizeKeyBuffer(int pKeyCount) = 0;
00806
00810 virtual void KeyModifyBegin () = 0;
00811
00815 virtual void KeyModifyEnd () = 0;
00816
00818 virtual void KeyClear () = 0;
00819
00823 virtual int KeyGetCount () const = 0;
00824
00842 virtual int KeyAdd (FbxTime pTime, FbxAnimCurveKeyBase& pKey, int* pLast = NULL) = 0;
00843
00858 virtual int KeyAdd (FbxTime pTime, int* pLast = NULL) = 0;
00859
00868 virtual bool KeySet(int pIndex, FbxAnimCurveKeyBase& pKey) = 0;
00869
00874 virtual bool KeyRemove(int pIndex) = 0;
00875
00881 virtual bool KeyRemove(int pStartIndex, int pEndIndex) = 0;
00882
00898 virtual int KeyInsert ( FbxTime pTime, int* pLast = NULL ) = 0;
00899
00913 virtual double KeyFind (FbxTime pTime, int* pLast = NULL) = 0;
00914
00919 virtual bool KeyScaleValue (float pMultValue) = 0;
00920
00925 virtual bool KeyScaleValueAndTangent (float pMultValue) = 0;
00927
00950 virtual void KeySet(int pKeyIndex,FbxTime pTime, float pValue, FbxAnimCurveDef::EInterpolationType pInterpolation = FbxAnimCurveDef::eInterpolationCubic, FbxAnimCurveDef::ETangentMode pTangentMode = FbxAnimCurveDef::eTangentAuto, float pData0 = 0.0,float pData1 = 0.0,FbxAnimCurveDef::EWeightedMode pTangentWeightMode = FbxAnimCurveDef::eWeightedNone, float pWeight0 = FbxAnimCurveDef::sDEFAULT_WEIGHT,float pWeight1 = FbxAnimCurveDef::sDEFAULT_WEIGHT,float pVelocity0 = FbxAnimCurveDef::sDEFAULT_VELOCITY,float pVelocity1 = FbxAnimCurveDef::sDEFAULT_VELOCITY) = 0;
00951
00964 virtual void KeySetTCB(int pKeyIndex,FbxTime pTime, float pValue, float pData0 = 0.0f, float pData1 = 0.0f, float pData2 = 0.0f) = 0;
00965
00970 virtual FbxAnimCurveDef::EInterpolationType KeyGetInterpolation(int pKeyIndex) const = 0;
00971
00976 virtual void KeySetInterpolation(int pKeyIndex, FbxAnimCurveDef::EInterpolationType pInterpolation) = 0;
00977
00984 virtual FbxAnimCurveDef::EConstantMode KeyGetConstantMode(int pKeyIndex) const = 0;
00985
00993 virtual FbxAnimCurveDef::ETangentMode KeyGetTangentMode(int pKeyIndex, bool pIncludeOverrides = false ) const = 0;
00994
01000 virtual void KeySetConstantMode(int pKeyIndex, FbxAnimCurveDef::EConstantMode pMode) = 0;
01001
01007 virtual void KeySetTangentMode(int pKeyIndex, FbxAnimCurveDef::ETangentMode pTangent) = 0;
01008
01015 virtual FbxAnimCurveKey KeyGet(int pIndex) const = 0;
01016
01021 virtual float KeyGetValue(int pKeyIndex) const = 0;
01022
01027 virtual void KeySetValue(int pKeyIndex, float pValue) = 0;
01028
01033 virtual void KeyIncValue(int pKeyIndex, float pValue) = 0;
01034
01040 virtual void KeyMultValue(int pKeyIndex, float pValue) = 0;
01041
01048 virtual void KeyMultTangent(int pKeyIndex, float pValue) = 0;
01049
01054 virtual FbxTime KeyGetTime(int pKeyIndex) const = 0;
01055
01061 virtual void KeySetTime(int pKeyIndex, FbxTime pTime) = 0;
01062
01069 virtual void KeySetBreak(int pKeyIndex, bool pVal) = 0;
01070
01077 virtual bool KeyGetBreak(int pKeyIndex) const = 0;
01079
01090 virtual float KeyGetLeftDerivative(int pIndex) = 0;
01091
01101 virtual void KeySetLeftDerivative(int pIndex, float pValue) = 0;
01102
01110 virtual float KeyGetLeftAuto(int pIndex, bool pApplyOvershootProtection = false) = 0;
01111
01118 virtual FbxAnimCurveTangentInfo KeyGetLeftDerivativeInfo(int pIndex) = 0;
01119
01131 virtual void KeySetLeftDerivativeInfo(int pIndex, const FbxAnimCurveTangentInfo& pValue, bool pForceDerivative = false) = 0;
01132
01139 virtual float KeyGetRightDerivative(int pIndex) = 0;
01140
01150 virtual void KeySetRightDerivative(int pIndex, float pValue) = 0;
01151
01159 virtual float KeyGetRightAuto(int pIndex, bool pApplyOvershootProtection = false) = 0;
01160
01167 virtual FbxAnimCurveTangentInfo KeyGetRightDerivativeInfo(int pIndex) = 0;
01168
01180 virtual void KeySetRightDerivativeInfo(int pIndex, const FbxAnimCurveTangentInfo& pValue, bool pForceDerivative = false) = 0;
01181
01188 virtual bool KeyIsLeftTangentWeighted(int pIndex) const = 0;
01189
01196 virtual bool KeyIsRightTangentWeighted(int pIndex) const = 0;
01197
01204 virtual float KeyGetLeftTangentWeight(int pIndex) const = 0;
01205
01212 virtual float KeyGetRightTangentWeight(int pIndex) const = 0;
01213
01225 virtual void KeySetLeftTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0;
01226
01238 virtual void KeySetRightTangentWeight( int pIndex, float pWeight, bool pAdjustTan = false ) = 0;
01239
01246 virtual float KeyGetLeftTangentVelocity( int pIndex) const = 0;
01247
01254 virtual float KeyGetRightTangentVelocity( int pIndex) const = 0;
01256
01273 virtual float Evaluate (FbxTime pTime, int* pLast = NULL) = 0;
01274
01286 virtual float EvaluateIndex( double pIndex) = 0;
01287
01297 virtual float EvaluateLeftDerivative (FbxTime pTime, int* pLast = NULL) = 0;
01298
01308 virtual float EvaluateRightDerivative (FbxTime pTime, int* pLast = NULL) = 0;
01310
01321 virtual bool GetTimeInterval(FbxTimeSpan& pTimeInterval) = 0;
01322
01329 virtual void CopyFrom(FbxAnimCurve& pSource, bool pWithKeys = true) = 0;
01330
01336 virtual float GetValue(int pCurveNodeIndex=0) = 0;
01337
01343 virtual void SetValue(float pValue, int pCurveNodeIndex=0) = 0;
01345
01346
01347
01348
01349 #ifndef DOXYGEN_SHOULD_SKIP_THIS
01350 virtual KFCurve* GetKFCurve() = 0;
01351 virtual bool Store(FbxIO* pFileObject, bool pLegacyVersion=false) = 0;
01352 virtual bool Retrieve(FbxIO* pFileObject) = 0;
01353 #endif
01354 };
01355
01356 #include <fbxsdk/fbxsdk_nsend.h>
01357
01358 #endif