class_bone2d.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Bone2D.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Bone2D:
  6. Bone2D
  7. ======
  8. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Joint used with :ref:`Skeleton2D<class_Skeleton2D>` to control and animate other nodes.
  10. Description
  11. -----------
  12. Use a hierarchy of ``Bone2D`` bound to a :ref:`Skeleton2D<class_Skeleton2D>` to control, and animate other :ref:`Node2D<class_Node2D>` nodes.
  13. You can use ``Bone2D`` and ``Skeleton2D`` nodes to animate 2D meshes created with the Polygon 2D UV editor.
  14. 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.
  15. 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.
  16. Properties
  17. ----------
  18. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  19. | :ref:`float<class_float>` | :ref:`default_length<class_Bone2D_property_default_length>` | ``16.0`` |
  20. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  21. | :ref:`Transform2D<class_Transform2D>` | :ref:`rest<class_Bone2D_property_rest>` | ``Transform2D( 0, 0, 0, 0, 0, 0 )`` |
  22. +---------------------------------------+-------------------------------------------------------------+-------------------------------------+
  23. Methods
  24. -------
  25. +---------------------------------------+---------------------------------------------------------------------------------------------+
  26. | void | :ref:`apply_rest<class_Bone2D_method_apply_rest>` **(** **)** |
  27. +---------------------------------------+---------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`get_index_in_skeleton<class_Bone2D_method_get_index_in_skeleton>` **(** **)** |const| |
  29. +---------------------------------------+---------------------------------------------------------------------------------------------+
  30. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_skeleton_rest<class_Bone2D_method_get_skeleton_rest>` **(** **)** |const| |
  31. +---------------------------------------+---------------------------------------------------------------------------------------------+
  32. Property Descriptions
  33. ---------------------
  34. .. _class_Bone2D_property_default_length:
  35. - :ref:`float<class_float>` **default_length**
  36. +-----------+---------------------------+
  37. | *Default* | ``16.0`` |
  38. +-----------+---------------------------+
  39. | *Setter* | set_default_length(value) |
  40. +-----------+---------------------------+
  41. | *Getter* | get_default_length() |
  42. +-----------+---------------------------+
  43. Length of the bone's representation drawn in the editor's viewport in pixels.
  44. ----
  45. .. _class_Bone2D_property_rest:
  46. - :ref:`Transform2D<class_Transform2D>` **rest**
  47. +-----------+-------------------------------------+
  48. | *Default* | ``Transform2D( 0, 0, 0, 0, 0, 0 )`` |
  49. +-----------+-------------------------------------+
  50. | *Setter* | set_rest(value) |
  51. +-----------+-------------------------------------+
  52. | *Getter* | get_rest() |
  53. +-----------+-------------------------------------+
  54. Rest transform of the bone. You can reset the node's transforms to this value using :ref:`apply_rest<class_Bone2D_method_apply_rest>`.
  55. Method Descriptions
  56. -------------------
  57. .. _class_Bone2D_method_apply_rest:
  58. - void **apply_rest** **(** **)**
  59. Stores the node's current transforms in :ref:`rest<class_Bone2D_property_rest>`.
  60. ----
  61. .. _class_Bone2D_method_get_index_in_skeleton:
  62. - :ref:`int<class_int>` **get_index_in_skeleton** **(** **)** |const|
  63. Returns the node's index as part of the entire skeleton. See :ref:`Skeleton2D<class_Skeleton2D>`.
  64. ----
  65. .. _class_Bone2D_method_get_skeleton_rest:
  66. - :ref:`Transform2D<class_Transform2D>` **get_skeleton_rest** **(** **)** |const|
  67. 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.
  68. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  69. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  70. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`