AnimationNodeStateMachinePlayback

package
v0.0.0-...-535787f Latest Latest
Warning

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

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

Documentation

Overview

Allows control of graphics.gd/classdb/AnimationTree state machines created with graphics.gd/classdb/AnimationNodeStateMachine. Retrieve with $AnimationTree.get("parameters/playback").

package main

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

func ExampleAnimationNodeStateMachinePlayback(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
	AsAnimationNodeStateMachinePlayback() Instance
}

type Expanded

func (Expanded) Start

func (self Expanded) Start(node string, reset bool)

Starts playing the given animation.

If 'reset' is true, the animation is played from the beginning.

func (Expanded) Travel

func (self Expanded) Travel(to_node string, reset_on_teleport bool)

Transitions from the current state to another one, following the shortest path.

If the path does not connect from the current state, the animation will play after the state teleports.

If 'reset_on_teleport' is true, the animation is played from the beginning when the travel cause a teleportation.

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]) AsAnimationNodeStateMachinePlayback

func (self *Extension[T]) AsAnimationNodeStateMachinePlayback() 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) AsAnimationNodeStateMachinePlayback

func (self Instance) AsAnimationNodeStateMachinePlayback() 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) GetCurrentLength

func (self Instance) GetCurrentLength() Float.X

Returns the current state length.

Note: It is possible that any graphics.gd/classdb/AnimationRootNode can be nodes as well as animations. This means that there can be multiple animations within a single state. Which animation length has priority depends on the nodes connected inside it. Also, if a transition does not reset, the remaining length at that point will be returned.

func (Instance) GetCurrentNode

func (self Instance) GetCurrentNode() string

Returns the currently playing animation state.

Note: When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.

func (Instance) GetCurrentPlayPosition

func (self Instance) GetCurrentPlayPosition() Float.X

Returns the playback position within the current animation state.

func (Instance) GetFadingFromNode

func (self Instance) GetFadingFromNode() string

Returns the starting state of currently fading animation.

func (Instance) GetTravelPath

func (self Instance) GetTravelPath() []string

Returns the current travel path as computed internally by the A* algorithm.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsPlaying

func (self Instance) IsPlaying() bool

Returns true if an animation is playing.

func (Instance) Next

func (self Instance) Next()

If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.

func (Instance) OnStateFinished

func (self Instance) OnStateFinished(cb func(state string), flags ...Signal.Flags)

func (Instance) OnStateStarted

func (self Instance) OnStateStarted(cb func(state string), flags ...Signal.Flags)

func (*Instance) SetObject

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

func (Instance) Start

func (self Instance) Start(node string)

Starts playing the given animation.

If 'reset' is true, the animation is played from the beginning.

func (Instance) Stop

func (self Instance) Stop()

Stops the currently playing animation.

func (Instance) Travel

func (self Instance) Travel(to_node string)

Transitions from the current state to another one, following the shortest path.

If the path does not connect from the current state, the animation will play after the state teleports.

If 'reset_on_teleport' is true, the animation is played from the beginning when the travel cause a teleportation.

func (Instance) Virtual

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

Jump to

Keyboard shortcuts

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