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 KFbxPose_internal;
00072 class KFbxUserNotification;
00073
00127 class KFBX_DLL KFbxPose : public KFbxObject
00128 {
00129 KFBXOBJECT_DECLARE(KFbxPose);
00130 public:
00134 void SetIsBindPose(bool pIsBindPose);
00135
00139 bool IsBindPose() const { return mType == 'b'; }
00140
00144 bool IsRestPose() { return mType == 'r'; }
00145
00149 int GetCount() const { return mPoseInfo.GetCount(); }
00150
00157 int Add(KFbxNode* pNode, KFbxMatrix& pMatrix, bool pLocalMatrix = false);
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
00195
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();
00386
00390 char* GetLastErrorString();
00391
00393
00397 virtual KFbxObject::ENameSpace GetNameSpace() const;
00398
00399
00401
00402
00403
00404
00405
00406
00408
00409 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00410
00411
00412 virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00413
00414 protected:
00415 static char const* GetNamePrefix() { return POSE_PREFIX; }
00416
00421 KFbxPose(KFbxSdkManager& pManager, char const* pName);
00422
00426 ~KFbxPose();
00427
00428 virtual void Destruct(bool pRecursive, bool pDependents);
00429
00430
00431 virtual KString GetTypeName() const;
00432 virtual KStringList GetTypeFlags() const;
00433
00434
00435 KFbxPose_internal* mPH;
00436
00437 KError mError;
00438
00439 virtual KObject* GetFbxObject_internal();
00440 virtual KObject const* GetFbxObject_internal() const;
00441
00443 KFbxPose& operator=(KFbxPose const& pPose);
00444
00445
00446
00447
00448
00449
00450
00451 bool ValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00452
00453
00454 bool LocalValidateParams(KFbxNode* pNode, KFbxMatrix& pMatrix, int& pPos);
00455
00456 static bool GetSpecificPoseContaining(
00457 int poseType,
00458 KFbxScene* pScene, KFbxNode* pNode,
00459 KArrayTemplate<KFbxPose*>& pPoseList,
00460 KArrayTemplate<int>& pIndex);
00461
00462 friend class KFbxReaderFbx;
00463 friend class KFbxWriterFbx6;
00464
00465 private:
00466
00467
00468 KFbxPoseInfo* GetItem(int pIndex);
00469
00470 private:
00471 char mType;
00472
00473 KArrayTemplate<KFbxPoseInfo*> mPoseInfo;
00474
00475 bool IsValidBindPoseCommon(KFbxNode* pRoot,
00476 KArrayTemplate<KFbxNode*>* pMissingAncestors,
00477 KArrayTemplate<KFbxNode*>* pMissingDeformers,
00478 KArrayTemplate<KFbxNode*>* pMissingDeformersAncestors,
00479 KArrayTemplate<KFbxNode*>* pWrongMatrices,
00480 double pMatrixCmpTolerance=0.0001);
00481
00482 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00483
00484 };
00485
00486 typedef KFbxPose* HKFbxPose;
00487
00488 #include <fbxfilesdk_nsend.h>
00489
00490 #endif // #ifndef _FBXSDK_POSE_H_
00491
00492