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 {
00058 KFbxMatrix mMatrix;
00059 bool mMatrixIsLocal;
00060 KFbxNode* mNode;
00061
00062 } KFbxPoseInfo;
00063
00064 class KFbxAnimStack;
00065 class KFbxScene;
00066 class KFbxUserNotification;
00067
00121 class KFBX_DLL KFbxPose : public KFbxObject
00122 {
00123 KFBXOBJECT_DECLARE(KFbxPose,KFbxObject);
00124 public:
00128 void SetIsBindPose(bool pIsBindPose);
00129
00133 bool IsBindPose() const { return mType == 'b'; }
00134
00138 bool IsRestPose() const { return mType == 'r'; }
00139
00143 int GetCount() const { return mPoseInfo.GetCount(); }
00144
00153 int Add(KFbxNode* pNode, KFbxMatrix& pMatrix, bool pLocalMatrix = false, bool pMultipleBindPose = true);
00154
00158 void Remove(int pIndex);
00159
00165 KName GetNodeName(int pIndex) const;
00166
00173 KFbxNode* GetNode(int pIndex) const;
00174
00181 const KFbxMatrix& GetMatrix(int pIndex) const;
00182
00188 bool IsLocalMatrix(int pIndex) const;
00189
00190
00198 enum KNameComponent {
00199 INITIALNAME_COMPONENT = 1,
00200 CURRENTNAME_COMPONENT = 2,
00201 ALL_NAME_COMPONENTS = 3
00202 };
00203
00210 int Find(const KName& pNodeName, char pCompareWhat = ALL_NAME_COMPONENTS) const;
00211
00217 int Find(const KFbxNode* pNode) const;
00218
00219
00221
00225
00236 static bool GetPosesContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00237 KArrayTemplate<KFbxPose*>& pPoseList,
00238 KArrayTemplate<int>& pIndex);
00239
00249 static bool GetPosesContaining(KFbxScene* pScene, KFbxNode* pNode,
00250 KArrayTemplate<KFbxPose*>& pPoseList,
00251 KArrayTemplate<int>& pIndex);
00252
00263 static bool GetBindPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00264 KArrayTemplate<KFbxPose*>& pPoseList,
00265 KArrayTemplate<int>& pIndex);
00266
00276 static bool GetBindPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00277 KArrayTemplate<KFbxPose*>& pPoseList,
00278 KArrayTemplate<int>& pIndex);
00279
00290 static bool GetRestPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00291 KArrayTemplate<KFbxPose*>& pPoseList,
00292 KArrayTemplate<int>& pIndex);
00293
00303 static bool GetRestPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00304 KArrayTemplate<KFbxPose*>& pPoseList,
00305 KArrayTemplate<int>& pIndex);
00306
00323 bool IsValidBindPose(KFbxNode* pRoot, double pMatrixCmpTolerance=0.0001);
00324
00336 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00337 KArrayTemplate<KFbxNode*>& pMissingAncestors,
00338 KArrayTemplate<KFbxNode*>& pMissingDeformers,
00339 KArrayTemplate<KFbxNode*>& pMissingDeformersAncestors,
00340 KArrayTemplate<KFbxNode*>& pWrongMatrices,
00341 double pMatrixCmpTolerance=0.0001);
00342
00351 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00352 KFbxUserNotification* pUserNotification,
00353 double pMatrixCmpTolerance=0.0001);
00354
00359
00363 KError& GetError();
00364
00369 typedef enum
00370 {
00371 eERROR,
00372 eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT,
00373 eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT,
00374 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES,
00375 eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES,
00376 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES,
00377 eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX,
00378 eERROR_COUNT
00379 } EError;
00380
00384 EError GetLastErrorID() const;
00385
00389 const char* GetLastErrorString() const;
00390
00392
00393
00394
00396
00397
00398
00399
00400
00401
00403
00404 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00405
00406
00407 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00408
00409 protected:
00410
00415 KFbxPose(KFbxSdkManager& pManager, char const* pName);
00416
00417 virtual void Destruct(bool pRecursive, bool pDependents);
00418
00419
00420 virtual KString GetTypeName() const;
00421
00422 KError mError;
00423
00424
00425
00426
00427
00428
00429
00430 bool ValidateParams(const KFbxNode* pNode, const KFbxMatrix& pMatrix, int& pPos);
00431
00432
00433 bool LocalValidateParams(const KFbxNode* pNode, const KFbxMatrix& pMatrix, int& pPos);
00434
00435 static bool GetSpecificPoseContaining(
00436 int poseType,
00437 KFbxScene* pScene, KFbxNode* pNode,
00438 KArrayTemplate<KFbxPose*>& pPoseList,
00439 KArrayTemplate<int>& pIndex);
00440
00441 private:
00442
00443
00444 KFbxPoseInfo* GetItem(int pIndex) const;
00445
00446 private:
00447 char mType;
00448
00449 KArrayTemplate<KFbxPoseInfo*> mPoseInfo;
00450
00451 bool IsValidBindPoseCommon(KFbxNode* pRoot,
00452 KArrayTemplate<KFbxNode*>* pMissingAncestors,
00453 KArrayTemplate<KFbxNode*>* pMissingDeformers,
00454 KArrayTemplate<KFbxNode*>* pMissingDeformersAncestors,
00455 KArrayTemplate<KFbxNode*>* pWrongMatrices,
00456 double pMatrixCmpTolerance=0.0001);
00457
00458 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00459
00460 };
00461
00462 typedef KFbxPose* HKFbxPose;
00463
00464 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00465
00466 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPOSE_H
00467