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
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044
00045 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00046 #include <fbxfilesdk/kfbxplugins/kfbxgroupname.h>
00047
00048 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00049 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00050 #include <fbxfilesdk/components/kbaselib/klib/kname.h>
00051 #include <fbxfilesdk/kfbxmath/kfbxmatrix.h>
00052
00053 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00054
00058 typedef struct
00059 {
00060 KFbxMatrix mMatrix;
00061 bool mMatrixIsLocal;
00062 KFbxNode* mNode;
00063
00064 } KFbxPoseInfo;
00065
00066 class KFbxScene;
00067 class KFbxUserNotification;
00068
00122 class KFBX_DLL KFbxPose : public KFbxObject
00123 {
00124 KFBXOBJECT_DECLARE(KFbxPose,KFbxObject);
00125 public:
00129 void SetIsBindPose(bool pIsBindPose);
00130
00134 bool IsBindPose() const { return mType == 'b'; }
00135
00139 bool IsRestPose() { return mType == 'r'; }
00140
00144 int GetCount() const { return mPoseInfo.GetCount(); }
00145
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);
00189
00190
00195 enum KNameComponent {
00196 INITIALNAME_COMPONENT = 1,
00197 CURRENTNAME_COMPONENT = 2,
00198 ALL_NAME_COMPONENTS = 3
00199 };
00200
00207 int Find(KName& pNodeName, char pCompareWhat = ALL_NAME_COMPONENTS);
00208
00214 int Find(KFbxNode* pNode);
00215
00216
00218
00222
00233 static bool GetPosesContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00234 KArrayTemplate<KFbxPose*>& pPoseList,
00235 KArrayTemplate<int>& pIndex);
00236
00246 static bool GetPosesContaining(KFbxScene* pScene, KFbxNode* pNode,
00247 KArrayTemplate<KFbxPose*>& pPoseList,
00248 KArrayTemplate<int>& pIndex);
00249
00260 static bool GetBindPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00261 KArrayTemplate<KFbxPose*>& pPoseList,
00262 KArrayTemplate<int>& pIndex);
00263
00273 static bool GetBindPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00274 KArrayTemplate<KFbxPose*>& pPoseList,
00275 KArrayTemplate<int>& pIndex);
00276
00287 static bool GetRestPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00288 KArrayTemplate<KFbxPose*>& pPoseList,
00289 KArrayTemplate<int>& pIndex);
00290
00300 static bool GetRestPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00301 KArrayTemplate<KFbxPose*>& pPoseList,
00302 KArrayTemplate<int>& pIndex);
00303
00320 bool IsValidBindPose(KFbxNode* pRoot, double pMatrixCmpTolerance=0.0001);
00321
00333 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00334 KArrayTemplate<KFbxNode*>& pMissingAncestors,
00335 KArrayTemplate<KFbxNode*>& pMissingDeformers,
00336 KArrayTemplate<KFbxNode*>& pMissingDeformersAncestors,
00337 KArrayTemplate<KFbxNode*>& pWrongMatrices,
00338 double pMatrixCmpTolerance=0.0001);
00339
00348 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00349 KFbxUserNotification* pUserNotification,
00350 double pMatrixCmpTolerance=0.0001);
00351
00356
00360 KError& GetError();
00361
00366 typedef enum
00367 {
00368 eERROR,
00369 eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT,
00370 eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT,
00371 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES,
00372 eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES,
00373 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES,
00374 eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX,
00375 eERROR_COUNT
00376 } EError;
00377
00381 EError GetLastErrorID() const;
00382
00386 const char* GetLastErrorString() const;
00387
00389
00390
00391
00393
00394
00395
00396
00397
00398
00400
00401 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00402
00403
00404 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00405
00406 protected:
00407
00412 KFbxPose(KFbxSdkManager& pManager, char const* pName);
00413
00417 ~KFbxPose();
00418
00419 virtual void Destruct(bool pRecursive, bool pDependents);
00420
00421
00422 virtual KString GetTypeName() const;
00423 virtual KStringList GetTypeFlags() const;
00424
00425 KError mError;
00426
00428 KFbxPose& operator=(KFbxPose const& pPose);
00429
00430
00431
00432
00433
00434
00435
00436 bool ValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00437
00438
00439 bool LocalValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00440
00441 static bool GetSpecificPoseContaining(
00442 int poseType,
00443 KFbxScene* pScene, KFbxNode* pNode,
00444 KArrayTemplate<KFbxPose*>& pPoseList,
00445 KArrayTemplate<int>& pIndex);
00446
00447 private:
00448
00449
00450 KFbxPoseInfo* GetItem(int pIndex);
00451
00452 private:
00453 char mType;
00454
00455 KArrayTemplate<KFbxPoseInfo*> mPoseInfo;
00456
00457 bool IsValidBindPoseCommon(KFbxNode* pRoot,
00458 KArrayTemplate<KFbxNode*>* pMissingAncestors,
00459 KArrayTemplate<KFbxNode*>* pMissingDeformers,
00460 KArrayTemplate<KFbxNode*>* pMissingDeformersAncestors,
00461 KArrayTemplate<KFbxNode*>* pWrongMatrices,
00462 double pMatrixCmpTolerance=0.0001);
00463
00464 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00465
00466 };
00467
00468 typedef KFbxPose* HKFbxPose;
00469
00470 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00471
00472 #endif // FBXFILESDK_KFBXPLUGINS_KFBXPOSE_H
00473