class_bone2d.rst 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/Bone2D.xml.
  6. .. _class_Bone2D:
  7. Bone2D
  8. ======
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Joint used with :ref:`Skeleton2D<class_Skeleton2D>` to control and animate other nodes.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Use a hierarchy of ``Bone2D`` bound to a :ref:`Skeleton2D<class_Skeleton2D>` to control, and animate other :ref:`Node2D<class_Node2D>` nodes.
  15. You can use ``Bone2D`` and ``Skeleton2D`` nodes to animate 2D meshes created with the Polygon 2D UV editor.
  16. Each bone has a :ref:`rest<class_Bone2D_property_rest>` transform that you can reset to with :ref:`apply_rest<class_Bone2D_method_apply_rest>`. These rest poses are relative to the bone's parent.
  17. If in the editor, you can set the rest pose of an entire skeleton using a menu option, from the code, you need to iterate over the bones to set their individual rest poses.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  24. | :ref:`float<class_float>` | :ref:`default_length<class_Bone2D_property_default_length>` | ``16.0`` |
  25. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  26. | :ref:`Transform2D<class_Transform2D>` | :ref:`rest<class_Bone2D_property_rest>` | ``Transform2D( 0, 0, 0, 0, 0, 0 )`` |
  27. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  28. .. rst-class:: classref-reftable-group
  29. Methods
  30. -------
  31. .. table::
  32. :widths: auto
  33. +---------------------------------------+---------------------------------------------------------------------------------------------+
  34. | void | :ref:`apply_rest<class_Bone2D_method_apply_rest>` **(** **)** |
  35. +---------------------------------------+---------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_index_in_skeleton<class_Bone2D_method_get_index_in_skeleton>` **(** **)** |const| |
  37. +---------------------------------------+---------------------------------------------------------------------------------------------+
  38. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_skeleton_rest<class_Bone2D_method_get_skeleton_rest>` **(** **)** |const| |
  39. +---------------------------------------+---------------------------------------------------------------------------------------------+
  40. .. rst-class:: classref-section-separator
  41. ----
  42. .. rst-class:: classref-descriptions-group
  43. Property Descriptions
  44. ---------------------
  45. .. _class_Bone2D_property_default_length:
  46. .. rst-class:: classref-property
  47. :ref:`float<class_float>` **default_length** = ``16.0``
  48. .. rst-class:: classref-property-setget
  49. - void **set_default_length** **(** :ref:`float<class_float>` value **)**
  50. - :ref:`float<class_float>` **get_default_length** **(** **)**
  51. Length of the bone's representation drawn in the editor's viewport in pixels.
  52. .. rst-class:: classref-item-separator
  53. ----
  54. .. _class_Bone2D_property_rest:
  55. .. rst-class:: classref-property
  56. :ref:`Transform2D<class_Transform2D>` **rest** = ``Transform2D( 0, 0, 0, 0, 0, 0 )``
  57. .. rst-class:: classref-property-setget
  58. - void **set_rest** **(** :ref:`Transform2D<class_Transform2D>` value **)**
  59. - :ref:`Transform2D<class_Transform2D>` **get_rest** **(** **)**
  60. Rest transform of the bone. You can reset the node's transforms to this value using :ref:`apply_rest<class_Bone2D_method_apply_rest>`.
  61. .. rst-class:: classref-section-separator
  62. ----
  63. .. rst-class:: classref-descriptions-group
  64. Method Descriptions
  65. -------------------
  66. .. _class_Bone2D_method_apply_rest:
  67. .. rst-class:: classref-method
  68. void **apply_rest** **(** **)**
  69. Resets the bone to the rest pose. This is equivalent to setting :ref:`Node2D.transform<class_Node2D_property_transform>` to :ref:`rest<class_Bone2D_property_rest>`.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_Bone2D_method_get_index_in_skeleton:
  73. .. rst-class:: classref-method
  74. :ref:`int<class_int>` **get_index_in_skeleton** **(** **)** |const|
  75. Returns the node's index as part of the entire skeleton. See :ref:`Skeleton2D<class_Skeleton2D>`.
  76. .. rst-class:: classref-item-separator
  77. ----
  78. .. _class_Bone2D_method_get_skeleton_rest:
  79. .. rst-class:: classref-method
  80. :ref:`Transform2D<class_Transform2D>` **get_skeleton_rest** **(** **)** |const|
  81. Returns the node's :ref:`rest<class_Bone2D_property_rest>` ``Transform2D`` if it doesn't have a parent, or its rest pose relative to its parent.
  82. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  83. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  84. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  85. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`