fbxpose.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_POSE_H_
00014 #define _FBXSDK_SCENE_POSE_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/core/base/fbxarray.h>
00020 #include <fbxsdk/core/math/fbxmatrix.h>
00021 
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023 
00024 class FbxStatus;
00025 class FbxPose;
00026 class FbxNode;
00027 class FbxUserNotification;
00028 
00032 struct FbxPoseInfo
00033 {
00034     FbxMatrix   mMatrix;        
00035     bool        mMatrixIsLocal; 
00036     FbxNode*    mNode;          
00037 };
00038 
00039 typedef FbxArray<FbxNode*> NodeList;
00040 typedef FbxArray<FbxPose*> PoseList;
00041 typedef FbxArray<FbxPoseInfo*> PoseInfoList;
00042 
00096 class FBXSDK_DLL FbxPose : public FbxObject
00097 {
00098     FBXSDK_OBJECT_DECLARE(FbxPose,FbxObject);
00099 
00100 public:
00104     void SetIsBindPose(bool pIsBindPose);
00105 
00109     bool IsBindPose() const { return mType == 'b'; }
00110 
00114     bool IsRestPose() const { return mType == 'r'; }
00115 
00119     int GetCount() const { return mPoseInfo.GetCount(); }
00120 
00128     int Add(FbxNode* pNode, const FbxMatrix& pMatrix, bool pLocalMatrix = false, bool pMultipleBindPose = true);
00129 
00133     void Remove(int pIndex);
00134 
00140     FbxNameHandler GetNodeName(int pIndex) const;
00141 
00148     FbxNode* GetNode(int pIndex) const;
00149 
00156     const FbxMatrix& GetMatrix(int pIndex)       const;
00157 
00163     bool IsLocalMatrix(int pIndex) const;
00164 
00172         enum ENameComponent
00173         {
00174             eInitialNameComponent = 1,  
00175             eCurrentNameComponent = 2,  
00176             eAllNameComponents = 3      
00177         };
00178 
00184         int Find(const FbxNameHandler& pNodeName, char pCompareWhat = eAllNameComponents) const;
00185 
00190         int Find(const FbxNode* pNode) const;
00192 
00207         static bool GetPosesContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00208 
00218         static bool GetPosesContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00219 
00230         static bool GetBindPoseContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00231 
00241         static bool GetBindPoseContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00242 
00253         static bool GetRestPoseContaining(FbxManager& pManager, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00254 
00264         static bool GetRestPoseContaining(FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00265 
00283         bool IsValidBindPose(FbxNode* pRoot, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL);
00284 
00297         bool IsValidBindPoseVerbose(FbxNode* pRoot, NodeList& pMissingAncestors, NodeList& pMissingDeformers, NodeList& pMissingDeformersAncestors, NodeList& pWrongMatrices, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL);
00298 
00308         bool IsValidBindPoseVerbose(FbxNode* pRoot, FbxUserNotification* pUserNotification, double pMatrixCmpTolerance=0.0001, FbxStatus* pStatus = NULL);
00309 
00311 
00312 /*****************************************************************************************************************************
00313 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00314 *****************************************************************************************************************************/
00315 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00316 protected:
00317     virtual void Construct(const FbxPose* pFrom);
00318     virtual void Destruct(bool pRecursive);
00319     virtual void ConstructProperties(bool pForceSet);
00320 
00321     virtual FbxObject&  Copy(const FbxObject& pObject);
00322     virtual const char* GetTypeName() const;
00323 
00324     //Returns false if pNode is already inserted in the list and the current matrix is different from the stored one. Also, if this pose is a rest pose, check if
00325     //pNode belongs to other BindPoses (accessed through the scene pointer). pPos will contains the index of the FbxPoseInfo if the parameters are already stored in this object.
00326     bool                ValidateParams(const FbxNode* pNode, const FbxMatrix& pMatrix, int& pPos);
00327 
00328     bool                LocalValidateParams(const FbxNode* pNode, const FbxMatrix& pMatrix, int& pPos);
00329     static bool         GetSpecificPoseContaining(int poseType, FbxScene* pScene, FbxNode* pNode, PoseList& pPoseList, FbxArray<int>& pIndex);
00330 
00331 private:
00332     FbxPoseInfo*        GetItem(int pIndex) const;
00333     void                UpdatePosInfoList();
00334     bool                IsValidBindPoseCommon(FbxNode* pRoot, NodeList* pMissingAncestors, NodeList* pMissingDeformers, NodeList* pMissingDeformersAncestors, NodeList* pWrongMatrices, FbxStatus* pStatus, double pMatrixCmpTolerance=0.0001);
00335 
00336     char                        mType;
00337     PoseInfoList                mPoseInfo;
00338     bool                        mPoseInfoIsDirty;
00339     FbxPropertyT<FbxReference>  Nodes;
00340 
00341 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00342 };
00343 
00344 #include <fbxsdk/fbxsdk_nsend.h>
00345 
00346 #endif /* _FBXSDK_SCENE_POSE_H_ */