AnimationNode

Inherits: Resource < RefCounted < Object

Inherited By: AnimationNodeOutput, AnimationNodeSync, AnimationNodeTimeScale, AnimationNodeTimeSeek, AnimationRootNode

Base resource for AnimationTree nodes.

Description

Base resource for AnimationTree nodes. In general, it's not used directly, but you can create custom ones with custom blending formulas.

Inherit this when creating nodes mainly for use in AnimationNodeBlendTree, otherwise AnimationRootNode should be used instead.

Tutorials

Properties

bool

filter_enabled

Methods

String

_get_caption ( ) virtual const

AnimationNode

_get_child_by_name ( StringName name ) virtual const

Dictionary

_get_child_nodes ( ) virtual const

Variant

_get_parameter_default_value ( StringName parameter ) virtual const

Array

_get_parameter_list ( ) virtual const

bool

_has_filter ( ) virtual const

bool

_is_parameter_read_only ( StringName parameter ) virtual const

float

_process ( float time, bool seek, bool is_external_seeking ) virtual const

void

add_input ( String name )

void

blend_animation ( StringName animation, float time, float delta, bool seeked, bool is_external_seeking, float blend, LoopedFlag looped_flag=0 )

float

blend_input ( int input_index, float time, bool seek, bool is_external_seeking, float blend, FilterAction filter=0, bool sync=true )

float

blend_node ( StringName name, AnimationNode node, float time, bool seek, bool is_external_seeking, float blend, FilterAction filter=0, bool sync=true )

int

get_input_count ( ) const

String

get_input_name ( int input )

Variant

get_parameter ( StringName name ) const

bool

is_path_filtered ( NodePath path ) const

void

remove_input ( int index )

void

set_filter_path ( NodePath path, bool enable )

void

set_parameter ( StringName name, Variant value )


Signals

tree_changed ( )

Emitted by nodes that inherit from this class and that have an internal tree when one of their nodes changes. The nodes that emit this signal are AnimationNodeBlendSpace1D, AnimationNodeBlendSpace2D, AnimationNodeStateMachine, and AnimationNodeBlendTree.


Enumerations

enum FilterAction:

FilterAction FILTER_IGNORE = 0

Do not use filtering.

FilterAction FILTER_PASS = 1

Paths matching the filter will be allowed to pass.

FilterAction FILTER_STOP = 2

Paths matching the filter will be discarded.

FilterAction FILTER_BLEND = 3

Paths matching the filter will be blended (by the blend value).


Property Descriptions

bool filter_enabled

  • void set_filter_enabled ( bool value )

  • bool is_filter_enabled ( )

If true, filtering is enabled.


Method Descriptions

String _get_caption ( ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to override the text caption for this node.


AnimationNode _get_child_by_name ( StringName name ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return a child node by its name.


Dictionary _get_child_nodes ( ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return all children nodes in order as a name: node dictionary.


Variant _get_parameter_default_value ( StringName parameter ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.


Array _get_parameter_list ( ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return a list of the properties on this node. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to Object.get_property_list.


bool _has_filter ( ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return whether the blend tree editor should display filter editing on this node.


bool _is_parameter_read_only ( StringName parameter ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to return whether the parameter is read-only. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.


float _process ( float time, bool seek, bool is_external_seeking ) virtual const

When inheriting from AnimationRootNode, implement this virtual method to run some code when this node is processed. The time parameter is a relative delta, unless seek is true, in which case it is absolute.

Here, call the blend_input, blend_node or blend_animation functions. You can also use get_parameter and set_parameter to modify local memory.

This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).


void add_input ( String name )

Adds an input to the node. This is only useful for nodes created for use in an AnimationNodeBlendTree.


void blend_animation ( StringName animation, float time, float delta, bool seeked, bool is_external_seeking, float blend, LoopedFlag looped_flag=0 )

Blend an animation by blend amount (name must be valid in the linked AnimationPlayer). A time and delta may be passed, as well as whether seeked happened.

A looped_flag is used by internal processing immediately after the loop. See also LoopedFlag.


float blend_input ( int input_index, float time, bool seek, bool is_external_seeking, float blend, FilterAction filter=0, bool sync=true )

Blend an input. This is only useful for nodes created for an AnimationNodeBlendTree. The time parameter is a relative delta, unless seek is true, in which case it is absolute. A filter mode may be optionally passed (see FilterAction for options).


float blend_node ( StringName name, AnimationNode node, float time, bool seek, bool is_external_seeking, float blend, FilterAction filter=0, bool sync=true )

Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from AnimationRootNode instead, else editors will not display your node for addition.


int get_input_count ( ) const

Amount of inputs in this node, only useful for nodes that go into AnimationNodeBlendTree.


String get_input_name ( int input )

Gets the name of an input by index.


Variant get_parameter ( StringName name ) const

Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.


bool is_path_filtered ( NodePath path ) const

Returns whether the given path is filtered.


void remove_input ( int index )

Removes an input, call this only when inactive.


void set_filter_path ( NodePath path, bool enable )

Adds or removes a path for the filter.


void set_parameter ( StringName name, Variant value )

Sets a custom parameter. These are used as local memory, because resources can be reused across the tree or scenes.