123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
- .. _class_Animation:
- Animation
- =========
- **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
- **Category:** Core
- Brief Description
- -----------------
- Contains data used to animate everything in the engine.
- Member Functions
- ----------------
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`add_track<class_Animation_add_track>` **(** :ref:`int<class_int>` type, :ref:`int<class_int>` at_pos=-1 **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_track<class_Animation_remove_track>` **(** :ref:`int<class_int>` idx **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_track_count<class_Animation_get_track_count>` **(** **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`track_get_type<class_Animation_track_get_type>` **(** :ref:`int<class_int>` idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`NodePath<class_nodepath>` | :ref:`track_get_path<class_Animation_track_get_path>` **(** :ref:`int<class_int>` idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_set_path<class_Animation_track_set_path>` **(** :ref:`int<class_int>` idx, :ref:`NodePath<class_nodepath>` path **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`find_track<class_Animation_find_track>` **(** :ref:`NodePath<class_nodepath>` path **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_move_up<class_Animation_track_move_up>` **(** :ref:`int<class_int>` idx **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_move_down<class_Animation_track_move_down>` **(** :ref:`int<class_int>` idx **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`transform_track_insert_key<class_Animation_transform_track_insert_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Vector3<class_vector3>` loc, :ref:`Quat<class_quat>` rot, :ref:`Vector3<class_vector3>` scale **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_insert_key<class_Animation_track_insert_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, var key, :ref:`float<class_float>` transition=1 **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_remove_key<class_Animation_track_remove_key>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_remove_key_at_pos<class_Animation_track_remove_key_at_pos>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` pos **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_set_key_value<class_Animation_track_set_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key, var value **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_set_key_transition<class_Animation_track_set_key_transition>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`track_get_key_transition<class_Animation_track_get_key_transition>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`track_get_key_count<class_Animation_track_get_key_count>` **(** :ref:`int<class_int>` idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_get_key_value<class_Animation_track_get_key_value>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`track_get_key_time<class_Animation_track_get_key_time>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`track_find_key<class_Animation_track_find_key>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`track_set_interpolation_type<class_Animation_track_set_interpolation_type>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` interpolation **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`track_get_interpolation_type<class_Animation_track_get_interpolation_type>` **(** :ref:`int<class_int>` idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_array>` | :ref:`transform_track_interpolate<class_Animation_transform_track_interpolate>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`value_track_set_continuous<class_Animation_value_track_set_continuous>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` continuous **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`value_track_is_continuous<class_Animation_value_track_is_continuous>` **(** :ref:`int<class_int>` idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`IntArray<class_intarray>` | :ref:`value_track_get_key_indices<class_Animation_value_track_get_key_indices>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`IntArray<class_intarray>` | :ref:`method_track_get_key_indices<class_Animation_method_track_get_key_indices>` **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`method_track_get_name<class_Animation_method_track_get_name>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Array<class_array>` | :ref:`method_track_get_params<class_Animation_method_track_get_params>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_length<class_Animation_set_length>` **(** :ref:`float<class_float>` time_sec **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_length<class_Animation_get_length>` **(** **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_loop<class_Animation_set_loop>` **(** :ref:`bool<class_bool>` enabled **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`has_loop<class_Animation_has_loop>` **(** **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_step<class_Animation_set_step>` **(** :ref:`float<class_float>` size_sec **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_step<class_Animation_get_step>` **(** **)** const |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_Animation_clear>` **(** **)** |
- +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Numeric Constants
- -----------------
- - **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated.
- - **TYPE_TRANSFORM** = **1** --- Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are Interpolated.
- - **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key.
- - **INTERPOLATION_NEAREST** = **0** --- No interpolation (nearest value).
- - **INTERPOLATION_LINEAR** = **1** --- Linear interpolation.
- - **INTERPOLATION_CUBIC** = **2** --- Cubic interpolation.
- Description
- -----------
- An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
- Animations are just data containers, and must be added to odes such as an :ref:`AnimationPlayer<class_animationplayer>` or :ref:`AnimationTreePlayer<class_animationtreeplayer>` to be played back.
- Member Function Description
- ---------------------------
- .. _class_Animation_add_track:
- - :ref:`int<class_int>` **add_track** **(** :ref:`int<class_int>` type, :ref:`int<class_int>` at_pos=-1 **)**
- Add a track to the Animation. The track type must be specified as any of the values in the TYPE\_\* enumeration.
- .. _class_Animation_remove_track:
- - void **remove_track** **(** :ref:`int<class_int>` idx **)**
- Remove a track by specifying the track index.
- .. _class_Animation_get_track_count:
- - :ref:`int<class_int>` **get_track_count** **(** **)** const
- Return the amount of tracks in the animation.
- .. _class_Animation_track_get_type:
- - :ref:`int<class_int>` **track_get_type** **(** :ref:`int<class_int>` idx **)** const
- Get the type of a track.
- .. _class_Animation_track_get_path:
- - :ref:`NodePath<class_nodepath>` **track_get_path** **(** :ref:`int<class_int>` idx **)** const
- Get the path of a track. for more information on the path format, see :ref:`track_set_path<class_Animation_track_set_path>`
- .. _class_Animation_track_set_path:
- - void **track_set_path** **(** :ref:`int<class_int>` idx, :ref:`NodePath<class_nodepath>` path **)**
- Set the path of a track. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ":". Example: "character/skeleton:ankle" or "character/mesh:transform/local"
- .. _class_Animation_find_track:
- - :ref:`int<class_int>` **find_track** **(** :ref:`NodePath<class_nodepath>` path **)** const
- .. _class_Animation_track_move_up:
- - void **track_move_up** **(** :ref:`int<class_int>` idx **)**
- Move a track up.
- .. _class_Animation_track_move_down:
- - void **track_move_down** **(** :ref:`int<class_int>` idx **)**
- Move a track down.
- .. _class_Animation_transform_track_insert_key:
- - :ref:`int<class_int>` **transform_track_insert_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`Vector3<class_vector3>` loc, :ref:`Quat<class_quat>` rot, :ref:`Vector3<class_vector3>` scale **)**
- Insert a transform key for a transform track.
- .. _class_Animation_track_insert_key:
- - void **track_insert_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, var key, :ref:`float<class_float>` transition=1 **)**
- Insert a generic key in a given track.
- .. _class_Animation_track_remove_key:
- - void **track_remove_key** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)**
- Remove a key by index in a given track.
- .. _class_Animation_track_remove_key_at_pos:
- - void **track_remove_key_at_pos** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` pos **)**
- Remove a key by position (seconds) in a given track.
- .. _class_Animation_track_set_key_value:
- - void **track_set_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key, var value **)**
- Set the value of an existing key.
- .. _class_Animation_track_set_key_transition:
- - void **track_set_key_transition** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx, :ref:`float<class_float>` transition **)**
- Set the transition curve (easing) for a specific key (see built-in math function "ease").
- .. _class_Animation_track_get_key_transition:
- - :ref:`float<class_float>` **track_get_key_transition** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
- Return the transition curve (easing) for a specific key (see built-in math function "ease").
- .. _class_Animation_track_get_key_count:
- - :ref:`int<class_int>` **track_get_key_count** **(** :ref:`int<class_int>` idx **)** const
- Return the amount of keys in a given track.
- .. _class_Animation_track_get_key_value:
- - void **track_get_key_value** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
- Return the value of a given key in a given track.
- .. _class_Animation_track_get_key_time:
- - :ref:`float<class_float>` **track_get_key_time** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
- Return the time at which the key is located.
- .. _class_Animation_track_find_key:
- - :ref:`int<class_int>` **track_find_key** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time, :ref:`bool<class_bool>` exact=false **)** const
- Find the key index by time in a given track. Optionally, only find it if the exact time is given.
- .. _class_Animation_track_set_interpolation_type:
- - void **track_set_interpolation_type** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` interpolation **)**
- Set the interpolation type of a given track, from the INTERPOLATION\_\* enum.
- .. _class_Animation_track_get_interpolation_type:
- - :ref:`int<class_int>` **track_get_interpolation_type** **(** :ref:`int<class_int>` idx **)** const
- Return the interpolation type of a given track, from the INTERPOLATION\_\* enum.
- .. _class_Animation_transform_track_interpolate:
- - :ref:`Array<class_array>` **transform_track_interpolate** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec **)** const
- Return the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position (:ref:`Vector3<class_vector3>`), rotation (:ref:`Quat<class_quat>`) and scale (:ref:`Vector3<class_vector3>`).
- .. _class_Animation_value_track_set_continuous:
- - void **value_track_set_continuous** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` continuous **)**
- Enable or disable interpolation for a whole track. By default tracks are interpolated.
- .. _class_Animation_value_track_is_continuous:
- - :ref:`bool<class_bool>` **value_track_is_continuous** **(** :ref:`int<class_int>` idx **)** const
- Return whether interpolation is enabled or disabled for a whole track. By default tracks are interpolated.
- .. _class_Animation_value_track_get_key_indices:
- - :ref:`IntArray<class_intarray>` **value_track_get_key_indices** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
- Return all the key indices of a value track, given a position and delta time.
- .. _class_Animation_method_track_get_key_indices:
- - :ref:`IntArray<class_intarray>` **method_track_get_key_indices** **(** :ref:`int<class_int>` idx, :ref:`float<class_float>` time_sec, :ref:`float<class_float>` delta **)** const
- Return all the key indices of a method track, given a position and delta time.
- .. _class_Animation_method_track_get_name:
- - :ref:`String<class_string>` **method_track_get_name** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
- Return the method name of a method track.
- .. _class_Animation_method_track_get_params:
- - :ref:`Array<class_array>` **method_track_get_params** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` key_idx **)** const
- Return the arguments values to be called on a method track for a given key in a given track.
- .. _class_Animation_set_length:
- - void **set_length** **(** :ref:`float<class_float>` time_sec **)**
- Set the total length of the animation (in seconds). Note that length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping.
- .. _class_Animation_get_length:
- - :ref:`float<class_float>` **get_length** **(** **)** const
- Return the total length of the animation (in seconds).
- .. _class_Animation_set_loop:
- - void **set_loop** **(** :ref:`bool<class_bool>` enabled **)**
- Set a flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
- .. _class_Animation_has_loop:
- - :ref:`bool<class_bool>` **has_loop** **(** **)** const
- Return whether the animation has the loop flag set.
- .. _class_Animation_set_step:
- - void **set_step** **(** :ref:`float<class_float>` size_sec **)**
- .. _class_Animation_get_step:
- - :ref:`float<class_float>` **get_step** **(** **)** const
- .. _class_Animation_clear:
- - void **clear** **(** **)**
- Clear the animation (clear all tracks and reset all).
|