AnimationNode

package
v0.0.0-...-e10d1cd Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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.

package main

import (
	"fmt"

	"graphics.gd/classdb/AnimationTree"
	"graphics.gd/variant/Object"
)

func ExampleAnimationNode(tree AnimationTree.Instance) {
	var current_length = Object.Get(tree, "parameters/AnimationNodeName/current_length")
	var current_position = Object.Get(tree, "parameters/AnimationNodeName/current_position")
	var current_delta = Object.Get(tree, "parameters/AnimationNodeName/current_delta")
	fmt.Print(current_length, current_position, current_delta)
}

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 = MoreArgs

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]See Interface for methods that can be overridden by T.

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.

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)

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

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

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 (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 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) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

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 name: node dictionary.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	GetChildNodes() map[string]struct{}
	// 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.GetPropertyList].
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	// [Object.GetPropertyList]: https://pkg.go.dev/graphics.gd/variant/Object#GetPropertyList
	GetParameterList() []Object.PropertyInfo
	// When inheriting from [AnimationRootNode], implement this virtual method to return a child animation node by its 'name'.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	GetChildByName(name string) Instance
	// 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.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	GetParameterDefaultValue(parameter string) any
	// 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.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	IsParameterReadOnly(parameter string) bool
	// 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 [BlendInput], [BlendNode] or [BlendAnimation] functions. You can also use [GetParameter] and [SetParameter] to modify local memory.
	//
	// This function should return the delta.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	// [BlendAnimation]: https://pkg.go.dev/graphics.gd/classdb/AnimationNode#Instance.BlendAnimation
	// [BlendInput]: https://pkg.go.dev/graphics.gd/classdb/AnimationNode#Instance.BlendInput
	// [BlendNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationNode#Instance.BlendNode
	// [GetParameter]: https://pkg.go.dev/graphics.gd/classdb/AnimationNode#Instance.GetParameter
	// [SetParameter]: https://pkg.go.dev/graphics.gd/classdb/AnimationNode#Instance.SetParameter
	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.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	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.
	//
	// [AnimationRootNode]: https://pkg.go.dev/graphics.gd/classdb/AnimationRootNode
	HasFilter() bool
}

type MoreArgs

type MoreArgs [1]gdclass.AnimationNode

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) BlendAnimation

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

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 (MoreArgs) BlendInput

func (self MoreArgs) 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

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 (MoreArgs) BlendNode

func (self MoreArgs) 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.

Jump to

Keyboard shortcuts

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