AnimationNodeStateMachine

Inherits: AnimationRootNode < AnimationNode < Resource < Reference < Object

Category: Core

Brief Description

State machine for control of animations.

Methods

voidadd_node ( String name, AnimationNode node, Vector2 position=Vector2( 0, 0 ) )
voidadd_transition ( String from, String to, AnimationNodeStateMachineTransition transition )
Stringget_end_node ( ) const
Vector2get_graph_offset ( ) const
AnimationNodeget_node ( String name ) const
Stringget_node_name ( AnimationNode node ) const
Vector2get_node_position ( String name ) const
Stringget_start_node ( ) const
AnimationNodeStateMachineTransitionget_transition ( int idx ) const
intget_transition_count ( ) const
Stringget_transition_from ( int idx ) const
Stringget_transition_to ( int idx ) const
boolhas_node ( String name ) const
boolhas_transition ( String from, String to ) const
voidremove_node ( String name )
voidremove_transition ( String from, String to )
voidremove_transition_by_index ( int idx )
voidrename_node ( String name, String new_name )
voidset_end_node ( String name )
voidset_graph_offset ( Vector2 offset )
voidset_node_position ( String name, Vector2 position )
voidset_start_node ( String name )

Description

Contains multiple nodes representing animation states, connected in a graph. Nodes 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 programatically. Example:

  1. var state_machine = $AnimationTree.get("parameters/playback")
  2. state_machine.travel("some_state")

Method Descriptions

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


Adds a transition between the given nodes.


  • String get_end_node ( ) const

Returns the graph’s end node.


  • Vector2 get_graph_offset ( ) const

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


Returns the animation node with the given name.


Returns the given animation node’s name.


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


  • String get_start_node ( ) const

Returns the graph’s end node.


Returns the given transition.


  • int get_transition_count ( ) const

Returns the number of connections in the graph.


  • String get_transition_from ( int idx ) const

Returns the given transition’s start node.


Returns the given transition’s end node.


Returns true if the graph contains the given node.


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


  • void remove_node ( String name )

Deletes the given node from the graph.


Deletes the given transition.


  • void remove_transition_by_index ( int idx )

Deletes the given transition.


Renames the given node.


  • void set_end_node ( String name )

Sets the given node as the graph end point.


  • void set_graph_offset ( Vector2 offset )

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


Sets the node’s coordinates. Used for display in the editor.


  • void set_start_node ( String name )

Sets the given node as the graph start point.