2018-07-26 09:56:21 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2022-02-14 13:18:53 +00:00
<class name= "AnimationNodeStateMachine" inherits= "AnimationRootNode" version= "4.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2018-07-26 09:56:21 +00:00
<brief_description >
2019-05-21 02:45:23 +00:00
State machine for control of animations.
2018-07-26 09:56:21 +00:00
</brief_description>
<description >
2020-01-23 10:14:14 +00:00
Contains multiple nodes representing animation states, connected in a graph. Node 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.
2019-06-21 23:04:47 +00:00
[b]Example:[/b]
2020-07-31 14:07:26 +00:00
[codeblocks]
[gdscript]
2019-05-21 02:45:23 +00:00
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
2020-07-31 14:07:26 +00:00
[/gdscript]
[csharp]
var stateMachine = GetNode< AnimationTree> ("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
stateMachine.Travel("some_state");
[/csharp]
[/codeblocks]
2018-07-26 09:56:21 +00:00
</description>
<tutorials >
2021-11-15 09:43:07 +00:00
<link title= "AnimationTree" > $DOCS_URL/tutorials/animation/animation_tree.html</link>
2018-07-26 09:56:21 +00:00
</tutorials>
<methods >
<method name= "add_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "node" type= "AnimationNode" />
<param index= "2" name= "position" type= "Vector2" default= "Vector2(0, 0)" />
2018-07-26 09:56:21 +00:00
<description >
2022-08-12 17:51:01 +00:00
Adds a new node to the graph. The [param position] is used for display in the editor.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "add_transition" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from" type= "StringName" />
<param index= "1" name= "to" type= "StringName" />
<param index= "2" name= "transition" type= "AnimationNodeStateMachineTransition" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Adds a transition between the given nodes.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_graph_offset" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the draw offset of the graph. Used for display in the editor.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "AnimationNode" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the animation node with the given name.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_node_name" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "StringName" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "node" type= "AnimationNode" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the given animation node's name.
2018-07-26 09:56:21 +00:00
</description>
</method>
2018-08-20 22:35:30 +00:00
<method name= "get_node_position" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "Vector2" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
2018-08-20 22:35:30 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the given node's coordinates. Used for display in the editor.
2018-08-20 22:35:30 +00:00
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "get_transition" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "AnimationNodeStateMachineTransition" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the given transition.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_transition_count" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the number of connections in the graph.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_transition_from" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "StringName" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the given transition's start node.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "get_transition_to" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "StringName" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns the given transition's end node.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "has_node" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns [code]true[/code] if the graph contains the given node.
2018-07-26 09:56:21 +00:00
</description>
</method>
2018-08-20 22:35:30 +00:00
<method name= "has_transition" qualifiers= "const" >
2021-07-30 13:28:05 +00:00
<return type= "bool" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from" type= "StringName" />
<param index= "1" name= "to" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Returns [code]true[/code] if there is a transition between the given nodes.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "remove_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Deletes the given node from the graph.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "remove_transition" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "from" type= "StringName" />
<param index= "1" name= "to" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2020-01-23 10:14:14 +00:00
Deletes the transition between the two specified nodes.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "remove_transition_by_index" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 09:56:21 +00:00
<description >
2020-01-23 10:14:14 +00:00
Deletes the given transition by index.
2018-07-26 09:56:21 +00:00
</description>
</method>
<method name= "rename_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "new_name" type= "StringName" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Renames the given node.
2018-07-26 09:56:21 +00:00
</description>
</method>
2020-03-18 08:14:39 +00:00
<method name= "replace_node" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "node" type= "AnimationNode" />
2020-03-18 08:14:39 +00:00
<description >
</description>
</method>
2018-07-26 09:56:21 +00:00
<method name= "set_graph_offset" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "offset" type= "Vector2" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Sets the draw offset of the graph. Used for display in the editor.
2018-07-26 09:56:21 +00:00
</description>
</method>
2018-08-20 22:35:30 +00:00
<method name= "set_node_position" >
2021-07-30 13:28:05 +00:00
<return type= "void" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "position" type= "Vector2" />
2018-07-26 09:56:21 +00:00
<description >
2019-05-21 02:45:23 +00:00
Sets the node's coordinates. Used for display in the editor.
2018-07-26 09:56:21 +00:00
</description>
</method>
</methods>
2023-01-31 12:17:29 +00:00
<members >
<member name= "allow_transition_to_self" type= "bool" setter= "set_allow_transition_to_self" getter= "is_allow_transition_to_self" default= "false" >
If [code]true[/code], allows teleport to the self state with [method AnimationNodeStateMachinePlayback.travel]. When the reset option is enabled in [method AnimationNodeStateMachinePlayback.travel], the animation is restarted. If [code]false[/code], nothing happens on the teleportation to the self state.
</member>
</members>
2018-07-26 09:56:21 +00:00
</class>