AnimationNodeStateMachine.xml 6.5 KB

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