2018-07-26 11:56:21 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 10:08:05 +02:00
<class name= "AnimationNodeStateMachine" inherits= "AnimationRootNode" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2018-07-26 11:56:21 +02:00
<brief_description >
2023-04-28 17:16:44 +02:00
A state machine with multiple [AnimationRootNode]s, used by [AnimationTree].
2018-07-26 11:56:21 +02:00
</brief_description>
<description >
2023-04-30 16:32:18 +02:00
Contains multiple [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 [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it programmatically.
2019-06-22 01:04:47 +02:00
[b]Example:[/b]
2020-07-31 16:07:26 +02:00
[codeblocks]
[gdscript]
2019-05-21 04:45:23 +02:00
var state_machine = $AnimationTree.get("parameters/playback")
state_machine.travel("some_state")
2020-07-31 16:07:26 +02:00
[/gdscript]
[csharp]
var stateMachine = GetNode< AnimationTree> ("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
stateMachine.Travel("some_state");
[/csharp]
[/codeblocks]
2018-07-26 11:56:21 +02:00
</description>
<tutorials >
2023-04-28 17:16:44 +02:00
<link title= "Using AnimationTree" > $DOCS_URL/tutorials/animation/animation_tree.html</link>
2018-07-26 11:56:21 +02:00
</tutorials>
<methods >
<method name= "add_node" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02: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 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Adds a new animation node to the graph. The [param position] is used for display in the editor.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "add_transition" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02: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 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Adds a transition between the given animation nodes.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_graph_offset" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector2" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the draw offset of the graph. Used for display in the editor.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_node" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "AnimationNode" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the animation node with the given name.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_node_name" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "StringName" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "node" type= "AnimationNode" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the given animation node's name.
2018-07-26 11:56:21 +02:00
</description>
</method>
2018-08-21 00:35:30 +02:00
<method name= "get_node_position" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "Vector2" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
2018-08-21 00:35:30 +02:00
<description >
2023-04-30 16:32:18 +02:00
Returns the given animation node's coordinates. Used for display in the editor.
2018-08-21 00:35:30 +02:00
</description>
</method>
2018-07-26 11:56:21 +02:00
<method name= "get_transition" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "AnimationNodeStateMachineTransition" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the given transition.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_transition_count" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "int" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the number of connections in the graph.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_transition_from" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "StringName" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the given transition's start node.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "get_transition_to" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "StringName" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Returns the given transition's end node.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "has_node" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Returns [code]true[/code] if the graph contains the given animation node.
2018-07-26 11:56:21 +02:00
</description>
</method>
2018-08-21 00:35:30 +02:00
<method name= "has_transition" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "bool" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "from" type= "StringName" />
<param index= "1" name= "to" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Returns [code]true[/code] if there is a transition between the given animation nodes.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "remove_node" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Deletes the given animation node from the graph.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "remove_transition" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "from" type= "StringName" />
<param index= "1" name= "to" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Deletes the transition between the two specified animation nodes.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "remove_transition_by_index" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "idx" type= "int" />
2018-07-26 11:56:21 +02:00
<description >
2020-01-23 11:14:14 +01:00
Deletes the given transition by index.
2018-07-26 11:56:21 +02:00
</description>
</method>
<method name= "rename_node" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "new_name" type= "StringName" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Renames the given animation node.
2018-07-26 11:56:21 +02:00
</description>
</method>
2020-03-18 09:14:39 +01:00
<method name= "replace_node" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "node" type= "AnimationNode" />
2020-03-18 09:14:39 +01:00
<description >
2023-11-11 00:34:07 +01:00
Replaces the given animation node with a new animation node.
2020-03-18 09:14:39 +01:00
</description>
</method>
2018-07-26 11:56:21 +02:00
<method name= "set_graph_offset" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "offset" type= "Vector2" />
2018-07-26 11:56:21 +02:00
<description >
2019-05-21 04:45:23 +02:00
Sets the draw offset of the graph. Used for display in the editor.
2018-07-26 11:56:21 +02:00
</description>
</method>
2018-08-21 00:35:30 +02:00
<method name= "set_node_position" >
2021-07-30 15:28:05 +02:00
<return type= "void" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "name" type= "StringName" />
<param index= "1" name= "position" type= "Vector2" />
2018-07-26 11:56:21 +02:00
<description >
2023-04-30 16:32:18 +02:00
Sets the animation node's coordinates. Used for display in the editor.
2018-07-26 11:56:21 +02:00
</description>
</method>
</methods>
2023-01-31 13:17:29 +01: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>
2023-02-18 03:02:28 +01:00
<member name= "reset_ends" type= "bool" setter= "set_reset_ends" getter= "are_ends_reset" default= "false" >
If [code]true[/code], 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 [code]false[/code] and matching the cross-fade time of the parent [AnimationNode] and the state machine's start node and end node gives good results.
</member>
<member name= "state_machine_type" type= "int" setter= "set_state_machine_type" getter= "get_state_machine_type" enum= "AnimationNodeStateMachine.StateMachineType" default= "0" >
This property can define the process of transitions for different use cases. See also [enum AnimationNodeStateMachine.StateMachineType].
</member>
2023-01-31 13:17:29 +01:00
</members>
2023-02-18 03:02:28 +01:00
<constants >
<constant name= "STATE_MACHINE_TYPE_ROOT" value= "0" enum= "StateMachineType" >
Seeking to the beginning is treated as playing from the start state. Transition to the end state is treated as exiting the state machine.
</constant>
<constant name= "STATE_MACHINE_TYPE_NESTED" value= "1" enum= "StateMachineType" >
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.
</constant>
<constant name= "STATE_MACHINE_TYPE_GROUPED" value= "2" enum= "StateMachineType" >
This is a grouped state machine that can be controlled from a parent state machine. It does not work on standalone. There must be a state machine with [member state_machine_type] of [constant STATE_MACHINE_TYPE_ROOT] or [constant STATE_MACHINE_TYPE_NESTED] in the parent or ancestor.
</constant>
</constants>
2018-07-26 11:56:21 +02:00
</class>