AnimationNodeStateMachine.xml 6.3 KB

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