summaryrefslogtreecommitdiff
path: root/doc/classes/AnimationNodeStateMachine.xml
blob: 8e070142c4c02ccc3f2d5446bf0669c0aaffa6c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimationNodeStateMachine" inherits="AnimationRootNode" version="4.0">
	<brief_description>
		State machine for control of animations.
	</brief_description>
	<description>
		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.
		[b]Example:[/b]
		[codeblocks]
		[gdscript]
		var state_machine = $AnimationTree.get("parameters/playback")
		state_machine.travel("some_state")
		[/gdscript]
		[csharp]
		var stateMachine = GetNode&lt;AnimationTree&gt;("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback;
		stateMachine.Travel("some_state");
		[/csharp]
		[/codeblocks]
	</description>
	<tutorials>
		<link title="AnimationTree">https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html</link>
	</tutorials>
	<methods>
		<method name="add_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<argument index="1" name="node" type="AnimationNode">
			</argument>
			<argument index="2" name="position" type="Vector2" default="Vector2(0, 0)">
			</argument>
			<description>
				Adds a new node to the graph. The [code]position[/code] is used for display in the editor.
			</description>
		</method>
		<method name="add_transition">
			<return type="void">
			</return>
			<argument index="0" name="from" type="StringName">
			</argument>
			<argument index="1" name="to" type="StringName">
			</argument>
			<argument index="2" name="transition" type="AnimationNodeStateMachineTransition">
			</argument>
			<description>
				Adds a transition between the given nodes.
			</description>
		</method>
		<method name="get_end_node" qualifiers="const">
			<return type="String">
			</return>
			<description>
				Returns the graph's end node.
			</description>
		</method>
		<method name="get_graph_offset" qualifiers="const">
			<return type="Vector2">
			</return>
			<description>
				Returns the draw offset of the graph. Used for display in the editor.
			</description>
		</method>
		<method name="get_node" qualifiers="const">
			<return type="AnimationNode">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Returns the animation node with the given name.
			</description>
		</method>
		<method name="get_node_name" qualifiers="const">
			<return type="StringName">
			</return>
			<argument index="0" name="node" type="AnimationNode">
			</argument>
			<description>
				Returns the given animation node's name.
			</description>
		</method>
		<method name="get_node_position" qualifiers="const">
			<return type="Vector2">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Returns the given node's coordinates. Used for display in the editor.
			</description>
		</method>
		<method name="get_start_node" qualifiers="const">
			<return type="String">
			</return>
			<description>
				Returns the graph's end node.
			</description>
		</method>
		<method name="get_transition" qualifiers="const">
			<return type="AnimationNodeStateMachineTransition">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Returns the given transition.
			</description>
		</method>
		<method name="get_transition_count" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the number of connections in the graph.
			</description>
		</method>
		<method name="get_transition_from" qualifiers="const">
			<return type="StringName">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Returns the given transition's start node.
			</description>
		</method>
		<method name="get_transition_to" qualifiers="const">
			<return type="StringName">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Returns the given transition's end node.
			</description>
		</method>
		<method name="has_node" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Returns [code]true[/code] if the graph contains the given node.
			</description>
		</method>
		<method name="has_transition" qualifiers="const">
			<return type="bool">
			</return>
			<argument index="0" name="from" type="StringName">
			</argument>
			<argument index="1" name="to" type="StringName">
			</argument>
			<description>
				Returns [code]true[/code] if there is a transition between the given nodes.
			</description>
		</method>
		<method name="remove_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Deletes the given node from the graph.
			</description>
		</method>
		<method name="remove_transition">
			<return type="void">
			</return>
			<argument index="0" name="from" type="StringName">
			</argument>
			<argument index="1" name="to" type="StringName">
			</argument>
			<description>
				Deletes the transition between the two specified nodes.
			</description>
		</method>
		<method name="remove_transition_by_index">
			<return type="void">
			</return>
			<argument index="0" name="idx" type="int">
			</argument>
			<description>
				Deletes the given transition by index.
			</description>
		</method>
		<method name="rename_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<argument index="1" name="new_name" type="StringName">
			</argument>
			<description>
				Renames the given node.
			</description>
		</method>
		<method name="replace_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<argument index="1" name="node" type="AnimationNode">
			</argument>
			<description>
			</description>
		</method>
		<method name="set_end_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Sets the given node as the graph end point.
			</description>
		</method>
		<method name="set_graph_offset">
			<return type="void">
			</return>
			<argument index="0" name="offset" type="Vector2">
			</argument>
			<description>
				Sets the draw offset of the graph. Used for display in the editor.
			</description>
		</method>
		<method name="set_node_position">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<argument index="1" name="position" type="Vector2">
			</argument>
			<description>
				Sets the node's coordinates. Used for display in the editor.
			</description>
		</method>
		<method name="set_start_node">
			<return type="void">
			</return>
			<argument index="0" name="name" type="StringName">
			</argument>
			<description>
				Sets the given node as the graph start point.
			</description>
		</method>
	</methods>
	<constants>
	</constants>
</class>