Index · Object → RefCounted → Resource → AnimationNode

AnimationNode

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

Inherited by (6): AnimationNodeExtensionAnimationNodeOutputAnimationNodeSyncAnimationNodeTimeScaleAnimationNodeTimeSeekAnimationRootNode
Class 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 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"]

Properties

var filter_enabled: bool

If true, filtering is enabled.

Inherited from Resource (4)

Methods

func _get_caption() -> String

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

func _get_child_by_name(name: StringName) -> AnimationNode

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

func _get_child_nodes() -> Dictionary

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

func _get_parameter_default_value(parameter: StringName) -> Variant

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.

func _get_parameter_list() -> Array

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 Object.get_property_list().

func _has_filter() -> bool

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

func _is_parameter_read_only(parameter: StringName) -> bool

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.

func _process(time: float, seek: bool, is_external_seeking: bool, test_only: bool) -> float

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 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 delta.

func add_input(name: String) -> bool

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.

func blend_animation(animation: StringName, time: float, delta: float, seeked: bool, is_external_seeking: bool, blend: float, looped_flag: Animation.LoopedFlag = 0) -> void

Blends 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.

func blend_input(input_index: int, time: float, seek: bool, is_external_seeking: bool, blend: float, filter: AnimationNode.FilterAction = 0, sync: bool = true, test_only: bool = false) -> float

Blends 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.

func blend_node(name: StringName, node: AnimationNode, time: float, seek: bool, is_external_seeking: bool, blend: float, filter: AnimationNode.FilterAction = 0, sync: bool = true, test_only: bool = false) -> float

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.

func find_input(name: String) -> int

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

func get_input_count() -> int

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

func get_input_name(input: int) -> String

Gets the name of an input by index.

func get_parameter(name: StringName) -> Variant

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.

func get_processing_animation_tree_instance_id() -> int

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.

func is_path_filtered(path: NodePath) -> bool

Returns true if the given path is filtered.

func is_process_testing() -> bool

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

func remove_input(index: int) -> void

Removes an input, call this only when inactive.

func set_filter_path(path: NodePath, enable: bool) -> void

Adds or removes a path for the filter.

func set_input_name(input: int, name: String) -> bool

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

func set_parameter(name: StringName, value: Variant) -> void

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

Inherited from Resource (18)
func _get_rid() -> RID
func _reset_state() -> void
func _set_path_cache(path: String) -> void
func _setup_local_to_scene() -> void
func copy_from_resource(resource: Resource) -> Error
func duplicate(deep: bool = false) -> Resource
func duplicate_deep(deep_subresources_mode: Resource.DeepDuplicateMode = 1) -> Resource
func emit_changed() -> void
func get_rid() -> RID
func is_built_in() -> bool
func reset_state() -> void
func set_id_for_path(path: String, id: String) -> void
func set_path_cache(path: String) -> void
func setup_local_to_scene() -> void
func take_over_path(path: String) -> void
Inherited from RefCounted (4)
func init_ref() -> bool
func reference() -> bool
func unreference() -> bool
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal animation_node_removed(object_id: int, node_name: 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_renamed(object_id: int, old_name: String, new_name: 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 node_updated(object_id: int)

Emitted by AnimationNodeAnimation when its AnimationNodeAnimation.animation resource is changed, or by AnimationNodeBlendTree when its connections change.

signal 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.

Inherited from Resource (2)
signal changed()
Inherited from Object (2)

Enums & Constants

enum FilterAction
FILTER_IGNORE = 0

Do not use filtering.

FILTER_PASS = 1

Paths matching the filter will be allowed to pass.

FILTER_STOP = 2

Paths matching the filter will be discarded.

FILTER_BLEND = 3

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