AnimationNodeStateMachine.xml 6.8 KB

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