Table of Contents

Class AnimationNode

Base class for AnimationTree nodes. Not related to scene nodes.

Inheritance
AnimationNode
Derived

Remarks

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 animation nodes mainly for use in AnimationNodeBlendTree, otherwise AnimationRootNode should be used instead.

You can access the time information as read-only parameter which is processed and stored in the previous frame for all nodes except AnimationNodeOutput.

Note: If multiple inputs exist in the AnimationNode, which time information takes precedence depends on the type of AnimationNode.

var current_length = $AnimationTree[parameters/AnimationNodeName/current_length]
var current_position = $AnimationTree[parameters/AnimationNodeName/current_position]
var current_delta = $AnimationTree[parameters/AnimationNodeName/current_delta]

See Also

Properties

filter_enabled

If true, filtering is enabled.

var filter_enabled : bool

Property Value

bool

Remarks

  • void set_filter_enabled(bool value)
  • bool is_filter_enabled

Methods

_get_caption

Qualifiers: virtualconst

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

String _get_caption

_get_child_by_name(StringName)

Qualifiers: virtualconst

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

AnimationNode _get_child_by_name(StringName name)

Parameters

name StringName

_get_child_nodes

Qualifiers: virtualconst

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

Dictionary _get_child_nodes

_get_parameter_default_value(StringName)

Qualifiers: virtualconst

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

Variant _get_parameter_default_value(StringName parameter)

Parameters

parameter StringName

_get_parameter_list

Qualifiers: virtualconst

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

Array _get_parameter_list

_has_filter

Qualifiers: virtualconst

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

bool _has_filter

_is_parameter_read_only(StringName)

Qualifiers: virtualconst

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

bool _is_parameter_read_only(StringName parameter)

Parameters

parameter StringName

_process(float, bool, bool, bool)

Qualifiers: virtual

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

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

This function should return the delta.

float _process(float time, bool seek, bool is_external_seeking, bool test_only)

Parameters

time float
seek bool
is_external_seeking bool
test_only bool

add_input(String)

Adds an input to the animation node. This is only useful for animation nodes created for use in an AnimationNodeBlendTree. If the addition fails, returns false.

bool add_input(String name)

Parameters

name String

blend_animation(StringName, float, float, bool, bool, float, int)

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.

void blend_animation(StringName animation, float time, float delta, bool seeked, bool is_external_seeking, float blend, int looped_flag)

Parameters

animation StringName
time float
delta float
seeked bool
is_external_seeking bool
blend float
looped_flag int

blend_input(int, float, bool, bool, float, int, bool, bool)

Blend an input. This is only useful for animation 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_input(int input_index, float time, bool seek, bool is_external_seeking, float blend, int filter, bool sync, bool test_only)

Parameters

input_index int
time float
seek bool
is_external_seeking bool
blend float
filter int
sync bool
test_only bool

blend_node(StringName, AnimationNode, float, bool, bool, float, int, bool, bool)

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

float blend_node(StringName name, AnimationNode node, float time, bool seek, bool is_external_seeking, float blend, int filter, bool sync, bool test_only)

Parameters

name StringName
node AnimationNode
time float
seek bool
is_external_seeking bool
blend float
filter int
sync bool
test_only bool

find_input(String)

Qualifiers: const

Returns the input index which corresponds to name. If not found, returns -1.

int find_input(String name)

Parameters

name String

get_input_count

Qualifiers: const

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

int get_input_count

get_input_name(int)

Qualifiers: const

Gets the name of an input by index.

String get_input_name(int input)

Parameters

input int

get_parameter(StringName)

Qualifiers: const

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

Variant get_parameter(StringName name)

Parameters

name StringName

get_processing_animation_tree_instance_id

Qualifiers: const

Returns the object id of the AnimationTree that owns this node.

Note: This method should only be called from within the AnimationNodeExtension._process_animation_node method, and will return an invalid id otherwise.

int get_processing_animation_tree_instance_id

is_path_filtered(NodePath)

Qualifiers: const

Returns true if the given path is filtered.

bool is_path_filtered(NodePath path)

Parameters

path NodePath

is_process_testing

Qualifiers: const

Returns true if this animation node is being processed in test-only mode.

bool is_process_testing

remove_input(int)

Removes an input, call this only when inactive.

void remove_input(int index)

Parameters

index int

set_filter_path(NodePath, bool)

Adds or removes a path for the filter.

void set_filter_path(NodePath path, bool enable)

Parameters

path NodePath
enable bool

set_input_name(int, String)

Sets the name of the input at the given input index. If the setting fails, returns false.

bool set_input_name(int input, String name)

Parameters

input int
name String

set_parameter(StringName, Variant)

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

void set_parameter(StringName name, Variant value)

Parameters

name StringName
value Variant

Events

animation_node_removed(int, String)

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

signal animation_node_removed(int object_id, String name)

Parameters

object_id int
name String

animation_node_renamed(int, String, String)

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

signal animation_node_renamed(int object_id, String old_name, String new_name)

Parameters

object_id int
old_name String
new_name String

tree_changed

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

signal tree_changed