00001
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXPOSE_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXPOSE_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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042
00043 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00044 #include <fbxfilesdk/kfbxplugins/kfbxgroupname.h>
00045
00046 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00047 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00048 #include <fbxfilesdk/components/kbaselib/klib/kname.h>
00049 #include <fbxfilesdk/kfbxmath/kfbxmatrix.h>
00050
00051 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00052
00056 typedef struct
00057 {
00059 KFbxMatrix mMatrix;
00061 bool mMatrixIsLocal;
00063 KFbxNode* mNode;
00064
00065 } KFbxPoseInfo;
00066
00067 class KFbxAnimStack;
00068 class KFbxScene;
00069 class KFbxUserNotification;
00070 class KFbxPose;
00071
00072 typedef KArrayTemplate<KFbxNode*> NodeList;
00073 typedef KArrayTemplate<KFbxPose*> PoseList;
00074 typedef KArrayTemplate<KFbxPoseInfo*> PoseInfoList;
00075
00129 class KFBX_DLL KFbxPose : public KFbxObject
00130 {
00131 KFBXOBJECT_DECLARE(KFbxPose,KFbxObject);
00132
00133 public:
00137 void SetIsBindPose(bool pIsBindPose);
00138
00142 bool IsBindPose() const { return mType == 'b'; }
00143
00147 bool IsRestPose() const { return mType == 'r'; }
00148
00152 int GetCount() const { return mPoseInfo.GetCount(); }
00153
00161 int Add(KFbxNode* pNode, const KFbxMatrix& pMatrix, bool pLocalMatrix = false, bool pMultipleBindPose = true);
00162
00166 void Remove(int pIndex);
00167
00173 KName GetNodeName(int pIndex) const;
00174
00181 KFbxNode* GetNode(int pIndex) const;
00182
00189 const KFbxMatrix& GetMatrix(int pIndex) const;
00190
00196 bool IsLocalMatrix(int pIndex) const;
00197
00205 enum KNameComponent {
00206 INITIALNAME_COMPONENT = 1,
00207 CURRENTNAME_COMPONENT = 2,
00208 ALL_NAME_COMPONENTS = 3
00209 };
00210
00216 int Find(const KName& pNodeName, char pCompareWhat = ALL_NAME_COMPONENTS) const;
00217
00222 int Find(const KFbxNode* pNode) const;
00224
00239 static bool GetPosesContaining(KFbxSdkManager& pManager, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00240
00250 static bool GetPosesContaining(KFbxScene* pScene, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00251
00262 static bool GetBindPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00263
00273 static bool GetBindPoseContaining(KFbxScene* pScene, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00274
00285 static bool GetRestPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00286
00296 static bool GetRestPoseContaining(KFbxScene* pScene, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00297
00314 bool IsValidBindPose(KFbxNode* pRoot, double pMatrixCmpTolerance=0.0001);
00315
00327 bool IsValidBindPoseVerbose(KFbxNode* pRoot, NodeList& pMissingAncestors, NodeList& pMissingDeformers, NodeList& pMissingDeformersAncestors, NodeList& pWrongMatrices, double pMatrixCmpTolerance=0.0001);
00328
00337 bool IsValidBindPoseVerbose(KFbxNode* pRoot, KFbxUserNotification* pUserNotification, double pMatrixCmpTolerance=0.0001);
00338
00346 KError& GetError();
00347
00352 typedef enum
00353 {
00354 eERROR,
00355 eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT,
00356 eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT,
00357 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES,
00358 eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES,
00359 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES,
00360 eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX,
00361 eERROR_COUNT
00362 } EError;
00363
00367 EError GetLastErrorID() const;
00368
00372 const char* GetLastErrorString() const;
00374
00376
00377
00378
00379
00380
00381
00383 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00384 protected:
00385 KFbxPose(KFbxSdkManager& pManager, char const* pName);
00386
00387 virtual KFbxObject& Copy(const KFbxObject& pObject);
00388 virtual void Destruct(bool pRecursive, bool pDependents);
00389 virtual const char* GetTypeName() const;
00390
00391
00392
00393 bool ValidateParams(const KFbxNode* pNode, const KFbxMatrix& pMatrix, int& pPos);
00394
00395 bool LocalValidateParams(const KFbxNode* pNode, const KFbxMatrix& pMatrix, int& pPos);
00396 static bool GetSpecificPoseContaining(int poseType, KFbxScene* pScene, KFbxNode* pNode, PoseList& pPoseList, KArrayTemplate<int>& pIndex);
00397
00398 KError mError;
00399
00400 private:
00401 KFbxPoseInfo* GetItem(int pIndex) const;
00402 bool IsValidBindPoseCommon(KFbxNode* pRoot, NodeList* pMissingAncestors, NodeList* pMissingDeformers, NodeList* pMissingDeformersAncestors, NodeList* pWrongMatrices, double pMatrixCmpTolerance=0.0001);
00403
00404 char mType;
00405 PoseInfoList mPoseInfo;
00406 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00407 };
00408
00409 typedef KFbxPose* HKFbxPose;
00410
00411 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00412
00413 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPOSE_H
00414