class_skeletonprofile.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/SkeletonProfile.xml.
  6. .. _class_SkeletonProfile:
  7. SkeletonProfile
  8. ===============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`SkeletonProfileHumanoid<class_SkeletonProfileHumanoid>`
  11. Base class for a profile of a virtual skeleton used as a target for retargeting.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. This resource is used in :ref:`EditorScenePostImport<class_EditorScenePostImport>`. Some parameters are referring to bones in :ref:`Skeleton3D<class_Skeleton3D>`, :ref:`Skin<class_Skin>`, :ref:`Animation<class_Animation>`, and some other nodes are rewritten based on the parameters of **SkeletonProfile**.
  16. \ **Note:** These parameters need to be set only when creating a custom profile. In :ref:`SkeletonProfileHumanoid<class_SkeletonProfileHumanoid>`, they are defined internally as read-only values.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - :doc:`Retargeting 3D Skeletons <../tutorials/assets_pipeline/retargeting_3d_skeletons>`
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-------------------------------------+------------------------------------------------------------------------+---------+
  27. | :ref:`int<class_int>` | :ref:`bone_size<class_SkeletonProfile_property_bone_size>` | ``0`` |
  28. +-------------------------------------+------------------------------------------------------------------------+---------+
  29. | :ref:`int<class_int>` | :ref:`group_size<class_SkeletonProfile_property_group_size>` | ``0`` |
  30. +-------------------------------------+------------------------------------------------------------------------+---------+
  31. | :ref:`StringName<class_StringName>` | :ref:`root_bone<class_SkeletonProfile_property_root_bone>` | ``&""`` |
  32. +-------------------------------------+------------------------------------------------------------------------+---------+
  33. | :ref:`StringName<class_StringName>` | :ref:`scale_base_bone<class_SkeletonProfile_property_scale_base_bone>` | ``&""`` |
  34. +-------------------------------------+------------------------------------------------------------------------+---------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`find_bone<class_SkeletonProfile_method_find_bone>` **(** :ref:`StringName<class_StringName>` bone_name **)** |const| |
  42. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`StringName<class_StringName>` | :ref:`get_bone_name<class_SkeletonProfile_method_get_bone_name>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  44. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`StringName<class_StringName>` | :ref:`get_bone_parent<class_SkeletonProfile_method_get_bone_parent>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  46. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`StringName<class_StringName>` | :ref:`get_bone_tail<class_SkeletonProfile_method_get_bone_tail>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  48. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`StringName<class_StringName>` | :ref:`get_group<class_SkeletonProfile_method_get_group>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  50. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`StringName<class_StringName>` | :ref:`get_group_name<class_SkeletonProfile_method_get_group_name>` **(** :ref:`int<class_int>` group_idx **)** |const| |
  52. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Vector2<class_Vector2>` | :ref:`get_handle_offset<class_SkeletonProfile_method_get_handle_offset>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  54. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_reference_pose<class_SkeletonProfile_method_get_reference_pose>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  56. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` | :ref:`get_tail_direction<class_SkeletonProfile_method_get_tail_direction>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  58. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_texture<class_SkeletonProfile_method_get_texture>` **(** :ref:`int<class_int>` group_idx **)** |const| |
  60. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`set_bone_name<class_SkeletonProfile_method_set_bone_name>` **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_name **)** |
  62. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_bone_parent<class_SkeletonProfile_method_set_bone_parent>` **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_parent **)** |
  64. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_bone_tail<class_SkeletonProfile_method_set_bone_tail>` **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_tail **)** |
  66. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_group<class_SkeletonProfile_method_set_group>` **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` group **)** |
  68. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`set_group_name<class_SkeletonProfile_method_set_group_name>` **(** :ref:`int<class_int>` group_idx, :ref:`StringName<class_StringName>` group_name **)** |
  70. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_handle_offset<class_SkeletonProfile_method_set_handle_offset>` **(** :ref:`int<class_int>` bone_idx, :ref:`Vector2<class_Vector2>` handle_offset **)** |
  72. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`set_reference_pose<class_SkeletonProfile_method_set_reference_pose>` **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` bone_name **)** |
  74. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_tail_direction<class_SkeletonProfile_method_set_tail_direction>` **(** :ref:`int<class_int>` bone_idx, :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` tail_direction **)** |
  76. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_texture<class_SkeletonProfile_method_set_texture>` **(** :ref:`int<class_int>` group_idx, :ref:`Texture2D<class_Texture2D>` texture **)** |
  78. +----------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. .. rst-class:: classref-section-separator
  80. ----
  81. .. rst-class:: classref-descriptions-group
  82. Signals
  83. -------
  84. .. _class_SkeletonProfile_signal_profile_updated:
  85. .. rst-class:: classref-signal
  86. **profile_updated** **(** **)**
  87. This signal is emitted when change the value in profile. This is used to update key name in the :ref:`BoneMap<class_BoneMap>` and to redraw the :ref:`BoneMap<class_BoneMap>` editor.
  88. \ **Note:** This signal is not connected directly to editor to simplify the reference, instead it is passed on to editor through the :ref:`BoneMap<class_BoneMap>`.
  89. .. rst-class:: classref-section-separator
  90. ----
  91. .. rst-class:: classref-descriptions-group
  92. Enumerations
  93. ------------
  94. .. _enum_SkeletonProfile_TailDirection:
  95. .. rst-class:: classref-enumeration
  96. enum **TailDirection**:
  97. .. _class_SkeletonProfile_constant_TAIL_DIRECTION_AVERAGE_CHILDREN:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` **TAIL_DIRECTION_AVERAGE_CHILDREN** = ``0``
  100. Direction to the average coordinates of bone children.
  101. .. _class_SkeletonProfile_constant_TAIL_DIRECTION_SPECIFIC_CHILD:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` **TAIL_DIRECTION_SPECIFIC_CHILD** = ``1``
  104. Direction to the coordinates of specified bone child.
  105. .. _class_SkeletonProfile_constant_TAIL_DIRECTION_END:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` **TAIL_DIRECTION_END** = ``2``
  108. Direction is not calculated.
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Property Descriptions
  113. ---------------------
  114. .. _class_SkeletonProfile_property_bone_size:
  115. .. rst-class:: classref-property
  116. :ref:`int<class_int>` **bone_size** = ``0``
  117. .. rst-class:: classref-property-setget
  118. - void **set_bone_size** **(** :ref:`int<class_int>` value **)**
  119. - :ref:`int<class_int>` **get_bone_size** **(** **)**
  120. The amount of bones in retargeting section's :ref:`BoneMap<class_BoneMap>` editor. For example, :ref:`SkeletonProfileHumanoid<class_SkeletonProfileHumanoid>` has 56 bones.
  121. The size of elements in :ref:`BoneMap<class_BoneMap>` updates when changing this property in it's assigned **SkeletonProfile**.
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_SkeletonProfile_property_group_size:
  125. .. rst-class:: classref-property
  126. :ref:`int<class_int>` **group_size** = ``0``
  127. .. rst-class:: classref-property-setget
  128. - void **set_group_size** **(** :ref:`int<class_int>` value **)**
  129. - :ref:`int<class_int>` **get_group_size** **(** **)**
  130. The amount of groups of bones in retargeting section's :ref:`BoneMap<class_BoneMap>` editor. For example, :ref:`SkeletonProfileHumanoid<class_SkeletonProfileHumanoid>` has 4 groups.
  131. This property exists to separate the bone list into several sections in the editor.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_SkeletonProfile_property_root_bone:
  135. .. rst-class:: classref-property
  136. :ref:`StringName<class_StringName>` **root_bone** = ``&""``
  137. .. rst-class:: classref-property-setget
  138. - void **set_root_bone** **(** :ref:`StringName<class_StringName>` value **)**
  139. - :ref:`StringName<class_StringName>` **get_root_bone** **(** **)**
  140. A bone name that will be used as the root bone in :ref:`AnimationTree<class_AnimationTree>`. This should be the bone of the parent of hips that exists at the world origin.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_SkeletonProfile_property_scale_base_bone:
  144. .. rst-class:: classref-property
  145. :ref:`StringName<class_StringName>` **scale_base_bone** = ``&""``
  146. .. rst-class:: classref-property-setget
  147. - void **set_scale_base_bone** **(** :ref:`StringName<class_StringName>` value **)**
  148. - :ref:`StringName<class_StringName>` **get_scale_base_bone** **(** **)**
  149. A bone name which will use model's height as the coefficient for normalization. For example, :ref:`SkeletonProfileHumanoid<class_SkeletonProfileHumanoid>` defines it as ``Hips``.
  150. .. rst-class:: classref-section-separator
  151. ----
  152. .. rst-class:: classref-descriptions-group
  153. Method Descriptions
  154. -------------------
  155. .. _class_SkeletonProfile_method_find_bone:
  156. .. rst-class:: classref-method
  157. :ref:`int<class_int>` **find_bone** **(** :ref:`StringName<class_StringName>` bone_name **)** |const|
  158. Returns the bone index that matches ``bone_name`` as its name.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_SkeletonProfile_method_get_bone_name:
  162. .. rst-class:: classref-method
  163. :ref:`StringName<class_StringName>` **get_bone_name** **(** :ref:`int<class_int>` bone_idx **)** |const|
  164. Returns the name of the bone at ``bone_idx`` that will be the key name in the :ref:`BoneMap<class_BoneMap>`.
  165. In the retargeting process, the returned bone name is the bone name of the target skeleton.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_SkeletonProfile_method_get_bone_parent:
  169. .. rst-class:: classref-method
  170. :ref:`StringName<class_StringName>` **get_bone_parent** **(** :ref:`int<class_int>` bone_idx **)** |const|
  171. Returns the name of the bone which is the parent to the bone at ``bone_idx``. The result is empty if the bone has no parent.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_SkeletonProfile_method_get_bone_tail:
  175. .. rst-class:: classref-method
  176. :ref:`StringName<class_StringName>` **get_bone_tail** **(** :ref:`int<class_int>` bone_idx **)** |const|
  177. Returns the name of the bone which is the tail of the bone at ``bone_idx``.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_SkeletonProfile_method_get_group:
  181. .. rst-class:: classref-method
  182. :ref:`StringName<class_StringName>` **get_group** **(** :ref:`int<class_int>` bone_idx **)** |const|
  183. Returns the group of the bone at ``bone_idx``.
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_SkeletonProfile_method_get_group_name:
  187. .. rst-class:: classref-method
  188. :ref:`StringName<class_StringName>` **get_group_name** **(** :ref:`int<class_int>` group_idx **)** |const|
  189. Returns the name of the group at ``group_idx`` that will be the drawing group in the :ref:`BoneMap<class_BoneMap>` editor.
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_SkeletonProfile_method_get_handle_offset:
  193. .. rst-class:: classref-method
  194. :ref:`Vector2<class_Vector2>` **get_handle_offset** **(** :ref:`int<class_int>` bone_idx **)** |const|
  195. Returns the offset of the bone at ``bone_idx`` that will be the button position in the :ref:`BoneMap<class_BoneMap>` editor.
  196. This is the offset with origin at the top left corner of the square.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_SkeletonProfile_method_get_reference_pose:
  200. .. rst-class:: classref-method
  201. :ref:`Transform3D<class_Transform3D>` **get_reference_pose** **(** :ref:`int<class_int>` bone_idx **)** |const|
  202. Returns the reference pose transform for bone ``bone_idx``.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_SkeletonProfile_method_get_tail_direction:
  206. .. rst-class:: classref-method
  207. :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` **get_tail_direction** **(** :ref:`int<class_int>` bone_idx **)** |const|
  208. Returns the tail direction of the bone at ``bone_idx``.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_SkeletonProfile_method_get_texture:
  212. .. rst-class:: classref-method
  213. :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`int<class_int>` group_idx **)** |const|
  214. Returns the texture of the group at ``group_idx`` that will be the drawing group background image in the :ref:`BoneMap<class_BoneMap>` editor.
  215. .. rst-class:: classref-item-separator
  216. ----
  217. .. _class_SkeletonProfile_method_set_bone_name:
  218. .. rst-class:: classref-method
  219. void **set_bone_name** **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_name **)**
  220. Sets the name of the bone at ``bone_idx`` that will be the key name in the :ref:`BoneMap<class_BoneMap>`.
  221. In the retargeting process, the setting bone name is the bone name of the target skeleton.
  222. .. rst-class:: classref-item-separator
  223. ----
  224. .. _class_SkeletonProfile_method_set_bone_parent:
  225. .. rst-class:: classref-method
  226. void **set_bone_parent** **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_parent **)**
  227. Sets the bone with name ``bone_parent`` as the parent of the bone at ``bone_idx``. If an empty string is passed, then the bone has no parent.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_SkeletonProfile_method_set_bone_tail:
  231. .. rst-class:: classref-method
  232. void **set_bone_tail** **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` bone_tail **)**
  233. Sets the bone with name ``bone_tail`` as the tail of the bone at ``bone_idx``.
  234. .. rst-class:: classref-item-separator
  235. ----
  236. .. _class_SkeletonProfile_method_set_group:
  237. .. rst-class:: classref-method
  238. void **set_group** **(** :ref:`int<class_int>` bone_idx, :ref:`StringName<class_StringName>` group **)**
  239. Sets the group of the bone at ``bone_idx``.
  240. .. rst-class:: classref-item-separator
  241. ----
  242. .. _class_SkeletonProfile_method_set_group_name:
  243. .. rst-class:: classref-method
  244. void **set_group_name** **(** :ref:`int<class_int>` group_idx, :ref:`StringName<class_StringName>` group_name **)**
  245. Sets the name of the group at ``group_idx`` that will be the drawing group in the :ref:`BoneMap<class_BoneMap>` editor.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_SkeletonProfile_method_set_handle_offset:
  249. .. rst-class:: classref-method
  250. void **set_handle_offset** **(** :ref:`int<class_int>` bone_idx, :ref:`Vector2<class_Vector2>` handle_offset **)**
  251. Sets the offset of the bone at ``bone_idx`` that will be the button position in the :ref:`BoneMap<class_BoneMap>` editor.
  252. This is the offset with origin at the top left corner of the square.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_SkeletonProfile_method_set_reference_pose:
  256. .. rst-class:: classref-method
  257. void **set_reference_pose** **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` bone_name **)**
  258. Sets the reference pose transform for bone ``bone_idx``.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_SkeletonProfile_method_set_tail_direction:
  262. .. rst-class:: classref-method
  263. void **set_tail_direction** **(** :ref:`int<class_int>` bone_idx, :ref:`TailDirection<enum_SkeletonProfile_TailDirection>` tail_direction **)**
  264. Sets the tail direction of the bone at ``bone_idx``.
  265. \ **Note:** This only specifies the method of calculation. The actual coordinates required should be stored in an external skeleton, so the calculation itself needs to be done externally.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_SkeletonProfile_method_set_texture:
  269. .. rst-class:: classref-method
  270. void **set_texture** **(** :ref:`int<class_int>` group_idx, :ref:`Texture2D<class_Texture2D>` texture **)**
  271. Sets the texture of the group at ``group_idx`` that will be the drawing group background image in the :ref:`BoneMap<class_BoneMap>` editor.
  272. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  273. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  274. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  275. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  276. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  277. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  278. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`