class_skeleton2d.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Skeleton2D.xml.
  6. .. _class_Skeleton2D:
  7. Skeleton2D
  8. ==========
  9. **Inherits:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. The parent of a hierarchy of :ref:`Bone2D<class_Bone2D>`\ s, used to create a 2D skeletal animation.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **Skeleton2D** parents a hierarchy of :ref:`Bone2D<class_Bone2D>` nodes. It holds a reference to each :ref:`Bone2D<class_Bone2D>`'s rest pose and acts as a single point of access to its bones.
  15. To set up different types of inverse kinematics for the given Skeleton2D, a :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` should be created. The inverse kinematics be applied by increasing :ref:`SkeletonModificationStack2D.modification_count<class_SkeletonModificationStack2D_property_modification_count>` and creating the desired number of modifications.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`2D skeletons <../tutorials/animation/2d_skeletons>`
  20. .. rst-class:: classref-reftable-group
  21. Methods
  22. -------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`execute_modifications<class_Skeleton2D_method_execute_modifications>` **(** :ref:`float<class_float>` delta, :ref:`int<class_int>` execution_mode **)** |
  27. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Bone2D<class_Bone2D>` | :ref:`get_bone<class_Skeleton2D_method_get_bone>` **(** :ref:`int<class_int>` idx **)** |
  29. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`get_bone_count<class_Skeleton2D_method_get_bone_count>` **(** **)** |const| |
  31. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`Transform2D<class_Transform2D>` | :ref:`get_bone_local_pose_override<class_Skeleton2D_method_get_bone_local_pose_override>` **(** :ref:`int<class_int>` bone_idx **)** |
  33. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` | :ref:`get_modification_stack<class_Skeleton2D_method_get_modification_stack>` **(** **)** |const| |
  35. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`RID<class_RID>` | :ref:`get_skeleton<class_Skeleton2D_method_get_skeleton>` **(** **)** |const| |
  37. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`set_bone_local_pose_override<class_Skeleton2D_method_set_bone_local_pose_override>` **(** :ref:`int<class_int>` bone_idx, :ref:`Transform2D<class_Transform2D>` override_pose, :ref:`float<class_float>` strength, :ref:`bool<class_bool>` persistent **)** |
  39. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_modification_stack<class_Skeleton2D_method_set_modification_stack>` **(** :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` modification_stack **)** |
  41. +-----------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. .. rst-class:: classref-section-separator
  43. ----
  44. .. rst-class:: classref-descriptions-group
  45. Signals
  46. -------
  47. .. _class_Skeleton2D_signal_bone_setup_changed:
  48. .. rst-class:: classref-signal
  49. **bone_setup_changed** **(** **)**
  50. Emitted when the :ref:`Bone2D<class_Bone2D>` setup attached to this skeletons changes. This is primarily used internally within the skeleton.
  51. .. rst-class:: classref-section-separator
  52. ----
  53. .. rst-class:: classref-descriptions-group
  54. Method Descriptions
  55. -------------------
  56. .. _class_Skeleton2D_method_execute_modifications:
  57. .. rst-class:: classref-method
  58. void **execute_modifications** **(** :ref:`float<class_float>` delta, :ref:`int<class_int>` execution_mode **)**
  59. Executes all the modifications on the :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>`, if the Skeleton2D has one assigned.
  60. .. rst-class:: classref-item-separator
  61. ----
  62. .. _class_Skeleton2D_method_get_bone:
  63. .. rst-class:: classref-method
  64. :ref:`Bone2D<class_Bone2D>` **get_bone** **(** :ref:`int<class_int>` idx **)**
  65. Returns a :ref:`Bone2D<class_Bone2D>` from the node hierarchy parented by Skeleton2D. The object to return is identified by the parameter ``idx``. Bones are indexed by descending the node hierarchy from top to bottom, adding the children of each branch before moving to the next sibling.
  66. .. rst-class:: classref-item-separator
  67. ----
  68. .. _class_Skeleton2D_method_get_bone_count:
  69. .. rst-class:: classref-method
  70. :ref:`int<class_int>` **get_bone_count** **(** **)** |const|
  71. Returns the number of :ref:`Bone2D<class_Bone2D>` nodes in the node hierarchy parented by Skeleton2D.
  72. .. rst-class:: classref-item-separator
  73. ----
  74. .. _class_Skeleton2D_method_get_bone_local_pose_override:
  75. .. rst-class:: classref-method
  76. :ref:`Transform2D<class_Transform2D>` **get_bone_local_pose_override** **(** :ref:`int<class_int>` bone_idx **)**
  77. Returns the local pose override transform for ``bone_idx``.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_Skeleton2D_method_get_modification_stack:
  81. .. rst-class:: classref-method
  82. :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` **get_modification_stack** **(** **)** |const|
  83. Returns the :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` attached to this skeleton, if one exists.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_Skeleton2D_method_get_skeleton:
  87. .. rst-class:: classref-method
  88. :ref:`RID<class_RID>` **get_skeleton** **(** **)** |const|
  89. Returns the :ref:`RID<class_RID>` of a Skeleton2D instance.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_Skeleton2D_method_set_bone_local_pose_override:
  93. .. rst-class:: classref-method
  94. void **set_bone_local_pose_override** **(** :ref:`int<class_int>` bone_idx, :ref:`Transform2D<class_Transform2D>` override_pose, :ref:`float<class_float>` strength, :ref:`bool<class_bool>` persistent **)**
  95. Sets the local pose transform, ``override_pose``, for the bone at ``bone_idx``.
  96. \ ``strength`` is the interpolation strength that will be used when applying the pose, and ``persistent`` determines if the applied pose will remain.
  97. \ **Note:** The pose transform needs to be a local transform relative to the :ref:`Bone2D<class_Bone2D>` node at ``bone_idx``!
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_Skeleton2D_method_set_modification_stack:
  101. .. rst-class:: classref-method
  102. void **set_modification_stack** **(** :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` modification_stack **)**
  103. Sets the :ref:`SkeletonModificationStack2D<class_SkeletonModificationStack2D>` attached to this skeleton.
  104. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  105. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  106. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  107. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  108. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  109. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  110. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`