:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Skeleton2D.xml. .. _class_Skeleton2D: Skeleton2D ========== **Inherits:** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` The parent of a hierarchy of :ref:`Bone2D`\ s, used to create a 2D skeletal animation. .. rst-class:: classref-introduction-group Description ----------- **Skeleton2D** parents a hierarchy of :ref:`Bone2D` nodes. It holds a reference to each :ref:`Bone2D`'s rest pose and acts as a single point of access to its bones. To set up different types of inverse kinematics for the given Skeleton2D, a :ref:`SkeletonModificationStack2D` should be created. The inverse kinematics be applied by increasing :ref:`SkeletonModificationStack2D.modification_count` and creating the desired number of modifications. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`2D skeletons <../tutorials/animation/2d_skeletons>` .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`execute_modifications`\ (\ delta\: :ref:`float`, execution_mode\: :ref:`int`\ ) | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Bone2D` | :ref:`get_bone`\ (\ idx\: :ref:`int`\ ) | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bone_count`\ (\ ) |const| | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform2D` | :ref:`get_bone_local_pose_override`\ (\ bone_idx\: :ref:`int`\ ) | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SkeletonModificationStack2D` | :ref:`get_modification_stack`\ (\ ) |const| | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`RID` | :ref:`get_skeleton`\ (\ ) |const| | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_bone_local_pose_override`\ (\ bone_idx\: :ref:`int`, override_pose\: :ref:`Transform2D`, strength\: :ref:`float`, persistent\: :ref:`bool`\ ) | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_modification_stack`\ (\ modification_stack\: :ref:`SkeletonModificationStack2D`\ ) | +-----------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_Skeleton2D_signal_bone_setup_changed: .. rst-class:: classref-signal **bone_setup_changed**\ (\ ) :ref:`🔗` Emitted when the :ref:`Bone2D` setup attached to this skeletons changes. This is primarily used internally within the skeleton. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_Skeleton2D_method_execute_modifications: .. rst-class:: classref-method |void| **execute_modifications**\ (\ delta\: :ref:`float`, execution_mode\: :ref:`int`\ ) :ref:`🔗` Executes all the modifications on the :ref:`SkeletonModificationStack2D`, if the Skeleton2D has one assigned. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_get_bone: .. rst-class:: classref-method :ref:`Bone2D` **get_bone**\ (\ idx\: :ref:`int`\ ) :ref:`🔗` Returns a :ref:`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. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_get_bone_count: .. rst-class:: classref-method :ref:`int` **get_bone_count**\ (\ ) |const| :ref:`🔗` Returns the number of :ref:`Bone2D` nodes in the node hierarchy parented by Skeleton2D. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_get_bone_local_pose_override: .. rst-class:: classref-method :ref:`Transform2D` **get_bone_local_pose_override**\ (\ bone_idx\: :ref:`int`\ ) :ref:`🔗` Returns the local pose override transform for ``bone_idx``. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_get_modification_stack: .. rst-class:: classref-method :ref:`SkeletonModificationStack2D` **get_modification_stack**\ (\ ) |const| :ref:`🔗` Returns the :ref:`SkeletonModificationStack2D` attached to this skeleton, if one exists. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_get_skeleton: .. rst-class:: classref-method :ref:`RID` **get_skeleton**\ (\ ) |const| :ref:`🔗` Returns the :ref:`RID` of a Skeleton2D instance. .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_set_bone_local_pose_override: .. rst-class:: classref-method |void| **set_bone_local_pose_override**\ (\ bone_idx\: :ref:`int`, override_pose\: :ref:`Transform2D`, strength\: :ref:`float`, persistent\: :ref:`bool`\ ) :ref:`🔗` Sets the local pose transform, ``override_pose``, for the bone at ``bone_idx``. \ ``strength`` is the interpolation strength that will be used when applying the pose, and ``persistent`` determines if the applied pose will remain. \ **Note:** The pose transform needs to be a local transform relative to the :ref:`Bone2D` node at ``bone_idx``! .. rst-class:: classref-item-separator ---- .. _class_Skeleton2D_method_set_modification_stack: .. rst-class:: classref-method |void| **set_modification_stack**\ (\ modification_stack\: :ref:`SkeletonModificationStack2D`\ ) :ref:`🔗` Sets the :ref:`SkeletonModificationStack2D` attached to this skeleton. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`