fbxskeleton.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /****************************************************************************************
  2. Copyright (C) 2015 Autodesk, Inc.
  3. All rights reserved.
  4. Use of this software is subject to the terms of the Autodesk license agreement
  5. provided at the time of installation or download, or which otherwise accompanies
  6. this software in either electronic or hard copy form.
  7. ****************************************************************************************/
  8. //! \file fbxskeleton.h
  9. #ifndef _FBXSDK_SCENE_GEOMETRY_SKELETON_H_
  10. #define _FBXSDK_SCENE_GEOMETRY_SKELETON_H_
  11. #include <fbxsdk/fbxsdk_def.h>
  12. #include <fbxsdk/scene/geometry/fbxnodeattribute.h>
  13. #include <fbxsdk/fbxsdk_nsbegin.h>
  14. /** This class specializes a node attribute to represent the elements forming "bone"
  15. * chains. The FbxSkeleton name of the class comes from the analogy with the human body
  16. * skeletal structure. In fact, an object of this type is nothing more than a transform
  17. * node with special properties that are useful for its graphical representation and during
  18. * IK/FK and skin deformation computations. Typically, a scene will contain chains of FbxSkeleton
  19. * node attributes that, together, form a skeleton segment. For instance, the representation of the
  20. * leg of a character can be achieved using one parent node with the attribute eRoot, followed by
  21. * one child (femur) of type eLimb, this child having a child also (tibia) of the same type. Finally,
  22. * terminated with a last node attribute of type eEffector (ankle).
  23. *
  24. * \nosubgrouping
  25. */
  26. class FBXSDK_DLL FbxSkeleton : public FbxNodeAttribute
  27. {
  28. FBXSDK_OBJECT_DECLARE(FbxSkeleton,FbxNodeAttribute);
  29. public:
  30. //! Return the type of node attribute (i.e: FbxNodeAttribute::EType::eSkeleton).
  31. virtual FbxNodeAttribute::EType GetAttributeType() const;
  32. //! Reset the skeleton to default values and type to \c eRoot.
  33. void Reset();
  34. /**
  35. * \name Skeleton Properties
  36. */
  37. //@{
  38. /** \enum EType Skeleton types.
  39. * \remarks \e eEffector is synonymous to \e eRoot.
  40. * \remarks The \e eLimbNode type is a bone defined uniquely by a transform and a size value while
  41. * \remarks the \e eLimb type is a bone defined by a transform and a length.
  42. */
  43. enum EType
  44. {
  45. eRoot, /*!< First element of a chain. */
  46. eLimb, /*!< Chain element. */
  47. eLimbNode, /*!< Chain element. */
  48. eEffector /*!< Last element of a chain. */
  49. };
  50. /** Set the skeleton type.
  51. * \param pSkeletonType Skeleton type identifier.
  52. */
  53. void SetSkeletonType(EType pSkeletonType);
  54. /** Get the skeleton type.
  55. * \return Skeleton type identifier.
  56. */
  57. EType GetSkeletonType() const;
  58. /** Get a flag to know if the skeleton type was set.
  59. * \return \c true if a call to SetSkeletonType() has been made.
  60. * \remarks When the attribute is not set, the application can choose to ignore the attribute or use the default value.
  61. * \remarks The flag is set back to \c false when Reset() is called.
  62. */
  63. bool GetSkeletonTypeIsSet() const;
  64. /** Get the default value for the skeleton type.
  65. * \return \c eRoot
  66. */
  67. EType GetSkeletonTypeDefaultValue() const;
  68. /** Get the default value for the limb length.
  69. * \return 1.0
  70. */
  71. double GetLimbLengthDefaultValue() const;
  72. /** Get the default value for the limb node size.
  73. * \return 100.0
  74. */
  75. double GetLimbNodeSizeDefaultValue() const;
  76. /** Set limb or limb node color.
  77. * \param pColor RGB values for the limb color.
  78. * \return \c true if skeleton type is \c eLimb or \c eLimbNode, \c false otherwise.
  79. * \remarks Limb or limb node color is only set if skeleton type is \c eLimb or \c eLimbNode.
  80. */
  81. bool SetLimbNodeColor(const FbxColor& pColor);
  82. /** Get limb or limb node color.
  83. * \return Currently set limb color.
  84. * \remarks Limb or limb node color is only valid if skeleton type is \c eLimb or \c eLimbNode.
  85. */
  86. FbxColor GetLimbNodeColor() const;
  87. /** Get a flag to know if the limb node color was set.
  88. * \return \c true if a call to SetLimbNodeColor() has been made.
  89. * \remarks When the attribute is not set, the application can choose to ignore the attribute or use the default value.
  90. * \remarks The flag is set back to \c false when Reset() is called.
  91. */
  92. bool GetLimbNodeColorIsSet() const;
  93. /** Get the default value for the limb node color.
  94. * \return R=0.8, G=0.8, B=0.8
  95. */
  96. FbxColor GetLimbNodeColorDefaultValue() const;
  97. /** To see if this skeleton is Root.
  98. * \return \c true if this is root of the skeleton, \c false otherwise.
  99. * \remarks if a skeleton node do not have a parent or its parent is not a skeleton node itself, then this
  100. * skeleton is root in the hierarchy.
  101. */
  102. bool IsSkeletonRoot() const;
  103. //@}
  104. /**
  105. * \name Property Names
  106. */
  107. static const char* sSize;
  108. static const char* sLimbLength;
  109. /**
  110. * \name Property Default Values
  111. */
  112. //@{
  113. static const FbxDouble sDefaultSize;
  114. static const FbxDouble sDefaultLimbLength;
  115. //////////////////////////////////////////////////////////////////////////
  116. //
  117. // Properties
  118. //
  119. //////////////////////////////////////////////////////////////////////////
  120. /** This property handles the limb node size.
  121. *
  122. * To access this property do: Size.Get().
  123. * To set this property do: Size.Set(FbxDouble).
  124. *
  125. * Default value is 100.0
  126. */
  127. FbxPropertyT<FbxDouble> Size;
  128. /** This property handles the skeleton limb length.
  129. *
  130. * To access this property do: LimbLength.Get().
  131. * To set this property do: LimbLength.Set(FbxDouble).
  132. *
  133. * FbxSkeleton is a node attribute and it will be attached to a FbxNode which represents the transform.
  134. * Given a chain of skeleton nodes the parent and child skeletons will be attached to a parent node and a child node.
  135. * The orientation of the limb is computed from the vector between the parent and child position (from parent to child).
  136. * The LimbLength represents the proportion
  137. * of the parent node's position to the child node's position which is used to compute the actual limb length.
  138. * The default value of 1.0 means the LimbLength is equal to the length between the parent and child node's position.
  139. * So if the value is 0.5, it means the LimbLength will be half of the length between the parent and child node's position.
  140. */
  141. FbxPropertyT<FbxDouble> LimbLength;
  142. /*****************************************************************************************************************************
  143. ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
  144. *****************************************************************************************************************************/
  145. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  146. virtual FbxObject& Copy(const FbxObject& pObject);
  147. protected:
  148. virtual void Construct(const FbxObject* pFrom);
  149. virtual void ConstructProperties(bool pForceSet);
  150. void Reset( bool pResetProperties );
  151. virtual const char* GetTypeName() const;
  152. virtual FbxStringList GetTypeFlags() const;
  153. EType mSkeletonType;
  154. bool mLimbLengthIsSet;
  155. bool mLimbNodeSizeIsSet;
  156. bool mLimbNodeColorIsSet;
  157. bool mSkeletonTypeIsSet;
  158. #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
  159. };
  160. #include <fbxsdk/fbxsdk_nsend.h>
  161. #endif /* _FBXSDK_SCENE_GEOMETRY_SKELETON_H_ */