class_bone2d.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Bone2D.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Bone2D:
  5. Bone2D
  6. ======
  7. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Joint used with :ref:`Skeleton2D<class_Skeleton2D>` to control and animate other nodes.
  12. Properties
  13. ----------
  14. +---------------------------------------+-------------------------------------------------------------+---------------------------------+
  15. | :ref:`float<class_float>` | :ref:`default_length<class_Bone2D_property_default_length>` | 16.0 |
  16. +---------------------------------------+-------------------------------------------------------------+---------------------------------+
  17. | :ref:`Transform2D<class_Transform2D>` | :ref:`rest<class_Bone2D_property_rest>` | Transform2D( 0, 0, 0, 0, 0, 0 ) |
  18. +---------------------------------------+-------------------------------------------------------------+---------------------------------+
  19. Methods
  20. -------
  21. +---------------------------------------+-------------------------------------------------------------------------------------------+
  22. | void | :ref:`apply_rest<class_Bone2D_method_apply_rest>` **(** **)** |
  23. +---------------------------------------+-------------------------------------------------------------------------------------------+
  24. | :ref:`int<class_int>` | :ref:`get_index_in_skeleton<class_Bone2D_method_get_index_in_skeleton>` **(** **)** const |
  25. +---------------------------------------+-------------------------------------------------------------------------------------------+
  26. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_skeleton_rest<class_Bone2D_method_get_skeleton_rest>` **(** **)** const |
  27. +---------------------------------------+-------------------------------------------------------------------------------------------+
  28. Description
  29. -----------
  30. Use a hierarchy of ``Bone2D`` bound to a :ref:`Skeleton2D<class_Skeleton2D>` to control, and animate other :ref:`Node2D<class_Node2D>` nodes.
  31. You can use ``Bone2D`` and ``Skeleton2D`` nodes to animate 2D meshes created with the Polygon 2D UV editor.
  32. 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.
  33. 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.
  34. Property Descriptions
  35. ---------------------
  36. .. _class_Bone2D_property_default_length:
  37. - :ref:`float<class_float>` **default_length**
  38. +-----------+---------------------------+
  39. | *Default* | 16.0 |
  40. +-----------+---------------------------+
  41. | *Setter* | set_default_length(value) |
  42. +-----------+---------------------------+
  43. | *Getter* | get_default_length() |
  44. +-----------+---------------------------+
  45. Length of the bone's representation drawn in the editor's viewport in pixels.
  46. .. _class_Bone2D_property_rest:
  47. - :ref:`Transform2D<class_Transform2D>` **rest**
  48. +-----------+---------------------------------+
  49. | *Default* | Transform2D( 0, 0, 0, 0, 0, 0 ) |
  50. +-----------+---------------------------------+
  51. | *Setter* | set_rest(value) |
  52. +-----------+---------------------------------+
  53. | *Getter* | get_rest() |
  54. +-----------+---------------------------------+
  55. Rest transform of the bone. You can reset the node's transforms to this value using :ref:`apply_rest<class_Bone2D_method_apply_rest>`.
  56. Method Descriptions
  57. -------------------
  58. .. _class_Bone2D_method_apply_rest:
  59. - void **apply_rest** **(** **)**
  60. Stores the node's current transforms in :ref:`rest<class_Bone2D_property_rest>`.
  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. .. _class_Bone2D_method_get_skeleton_rest:
  65. - :ref:`Transform2D<class_Transform2D>` **get_skeleton_rest** **(** **)** const
  66. 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.