Skip to content

class_animation

reduz edited this page Feb 23, 2014 · 10 revisions

Animation

Inherits: Resource\n\n

Brief Description

Contains data used to animate everything in the engine.

Member Functions

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 animationplayer or animationtreeplayer to be played back.

Member Function Description

  • int add_track ( int type, int at_pos=-1 ) \ Add a track to the Animation. The track type must be specified as any of the values in te TYPE_* enumeration.
  • void remove_track ( int idx ) \ Remove a track by specifying the track index.
  • void track_set_path ( int idx, 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"
  • int track_find_key ( int idx, real time, bool exact=false ) const \ Find the key index by time in a given track. Optionally, only find it if the exact time is given.
  • void set_length ( real 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.
  • real get_length ( ) const \ Return the total length of the animation (in seconds).
  • void set_loop ( 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.
  • bool has_loop ( ) const \ Return wether the animation has the loop flag set.
  • void clear ( ) \ Clear the animation (clear all tracks and reset all).

Clone this wiki locally