AnimationNode

package
v0.0.0-...-ad02d68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

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]. [codeblock] var current_length = $AnimationTree[parameters/AnimationNodeName/current_length] var current_position = $AnimationTree[parameters/AnimationNodeName/current_position] var current_delta = $AnimationTree[parameters/AnimationNodeName/current_delta] [/codeblock]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsAnimationNode() Instance
}

type Expanded

type Expanded [1]gdclass.AnimationNode

func (Expanded) BlendAnimation

func (self Expanded) BlendAnimation(animation string, time Float.X, delta Float.X, seeked bool, is_external_seeking bool, blend Float.X, looped_flag Animation.LoopedFlag)

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 [Animation.LoopedFlag].

func (Expanded) BlendInput

func (self Expanded) BlendInput(input_index int, time Float.X, seek bool, is_external_seeking bool, blend Float.X, filter FilterAction, sync bool, test_only bool) Float.X

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

func (Expanded) BlendNode

func (self Expanded) BlendNode(name string, node Instance, time Float.X, seek bool, is_external_seeking bool, blend Float.X, filter FilterAction, sync bool, test_only bool) Float.X

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.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsAnimationNode

func (self *Extension[T]) AsAnimationNode() Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type FilterAction

type FilterAction int //gd:AnimationNode.FilterAction
const (
	/*Do not use filtering.*/
	FilterIgnore FilterAction = 0
	/*Paths matching the filter will be allowed to pass.*/
	FilterPass FilterAction = 1
	/*Paths matching the filter will be discarded.*/
	FilterStop FilterAction = 2
	/*Paths matching the filter will be blended (by the blend value).*/
	FilterBlend FilterAction = 3
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.AnimationNode

Instance of the class with convieniently typed arguments and results. See Interface for methods that can be overridden by a [Class] that extends it.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddInput

func (self Instance) AddInput(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 (Instance) AsAnimationNode

func (self Instance) AsAnimationNode() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) BlendAnimation

func (self Instance) BlendAnimation(animation string, time Float.X, delta Float.X, seeked bool, is_external_seeking bool, blend Float.X)

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 [Animation.LoopedFlag].

func (Instance) BlendInput

func (self Instance) BlendInput(input_index int, time Float.X, seek bool, is_external_seeking bool, blend Float.X) Float.X

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

func (Instance) BlendNode

func (self Instance) BlendNode(name string, node Instance, time Float.X, seek bool, is_external_seeking bool, blend Float.X) Float.X

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 (Instance) FilterEnabled

func (self Instance) FilterEnabled() bool

func (Instance) FindInput

func (self Instance) FindInput(name string) int

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

func (Instance) GetInputCount

func (self Instance) GetInputCount() int

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

func (Instance) GetInputName

func (self Instance) GetInputName(input int) string

Gets the name of an input by index.

func (Instance) GetParameter

func (self Instance) GetParameter(name string) any

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 (Instance) GetProcessingAnimationTreeInstanceId

func (self Instance) GetProcessingAnimationTreeInstanceId() int

Returns the object id of the [AnimationTree] that owns this node. Note: This method should only be called from within the [Instance.Animationnodeextension.ProcessAnimationNode] method, and will return an invalid id otherwise.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsPathFiltered

func (self Instance) IsPathFiltered(path string) bool

Returns true if the given path is filtered.

func (Instance) IsProcessTesting

func (self Instance) IsProcessTesting() bool

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

func (Instance) OnAnimationNodeRemoved

func (self Instance) OnAnimationNodeRemoved(cb func(object_id int, name string), flags ...Signal.Flags)

func (Instance) OnAnimationNodeRenamed

func (self Instance) OnAnimationNodeRenamed(cb func(object_id int, old_name string, new_name string), flags ...Signal.Flags)

func (Instance) OnTreeChanged

func (self Instance) OnTreeChanged(cb func(), flags ...Signal.Flags)

func (Instance) RemoveInput

func (self Instance) RemoveInput(index int)

Removes an input, call this only when inactive.

func (Instance) SetFilterEnabled

func (self Instance) SetFilterEnabled(value bool)

func (Instance) SetFilterPath

func (self Instance) SetFilterPath(path string, enable bool)

Adds or removes a path for the filter.

func (Instance) SetInputName

func (self Instance) SetInputName(input int, name string) bool

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

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetParameter

func (self Instance) SetParameter(name string, value any)

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

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	//When inheriting from [AnimationRootNode], implement this virtual method to return all child animation nodes in order as a [code]name: node[/code] dictionary.
	GetChildNodes() map[any]any
	//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 [method Object.get_property_list].
	GetParameterList() []any
	//When inheriting from [AnimationRootNode], implement this virtual method to return a child animation node by its [param name].
	GetChildByName(name string) Instance
	//When inheriting from [AnimationRootNode], implement this virtual method to return the default value of a [param parameter]. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees.
	GetParameterDefaultValue(parameter string) any
	//When inheriting from [AnimationRootNode], implement this virtual method to return whether the [param parameter] is read-only. Parameters are custom local memory used for your animation nodes, given a resource can be reused in multiple trees.
	IsParameterReadOnly(parameter string) bool
	//When inheriting from [AnimationRootNode], implement this virtual method to run some code when this animation node is processed. The [param time] parameter is a relative delta, unless [param seek] is [code]true[/code], in which case it is absolute.
	//Here, call the [method blend_input], [method blend_node] or [method blend_animation] functions. You can also use [method get_parameter] and [method set_parameter] to modify local memory.
	//This function should return the delta.
	Process(time Float.X, seek bool, is_external_seeking bool, test_only bool) Float.X
	//When inheriting from [AnimationRootNode], implement this virtual method to override the text caption for this animation node.
	GetCaption() string
	//When inheriting from [AnimationRootNode], implement this virtual method to return whether the blend tree editor should display filter editing on this animation node.
	HasFilter() bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL