Documentation
¶
Overview ¶
Contains multiple AnimationRootNodes 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 AnimationNodeStateMachinePlayback object from the 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 ¶
- type Advanced
- type Any
- type Expanded
- type Extension
- func (self *Extension[T]) AsAnimationNode() AnimationNode.Instance
- func (self *Extension[T]) AsAnimationNodeStateMachine() Instance
- func (self *Extension[T]) AsAnimationRootNode() AnimationRootNode.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- func (self *Extension[T]) AsResource() Resource.Instance
- type ID
- type Instance
- func (self Instance) AddNode(name string, node AnimationNode.Instance)
- func (self Instance) AddTransition(from string, to string, ...)
- func (self Instance) AllowTransitionToSelf() bool
- func (self Instance) AsAnimationNode() AnimationNode.Instance
- func (self Instance) AsAnimationNodeStateMachine() Instance
- func (self Instance) AsAnimationRootNode() AnimationRootNode.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) GetGraphOffset() Vector2.XY
- func (self Instance) GetNode(name string) AnimationNode.Instance
- func (self Instance) GetNodeList() []string
- func (self Instance) GetNodeName(node AnimationNode.Instance) string
- func (self Instance) GetNodePosition(name string) Vector2.XY
- func (self Instance) GetTransition(idx int) AnimationNodeStateMachineTransition.Instance
- func (self Instance) GetTransitionCount() int
- func (self Instance) GetTransitionFrom(idx int) string
- func (self Instance) GetTransitionTo(idx int) string
- func (self Instance) HasNode(name string) bool
- func (self Instance) HasTransition(from string, to string) bool
- func (self Instance) ID() ID
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) RemoveNode(name string)
- func (self Instance) RemoveTransition(from string, to string)
- func (self Instance) RemoveTransitionByIndex(idx int)
- func (self Instance) RenameNode(name string, new_name string)
- func (self Instance) ReplaceNode(name string, node AnimationNode.Instance)
- func (self Instance) ResetEnds() bool
- func (self Instance) SetAllowTransitionToSelf(value bool)
- func (self Instance) SetGraphOffset(offset Vector2.XY)
- func (self Instance) SetNodePosition(name string, position Vector2.XY)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetResetEnds(value bool)
- func (self Instance) SetStateMachineType(value StateMachineType)
- func (self Instance) StateMachineType() StateMachineType
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
- type StateMachineType
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 Extension ¶
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 (*Extension[T]) AsAnimationRootNode ¶
func (self *Extension[T]) AsAnimationRootNode() AnimationRootNode.Instance
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type 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.
type Instance ¶
type Instance [1]gdclass.AnimationNodeStateMachine
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 (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 ¶
If true, allows teleport to the self state with AnimationNodeStateMachinePlayback.Travel. When the reset option is enabled in AnimationNodeStateMachinePlayback.Travel, the animation is restarted. If false, nothing happens on the teleportation to the self state.
func (Instance) AsAnimationNode ¶
func (self Instance) AsAnimationNode() AnimationNode.Instance
func (Instance) AsAnimationNodeStateMachine ¶
func (Instance) AsAnimationRootNode ¶
func (self Instance) AsAnimationRootNode() AnimationRootNode.Instance
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) GetGraphOffset ¶
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 ¶
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 ¶
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 ¶
Returns the number of connections in the graph.
func (Instance) GetTransitionFrom ¶
Returns the given transition's start node.
func (Instance) GetTransitionTo ¶
Returns the given transition's end node.
func (Instance) HasTransition ¶
Returns true if there is a transition between the given animation nodes.
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) RemoveNode ¶
Deletes the given animation node from the graph.
func (Instance) RemoveTransition ¶
Deletes the transition between the two specified animation nodes.
func (Instance) RemoveTransitionByIndex ¶
Deletes the given transition by index.
func (Instance) RenameNode ¶
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 ¶
If true, treat the cross-fade to the start and end nodes as a blend with the RESET animation.
In most cases, when additional cross-fades are performed in the parent AnimationNode of the state machine, setting this property to false and matching the cross-fade time of the parent AnimationNode and the state machine's start node and end node gives good results.
func (Instance) SetAllowTransitionToSelf ¶
SetAllowTransitionToSelf sets the property returned by [IsAllowTransitionToSelf].
func (Instance) SetGraphOffset ¶
Sets the draw offset of the graph. Used for display in the editor.
func (Instance) SetNodePosition ¶
Sets the animation node's coordinates. Used for display in the editor.
func (Instance) SetResetEnds ¶
SetResetEnds sets the property returned by [AreEndsReset].
func (Instance) SetStateMachineType ¶
func (self Instance) SetStateMachineType(value StateMachineType)
SetStateMachineType sets the property returned by [GetStateMachineType].
func (Instance) StateMachineType ¶
func (self Instance) StateMachineType() StateMachineType
This property can define the process of transitions for different use cases. See also [AnimationNodeStateMachine.StateMachineType].
type MoreArgs ¶
type MoreArgs [1]gdclass.AnimationNodeStateMachine
MoreArgs is a container for Instance functions with additional 'optional' arguments.
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 [StateMachineType] of [StateMachineTypeRoot] or [StateMachineTypeNested] in the parent or ancestor. // // [StateMachineType]: https://pkg.go.dev/graphics.gd/classdb/#Instance.StateMachineType StateMachineTypeGrouped StateMachineType = 2 )