- Main Page
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# fbxanimcurvenode.h

Go to the documentation of this file.

    00001 /****************************************************************************************
    00002
    00003    Copyright (C) 2012 Autodesk, Inc.
    00004    All rights reserved.
    00005
    00006    Use of this software is subject to the terms of the Autodesk license agreement
    00007    provided at the time of installation or download, or which otherwise accompanies
    00008    this software in either electronic or hard copy form.
    00009
    00010 ****************************************************************************************/
    00011
    00013 #ifndef _FBXSDK_SCENE_ANIMATION_CURVE_NODE_H_
    00014 #define _FBXSDK_SCENE_ANIMATION_CURVE_NODE_H_
    00015
    00016 #include <fbxsdk/fbxsdk_def.h>
    00017
    00018 #include <fbxsdk/core/fbxobject.h>
    00019
    00020 #include <fbxsdk/fbxsdk_nsbegin.h>
    00021
    00022 //Standard curve node names
    00023 #define FBXSDK_CURVENODE_TRANSFORM      "Transform"
    00024 #define FBXSDK_CURVENODE_TRANSLATION    "T"
    00025 #define FBXSDK_CURVENODE_ROTATION       "R"
    00026 #define FBXSDK_CURVENODE_SCALING        "S"
    00027 #define FBXSDK_CURVENODE_COMPONENT_X    "X"
    00028 #define FBXSDK_CURVENODE_COMPONENT_Y    "Y"
    00029 #define FBXSDK_CURVENODE_COMPONENT_Z    "Z"
    00030 #define FBXSDK_CURVENODE_COLOR          "Color"
    00031 #define FBXSDK_CURVENODE_COLOR_RED      FBXSDK_CURVENODE_COMPONENT_X
    00032 #define FBXSDK_CURVENODE_COLOR_GREEN    FBXSDK_CURVENODE_COMPONENT_Y
    00033 #define FBXSDK_CURVENODE_COLOR_BLUE     FBXSDK_CURVENODE_COMPONENT_Z
    00034
    00035 class FbxAnimStack;
    00036 class FbxAnimCurve;
    00037 class FbxSet;
    00038 class KFCurveNode;
    00039
    00055 class FBXSDK_DLL FbxAnimCurveNode : public FbxObject
    00056 {
    00057     FBXSDK_OBJECT_DECLARE(FbxAnimCurveNode, FbxObject);
    00058
    00059 public:
    00073         bool IsAnimated(bool pRecurse=false) const;
    00074
    00084         bool GetAnimationInterval(FbxTimeSpan& pTimeInterval) const;
    00085
    00091         bool IsComposite() const;
    00092
    00098         FbxAnimCurveNode* Find(const char* pName);
    00099
    00110         static FbxAnimCurveNode* CreateTypedCurveNode(FbxProperty& pProperty, FbxScene* pScene);
    00111
    00116         unsigned int GetChannelsCount() const;
    00117
    00122         int GetChannelIndex(const char* pChannelName) const;
    00123
    00128         FbxString GetChannelName(int pChannelId) const;
    00129
    00135         void ResetChannels();
    00136
    00143         template <class T> bool AddChannel(const char* pChnlName, T const &pValue)
    00144         {
    00145             if (!pChnlName || strlen(pChnlName)==0) return false;
    00146             FbxProperty c = GetChannel(pChnlName);
    00147             if (c.IsValid())
    00148             {
    00149                 return false;
    00150             }
    00151
    00152             mChannels.BeginCreateOrFindProperty();
    00153             FbxDataType dt = FbxGetDataTypeFromEnum(FbxTypeOf(pValue));
    00154             c = FbxProperty::Create(mChannels, dt, pChnlName);
    00155             c.Set(pValue);
    00156             mChannels.EndCreateOrFindProperty();
    00157             return true;
    00158         }
    00159
    00164         template <class T> void SetChannelValue(const char* pChnlName, T pValue)
    00165         {
    00166             FbxProperty c = GetChannel(pChnlName);
    00167             if( c.IsValid() ) c.Set(pValue);
    00168         }
    00169
    00174         template <class T> void SetChannelValue(unsigned int pChnlId, T pValue)
    00175         {
    00176             FbxProperty c = GetChannel(pChnlId);
    00177             if( c.IsValid() ) c.Set(pValue);
    00178         }
    00179
    00185         template <class T> T GetChannelValue(const char* pChnlName, T pInitVal)
    00186         {
    00187             T v = pInitVal;
    00188             FbxProperty c = GetChannel(pChnlName);
    00189             if( c.IsValid() ) v = c.Get<T>();
    00190             return v;
    00191         }
    00192
    00198         template <class T> T GetChannelValue(unsigned int pChnlId, T pInitVal)
    00199         {
    00200             T v = pInitVal;
    00201             FbxProperty c = GetChannel(pChnlId);
    00202             if( c.IsValid() ) v = c.Get<T>();
    00203             return v;
    00204         }
    00206
    00217         bool DisconnectFromChannel(FbxAnimCurve* pCurve, unsigned int pChnlId);
    00218
    00226         bool ConnectToChannel(FbxAnimCurve* pCurve, const char* pChnl, bool pInFront = false);
    00227
    00236         bool ConnectToChannel(FbxAnimCurve* pCurve, unsigned int pChnlId, bool pInFront = false);
    00237
    00247         FbxAnimCurve* CreateCurve(const char* pCurveNodeName, const char* pChannel);
    00248
    00258         FbxAnimCurve* CreateCurve(const char* pCurveNodeName, unsigned int pChannelId = 0);
    00259
    00273         int GetCurveCount(unsigned int pChannelId, const char* pCurveNodeName = NULL);
    00274
    00287         FbxAnimCurve* GetCurve(unsigned int pChannelId, unsigned int pId = 0, const char* pCurveNodeName = NULL);
    00288
    00290
    00291 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00292
    00293     //  WARNING!
    00294     //  Anything beyond these lines may not be documented accurately and is
    00295     //  subject to change without notice.
    00297
    00298     virtual FbxObject& Copy(const FbxObject& pObject);
    00299
    00300     void Evaluate(double* pData, FbxTime pTime);
    00301
    00307
    00317     KFCurveNode* GetKFCurveNode(bool pNoCreate=false);
    00318
    00323     void ReleaseKFCurveNode();
    00324
    00326     void SyncChannelsWithKFCurve();
    00327
    00328     inline bool UseQuaternionInterpolation() {return mQuaternionInterpolation != 0;};
    00329
    00331     bool SetQuaternionInterpolation(unsigned short pVal);
    00332     unsigned short GetQuaternionInterpolation() { return mQuaternionInterpolation; };
    00333
    00334     // sync the KFCurveNodeLayerType based on the property Datatype (see the source code for details)
    00335     void SetKFCurveNodeLayerType(FbxProperty& pProp);
    00336
    00337     static const char* CurveNodeNameFrom(const char* pName);
    00339
    00340 private:
    00347     FbxProperty GetChannel(const char* pChnl);
    00348
    00355     FbxProperty GetChannel(unsigned int pChnlId);
    00356
    00357 protected:
    00358     FbxAnimCurveNode(FbxManager& pManager, char const* pName);
    00359     FbxAnimCurveNode* Find(FbxAnimCurveNode* pRoot, const FbxString& pName);
    00360     virtual bool ConstructProperties( bool pForceSet );
    00361     virtual void Destruct(bool pRecursive, bool pDependents);
    00362
    00363 private:
    00364     friend class FbxObject;
    00365     friend void CollectAnimFromCurveNode(void **lSrc, void *fcn, unsigned int nbCrvs, FbxAnimCurveNode *cn, FbxSet* pNickToAnimCurveTimeWarpsSet, FbxSet& pNickToKFCurveNodeWarpSet);
    00366     unsigned char   mNonRemovableChannels;
    00367     FbxProperty mChannels;
    00368     FbxProperty*    mCurrentlyProcessed;
    00369     KFCurveNode*    mFCurveNode;
    00370     bool*           mOwnedKFCurve;
    00371     int             mKFCurveNodeLayerType;
    00372     unsigned short  mQuaternionInterpolation;
    00373     int*            mDirectIndexes;
    00374     int             mDirectIndexesSize;
    00375
    00376     FbxAnimCurve* GetCurve(unsigned int pChannelId, unsigned int pId, FbxAnimCurveNode* pCurveNode);
    00377     bool ConnectToChannel(FbxProperty& p, FbxAnimCurve* pCurve, bool pInFront);
    00378     void ResetKFCurveNode();
    00379     void SyncKFCurveValue(FbxAnimCurve* pCurve, double pVal);
    00380     void ReleaseOwnershipOfKFCurve(int pIndex);
    00381
    00382     template <class T> FbxAnimCurve* CreateCurveGeneral(const char* pCurveNodeName, T pChannel);
    00383
    00384 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00385 };
    00386
    00387 FBXSDK_DLL void GetAllAnimCurves(FbxAnimStack* pAnimStack, FbxArray<FbxAnimCurve*>& pCurves);
    00388 FBXSDK_DLL void GetAllAnimCurves(FbxObject* pObj, FbxAnimStack* pAnimStack, FbxArray<FbxAnimCurve*>& pCurves);
    00389
    00390 #include <fbxsdk/fbxsdk_nsend.h>
    00391
    00392 #endif // FBXFILESDK_KFBXPLUGINS_KFBXANIMCURVENODE_H
    00393