fbxsdk/scene/animation/fbxanimutilities.h Source File

fbxanimutilities.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_SCENE_ANIMATION_UTILITIES_H_
14 #define _FBXSDK_SCENE_ANIMATION_UTILITIES_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
22 
23 #include <fbxsdk/fbxsdk_nsbegin.h>
24 
25 class FbxMultiMap;
26 class FbxObject;
27 class FbxProperty;
28 class FbxScene;
29 class FbxIO;
30 class FbxAnimStack;
31 class FbxAnimLayer;
32 class FbxAnimCurveNode;
33 class FbxAnimCurve;
34 
36 {
37 public:
43  static bool IsAnimated(FbxObject* pObj);
44 
52  static bool IsChannelAnimated(FbxObject* pObj, const char* pPropertyName, const char* pChannelName = NULL);
53 
55  {
56  public:
60 
62  {
63  mName = "unnamed";
64  mStart = 0;
65  mEnd = 0;
66  }
67 
68  FbxAnimSplitDef(const FbxString& pName, FbxTime& pStart, FbxTime& pEnd)
69  {
70  mName = pName;
71  mStart = pStart;
72  mEnd = pEnd;
73  }
74 
75  FbxAnimSplitDef& operator =(const FbxAnimSplitDef& pRhs)
76  {
77  mName = pRhs.mName;
78  mStart = pRhs.mStart;
79  mEnd = pRhs.mEnd;
80  return *this;
81  }
82  } ;
83 
85  {
86  public:
87  // pData is a pointer to the private KFCurveNode
88  CurveNodeIntfce(void* pData);
89  ~CurveNodeIntfce();
90 
91  FbxHandle GetHandle();
92 
93  char* GetTimeWarpName() const;
94  CurveNodeIntfce GetTimeWarp();
95 
96  CurveNodeIntfce GetLayer(int pId);
97 
98  int GetCount();
99  void* GetHandle(unsigned int pId);
100  void* GetCurveHandle(int pId = -1);
101  void SetCurveHandle(void* pCurveHandle, int pId = -1);
102  CurveNodeIntfce FindRecursive(const char* pName);
103 
104  bool IsValid() { return mImp != NULL; }
106  {
107  mImp = lRhs.mImp;
108  return *this;
109  }
110 
112  {
113  return (mImp == lRhs.mImp);
114  }
115 
116  private:
117  friend class FbxAnimUtilities;
118  void* mImp;
119  };
120 
122  {
123  public:
124  // pData is a pointer to the private KFCurve
125  CurveIntfce(void* pData);
126  CurveIntfce(FbxAnimCurve* pAnimCurve);
127  ~CurveIntfce();
128 
129  float GetValue();
130  void SetValue(float pVal);
131  int KeyGetCount();
132 
133  void* GetCurveHandle();
134  void SetCurveHandle(void* pData);
135 
136  int GetPreExtrapolation();
137  int GetPreExtrapolationCount();
138  int GetPostExtrapolation();
139  int GetPostExtrapolationCount();
140 
141 
142  bool IsValid() { return mImp != NULL; }
144  {
145  mImp = lRhs.mImp;
146  mIsAnimCurveImp = lRhs.mIsAnimCurveImp;
147  return *this;
148  }
149 
151  {
152  return (mImp == lRhs.mImp);
153  }
154 
155  private:
156  friend class FbxAnimUtilities;
157 
158  void* mImp;
159  bool mIsAnimCurveImp;
160  };
161 
162  static int SplitAnimationIntoMultipleStacks(FbxScene* pScene, const FbxArray<FbxAnimSplitDef*>& pAnimSplitDefinitions, const FbxAnimStack* pSrcAnimStack, FbxArray<FbxAnimStack*>& pDstStacks);
163  static void ShareAnimCurves(FbxProperty& pDstProperty, FbxProperty& pSrcProperty, FbxScene* pScene);
164 
165  // Encapsulate use of private animation data
166  static void SetTimeWarpSet(FbxMultiMap* pTWset);
167 
168  static CurveNodeIntfce CreateCurveNode(const char* pName);
169  static CurveNodeIntfce CreateCurveNode(FbxIO* pFileObject);
170  static CurveNodeIntfce CreateCurveNode(FbxIO* pFileObject, CurveNodeIntfce& pParent, bool pOnlyDefaults = false);
171  static CurveNodeIntfce CreateTimeWarpNode(FbxAnimCurve* pAnimCurve, const char* pFalloffName);
172 
174  static void RestrieveCurveNode(CurveNodeIntfce& pData, FbxIO* mFileObject);
175  static void StoreCurveNode(CurveNodeIntfce& pData, FbxIO* mFileObject);
176  static void ReleaseCurveNode(FbxAnimCurveNode* pCurveNode);
177  static void DestroyCurveNode(CurveNodeIntfce& pData);
178  static void DestroyCurve(CurveIntfce& pData);
179 
180  static void ConnectTimeWarp(FbxAnimCurveNode* pCurveNode, CurveNodeIntfce& pData, FbxMultiMap& pTimeWarpsKFCurveNodes);
181  static void MergeLayerAndTimeWarp(FbxObject* pObj, FbxAnimLayer* pAnimLayer);
182 
183  static void CopyFrom(FbxAnimCurve* pAC, CurveIntfce& pFC);
184  static bool CompareCurves(FbxAnimCurve* pAC1, FbxAnimCurve* pAC2);
185 
186  static void Resample(FbxAnimCurve &pSourceCurve, FbxAnimCurve &pTargetCurve, FbxTime &pStart, FbxTime &pStop, FbxTime &pPeriod, FbxAnimCurveDef::EInterpolationType pInterpolation, FbxAnimCurveDef::ETangentMode pTangentMode, bool pAddStopKey = false);
187  static void Resample(FbxAnimCurve &pSourceCurve, FbxAnimCurve &pTargetCurve, FbxTime &pStart, FbxTime &pStop, FbxTime &pPeriod, bool pAddStopKey = false);
188  static void Resample(FbxAnimCurve &pCurve, FbxTime pPeriod, FbxTime pStart = FBXSDK_TIME_MINUS_INFINITE, FbxTime pStop = FBXSDK_TIME_INFINITE, bool pKeysOnFrame = false);
189 };
190 
191 #include <fbxsdk/fbxsdk_nsend.h>
192 
193 #endif /* _FBXSDK_SCENE_ANIMATION_UTILITIES_H_ */
static void ConnectTimeWarp(FbxAnimCurveNode *pCurveNode, CurveNodeIntfce &pData, FbxMultiMap &pTimeWarpsKFCurveNodes)
static void ShareAnimCurves(FbxProperty &pDstProperty, FbxProperty &pSrcProperty, FbxScene *pScene)
The animation layer is a collection of animation curve nodes.
Definition: fbxanimlayer.h:30
static void ReleaseCurveNode(FbxAnimCurveNode *pCurveNode)
FBX SDK environment definition.
static void SetTimeWarpSet(FbxMultiMap *pTWset)
The Animation stack is a collection of animation layers.
Definition: fbxanimstack.h:37
This class is an composite of animation curves and is called as animation curve node.
bool operator==(CurveNodeIntfce &lRhs)
CurveIntfce & operator=(CurveIntfce &lRhs)
#define NULL
Definition: fbxarch.h:210
Utility class to manipulate strings.
Definition: fbxstring.h:66
EInterpolationType
Key interpolation type.
Definition: fbxanimcurve.h:49
static void Resample(FbxAnimCurve &pSourceCurve, FbxAnimCurve &pTargetCurve, FbxTime &pStart, FbxTime &pStop, FbxTime &pPeriod, FbxAnimCurveDef::EInterpolationType pInterpolation, FbxAnimCurveDef::ETangentMode pTangentMode, bool pAddStopKey=false)
static void CopyFrom(FbxAnimCurve *pAC, CurveIntfce &pFC)
ETangentMode
Key tangent mode for cubic interpolation.
Definition: fbxanimcurve.h:35
#define FBXSDK_TIME_INFINITE
Definition: fbxtime.h:23
bool operator==(CurveIntfce &lRhs)
Class to encapsulate time units.
Definition: fbxtime.h:44
The base class of most FBX objects.
Definition: fbxobject.h:157
CurveNodeIntfce & operator=(CurveNodeIntfce &lRhs)
This class contains the description of a 3D scene.
Definition: fbxscene.h:61
static void DestroyCurveNode(CurveNodeIntfce &pData)
static CurveNodeIntfce CreateTimeWarpNode(FbxAnimCurve *pAnimCurve, const char *pFalloffName)
Class to hold user properties.
Definition: fbxproperty.h:37
static int SplitAnimationIntoMultipleStacks(FbxScene *pScene, const FbxArray< FbxAnimSplitDef * > &pAnimSplitDefinitions, const FbxAnimStack *pSrcAnimStack, FbxArray< FbxAnimStack * > &pDstStacks)
FbxAnimSplitDef(const FbxString &pName, FbxTime &pStart, FbxTime &pEnd)
FbxIO represents an FBX file.
Definition: fbxio.h:324
An animation curve, defined by a collection of keys (FbxAnimCurveKey), and indicating how a value cha...
Definition: fbxanimcurve.h:779
static void DestroyCurve(CurveIntfce &pData)
static void MergeLayerAndTimeWarp(FbxObject *pObj, FbxAnimLayer *pAnimLayer)
#define FBXSDK_DLL
Definition: fbxarch.h:173
static bool CompareCurves(FbxAnimCurve *pAC1, FbxAnimCurve *pAC2)
#define FBXSDK_TIME_MINUS_INFINITE
Definition: fbxtime.h:24
static CurveNodeIntfce GrabCurveNode(FbxAnimCurveNode *pCN)
static void StoreCurveNode(CurveNodeIntfce &pData, FbxIO *mFileObject)
static void RestrieveCurveNode(CurveNodeIntfce &pData, FbxIO *mFileObject)
Class to manipulate a map that can contain multiple times the same key.
Definition: fbxmultimap.h:22
static CurveNodeIntfce CreateCurveNode(const char *pName)
Class for array of basic elements such as pointers and basic types.
Definition: fbxarray.h:23