00001
00004 #ifndef _FBXSDK_POSE_H_
00005 #define _FBXSDK_POSE_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 <kaydaradef.h>
00043 #ifndef KFBX_DLL
00044 #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046
00047 #include <kaydara.h>
00048
00049 #include <kfbxplugins/kfbxobject.h>
00050 #include <kfbxplugins/kfbxgroupname.h>
00051
00052 #include <klib/kstring.h>
00053 #include <klib/karrayul.h>
00054 #include <klib/kname.h>
00055 #include <kfbxmath/kfbxmatrix.h>
00056
00057 #include <fbxfilesdk_nsbegin.h>
00058
00062 typedef struct
00063 {
00064 KFbxMatrix mMatrix;
00065 bool mMatrixIsLocal;
00066 KFbxNode* mNode;
00067
00068 } KFbxPoseInfo;
00069
00070 class KFbxScene;
00071 class KFbxUserNotification;
00072
00126 class KFBX_DLL KFbxPose : public KFbxObject
00127 {
00128 KFBXOBJECT_DECLARE(KFbxPose,KFbxObject);
00129 public:
00133 void SetIsBindPose(bool pIsBindPose);
00134
00138 bool IsBindPose() const { return mType == 'b'; }
00139
00143 bool IsRestPose() { return mType == 'r'; }
00144
00148 int GetCount() const { return mPoseInfo.GetCount(); }
00149
00157 int Add(KFbxNode* pNode, KFbxMatrix& pMatrix, bool pLocalMatrix = false, bool pMultipleBindPose = true);
00158
00162 void Remove(int pIndex);
00163
00169 KName GetNodeName(int pIndex) const;
00170
00177 KFbxNode* GetNode(int pIndex) const;
00178
00185 const KFbxMatrix& GetMatrix(int pIndex) const;
00186
00192 bool IsLocalMatrix(int pIndex);
00193
00194
00199 enum KNameComponent {
00200 INITIALNAME_COMPONENT = 1,
00201 CURRENTNAME_COMPONENT = 2,
00202 ALL_NAME_COMPONENTS = 3
00203 };
00204
00211 int Find(KName& pNodeName, char pCompareWhat = ALL_NAME_COMPONENTS);
00212
00218 int Find(KFbxNode* pNode);
00219
00220
00222
00226
00237 static bool GetPosesContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00238 KArrayTemplate<KFbxPose*>& pPoseList,
00239 KArrayTemplate<int>& pIndex);
00240
00250 static bool GetPosesContaining(KFbxScene* pScene, KFbxNode* pNode,
00251 KArrayTemplate<KFbxPose*>& pPoseList,
00252 KArrayTemplate<int>& pIndex);
00253
00264 static bool GetBindPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00265 KArrayTemplate<KFbxPose*>& pPoseList,
00266 KArrayTemplate<int>& pIndex);
00267
00277 static bool GetBindPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00278 KArrayTemplate<KFbxPose*>& pPoseList,
00279 KArrayTemplate<int>& pIndex);
00280
00291 static bool GetRestPoseContaining(KFbxSdkManager& pManager, KFbxNode* pNode,
00292 KArrayTemplate<KFbxPose*>& pPoseList,
00293 KArrayTemplate<int>& pIndex);
00294
00304 static bool GetRestPoseContaining(KFbxScene* pScene, KFbxNode* pNode,
00305 KArrayTemplate<KFbxPose*>& pPoseList,
00306 KArrayTemplate<int>& pIndex);
00307
00324 bool IsValidBindPose(KFbxNode* pRoot, double pMatrixCmpTolerance=0.0001);
00325
00337 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00338 KArrayTemplate<KFbxNode*>& pMissingAncestors,
00339 KArrayTemplate<KFbxNode*>& pMissingDeformers,
00340 KArrayTemplate<KFbxNode*>& pMissingDeformersAncestors,
00341 KArrayTemplate<KFbxNode*>& pWrongMatrices,
00342 double pMatrixCmpTolerance=0.0001);
00343
00352 bool IsValidBindPoseVerbose(KFbxNode* pRoot,
00353 KFbxUserNotification* pUserNotification,
00354 double pMatrixCmpTolerance=0.0001);
00355
00360
00364 KError& GetError();
00365
00370 typedef enum
00371 {
00372 eERROR,
00373 eERROR_VALIDBINDPOSE_FAILURE_INVALIDOBJECT,
00374 eERROR_VALIDBINDPOSE_FAILURE_INVALIDROOT,
00375 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_NODES,
00376 eERROR_VALIDBINDPOSE_FAILURE_NOTALLDEFORMING_NODES,
00377 eERROR_VALIDBINDPOSE_FAILURE_NOTALLANCESTORS_DEFNODES,
00378 eERROR_VALIDBINDPOSE_FAILURE_RELATIVEMATRIX,
00379 eERROR_COUNT
00380 } EError;
00381
00385 EError GetLastErrorID() const;
00386
00390 const char* GetLastErrorString() const;
00391
00393
00394
00395
00397
00398
00399
00400
00401
00402
00404
00405 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00406
00407
00408 virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00409
00410 protected:
00411
00416 KFbxPose(KFbxSdkManager& pManager, char const* pName);
00417
00421 ~KFbxPose();
00422
00423 virtual void Destruct(bool pRecursive, bool pDependents);
00424
00425
00426 virtual KString GetTypeName() const;
00427 virtual KStringList GetTypeFlags() const;
00428
00429 KError mError;
00430
00432 KFbxPose& operator=(KFbxPose const& pPose);
00433
00434
00435
00436
00437
00438
00439
00440 bool ValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00441
00442
00443 bool LocalValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00444
00445 static bool GetSpecificPoseContaining(
00446 int poseType,
00447 KFbxScene* pScene, KFbxNode* pNode,
00448 KArrayTemplate<KFbxPose*>& pPoseList,
00449 KArrayTemplate<int>& pIndex);
00450
00451 friend class KFbxReaderFbx;
00452 friend class KFbxWriterFbx6;
00453
00454 private:
00455
00456
00457 KFbxPoseInfo* GetItem(int pIndex);
00458
00459 private:
00460 char mType;
00461
00462 KArrayTemplate<KFbxPoseInfo*> mPoseInfo;
00463
00464 bool IsValidBindPoseCommon(KFbxNode* pRoot,
00465 KArrayTemplate<KFbxNode*>* pMissingAncestors,
00466 KArrayTemplate<KFbxNode*>* pMissingDeformers,
00467 KArrayTemplate<KFbxNode*>* pMissingDeformersAncestors,
00468 KArrayTemplate<KFbxNode*>* pWrongMatrices,
00469 double pMatrixCmpTolerance=0.0001);
00470
00471 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00472
00473 };
00474
00475 typedef KFbxPose* HKFbxPose;
00476
00477 #include <fbxfilesdk_nsend.h>
00478
00479 #endif // #ifndef _FBXSDK_POSE_H_
00480
00481