AnimationNodeStateMachine

package
v0.0.0-...-ff35923 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Contains multiple [graphics.gd/classdb/AnimationRootNode]s representing animation states, connected in a graph. State transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the graphics.gd/classdb/AnimationNodeStateMachinePlayback object from the graphics.gd/classdb/AnimationTree node to control it programmatically.

package main

import (
	"graphics.gd/classdb/AnimationNodeStateMachinePlayback"
	"graphics.gd/classdb/AnimationTree"
	"graphics.gd/variant/Object"
)

func ExampleAnimationNodeStateMachine(tree AnimationTree.Instance) {
	var stateMachine = Object.Get(tree, "parameters/playback").(AnimationNodeStateMachinePlayback.Instance)
	stateMachine.Travel("some_state")
}

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
	AsAnimationNodeStateMachine() Instance
}

type Expanded

func (Expanded) AddNode

func (self Expanded) AddNode(name string, node AnimationNode.Instance, position Vector2.XY)

Adds a new animation node to the graph. The 'position' is used for display in the editor.

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() AnimationNode.Instance

func (*Extension[T]) AsAnimationNodeStateMachine

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

func (*Extension[T]) AsAnimationRootNode

func (self *Extension[T]) AsAnimationRootNode() AnimationRootNode.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 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 Instance

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

func (self Instance) AddNode(name string, node AnimationNode.Instance)

Adds a new animation node to the graph. The 'position' is used for display in the editor.

func (Instance) AddTransition

func (self Instance) AddTransition(from string, to string, transition AnimationNodeStateMachineTransition.Instance)

Adds a transition between the given animation nodes.

func (Instance) AllowTransitionToSelf

func (self Instance) AllowTransitionToSelf() bool

func (Instance) AsAnimationNode

func (self Instance) AsAnimationNode() AnimationNode.Instance

func (Instance) AsAnimationNodeStateMachine

func (self Instance) AsAnimationNodeStateMachine() Instance

func (Instance) AsAnimationRootNode

func (self Instance) AsAnimationRootNode() AnimationRootNode.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) GetGraphOffset

func (self Instance) GetGraphOffset() Vector2.XY

Returns the draw offset of the graph. Used for display in the editor.

func (Instance) GetNode

func (self Instance) GetNode(name string) AnimationNode.Instance

Returns the animation node with the given name.

func (Instance) GetNodeList

func (self Instance) GetNodeList() []string

Returns a list containing the names of all animation nodes in this state machine.

func (Instance) GetNodeName

func (self Instance) GetNodeName(node AnimationNode.Instance) string

Returns the given animation node's name.

func (Instance) GetNodePosition

func (self Instance) GetNodePosition(name string) Vector2.XY

Returns the given animation node's coordinates. Used for display in the editor.

func (Instance) GetTransition

func (self Instance) GetTransition(idx int) AnimationNodeStateMachineTransition.Instance

Returns the given transition.

func (Instance) GetTransitionCount

func (self Instance) GetTransitionCount() int

Returns the number of connections in the graph.

func (Instance) GetTransitionFrom

func (self Instance) GetTransitionFrom(idx int) string

Returns the given transition's start node.

func (Instance) GetTransitionTo

func (self Instance) GetTransitionTo(idx int) string

Returns the given transition's end node.

func (Instance) HasNode

func (self Instance) HasNode(name string) bool

Returns true if the graph contains the given animation node.

func (Instance) HasTransition

func (self Instance) HasTransition(from string, to string) bool

Returns true if there is a transition between the given animation nodes.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) RemoveNode

func (self Instance) RemoveNode(name string)

Deletes the given animation node from the graph.

func (Instance) RemoveTransition

func (self Instance) RemoveTransition(from string, to string)

Deletes the transition between the two specified animation nodes.

func (Instance) RemoveTransitionByIndex

func (self Instance) RemoveTransitionByIndex(idx int)

Deletes the given transition by index.

func (Instance) RenameNode

func (self Instance) RenameNode(name string, new_name string)

Renames the given animation node.

func (Instance) ReplaceNode

func (self Instance) ReplaceNode(name string, node AnimationNode.Instance)

Replaces the given animation node with a new animation node.

func (Instance) ResetEnds

func (self Instance) ResetEnds() bool

func (Instance) SetAllowTransitionToSelf

func (self Instance) SetAllowTransitionToSelf(value bool)

func (Instance) SetGraphOffset

func (self Instance) SetGraphOffset(offset Vector2.XY)

Sets the draw offset of the graph. Used for display in the editor.

func (Instance) SetNodePosition

func (self Instance) SetNodePosition(name string, position Vector2.XY)

Sets the animation node's coordinates. Used for display in the editor.

func (*Instance) SetObject

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

func (Instance) SetResetEnds

func (self Instance) SetResetEnds(value bool)

func (Instance) SetStateMachineType

func (self Instance) SetStateMachineType(value StateMachineType)

func (Instance) StateMachineType

func (self Instance) StateMachineType() StateMachineType

func (Instance) Virtual

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

type StateMachineType

type StateMachineType int //gd:AnimationNodeStateMachine.StateMachineType
const (
	// Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine.
	StateMachineTypeRoot StateMachineType = 0
	// Seeking to the beginning is treated as seeking to the beginning of the animation in the current state. Transition to the end state, or the absence of transitions in each state, is treated as exiting the state machine.
	StateMachineTypeNested StateMachineType = 1
	// This is a grouped state machine that can be controlled from a parent state machine. It does not work independently. There must be a state machine with [Instance.StateMachineType] of [StateMachineTypeRoot] or [StateMachineTypeNested] in the parent or ancestor.
	StateMachineTypeGrouped StateMachineType = 2
)

Jump to

Keyboard shortcuts

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