Files
godot-docs/classes/class_animationlibrary.rst
2025-06-07 03:33:02 +00:00

208 lines
10 KiB
ReStructuredText

: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/AnimationLibrary.xml.
.. _class_AnimationLibrary:
AnimationLibrary
================
**Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Container for :ref:`Animation<class_Animation>` resources.
.. rst-class:: classref-introduction-group
Description
-----------
An animation library stores a set of animations accessible through :ref:`StringName<class_StringName>` keys, for use with :ref:`AnimationPlayer<class_AnimationPlayer>` nodes.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Animation tutorial index <../tutorials/animation/index>`
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`add_animation<class_AnimationLibrary_method_add_animation>`\ (\ name\: :ref:`StringName<class_StringName>`, animation\: :ref:`Animation<class_Animation>`\ ) |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Animation<class_Animation>` | :ref:`get_animation<class_AnimationLibrary_method_get_animation>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_animation_list<class_AnimationLibrary_method_get_animation_list>`\ (\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_animation_list_size<class_AnimationLibrary_method_get_animation_list_size>`\ (\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_animation<class_AnimationLibrary_method_has_animation>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`remove_animation<class_AnimationLibrary_method_remove_animation>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`rename_animation<class_AnimationLibrary_method_rename_animation>`\ (\ name\: :ref:`StringName<class_StringName>`, newname\: :ref:`StringName<class_StringName>`\ ) |
+------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_AnimationLibrary_signal_animation_added:
.. rst-class:: classref-signal
**animation_added**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_signal_animation_added>`
Emitted when an :ref:`Animation<class_Animation>` is added, under the key ``name``.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_signal_animation_changed:
.. rst-class:: classref-signal
**animation_changed**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_signal_animation_changed>`
Emitted when there's a change in one of the animations, e.g. tracks are added, moved or have changed paths. ``name`` is the key of the animation that was changed.
See also :ref:`Resource.changed<class_Resource_signal_changed>`, which this acts as a relay for.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_signal_animation_removed:
.. rst-class:: classref-signal
**animation_removed**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_signal_animation_removed>`
Emitted when an :ref:`Animation<class_Animation>` stored with the key ``name`` is removed.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_signal_animation_renamed:
.. rst-class:: classref-signal
**animation_renamed**\ (\ name\: :ref:`StringName<class_StringName>`, to_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_signal_animation_renamed>`
Emitted when the key for an :ref:`Animation<class_Animation>` is changed, from ``name`` to ``to_name``.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_AnimationLibrary_method_add_animation:
.. rst-class:: classref-method
:ref:`Error<enum_@GlobalScope_Error>` **add_animation**\ (\ name\: :ref:`StringName<class_StringName>`, animation\: :ref:`Animation<class_Animation>`\ ) :ref:`🔗<class_AnimationLibrary_method_add_animation>`
Adds the ``animation`` to the library, accessible by the key ``name``.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_get_animation:
.. rst-class:: classref-method
:ref:`Animation<class_Animation>` **get_animation**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationLibrary_method_get_animation>`
Returns the :ref:`Animation<class_Animation>` with the key ``name``. If the animation does not exist, ``null`` is returned and an error is logged.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_get_animation_list:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_animation_list**\ (\ ) |const| :ref:`🔗<class_AnimationLibrary_method_get_animation_list>`
Returns the keys for the :ref:`Animation<class_Animation>`\ s stored in the library.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_get_animation_list_size:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_animation_list_size**\ (\ ) |const| :ref:`🔗<class_AnimationLibrary_method_get_animation_list_size>`
Returns the key count for the :ref:`Animation<class_Animation>`\ s stored in the library.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_has_animation:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_animation**\ (\ name\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationLibrary_method_has_animation>`
Returns ``true`` if the library stores an :ref:`Animation<class_Animation>` with ``name`` as the key.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_remove_animation:
.. rst-class:: classref-method
|void| **remove_animation**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_method_remove_animation>`
Removes the :ref:`Animation<class_Animation>` with the key ``name``.
.. rst-class:: classref-item-separator
----
.. _class_AnimationLibrary_method_rename_animation:
.. rst-class:: classref-method
|void| **rename_animation**\ (\ name\: :ref:`StringName<class_StringName>`, newname\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationLibrary_method_rename_animation>`
Changes the key of the :ref:`Animation<class_Animation>` associated with the key ``name`` to ``newname``.
.. |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.)`