class_animationnodestatemachine.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the AnimationNodeStateMachine.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_AnimationNodeStateMachine:
  6. AnimationNodeStateMachine
  7. =========================
  8. **Inherits:** :ref:`AnimationRootNode<class_AnimationRootNode>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. State machine for control of animations.
  13. Methods
  14. -------
  15. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_node<class_AnimationNodeStateMachine_method_add_node>` **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)** |
  17. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`add_transition<class_AnimationNodeStateMachine_method_add_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to, :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` transition **)** |
  19. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_String>` | :ref:`get_end_node<class_AnimationNodeStateMachine_method_get_end_node>` **(** **)** const |
  21. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Vector2<class_Vector2>` | :ref:`get_graph_offset<class_AnimationNodeStateMachine_method_get_graph_offset>` **(** **)** const |
  23. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`AnimationNode<class_AnimationNode>` | :ref:`get_node<class_AnimationNodeStateMachine_method_get_node>` **(** :ref:`String<class_String>` name **)** const |
  25. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`String<class_String>` | :ref:`get_node_name<class_AnimationNodeStateMachine_method_get_node_name>` **(** :ref:`AnimationNode<class_AnimationNode>` node **)** const |
  27. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Vector2<class_Vector2>` | :ref:`get_node_position<class_AnimationNodeStateMachine_method_get_node_position>` **(** :ref:`String<class_String>` name **)** const |
  29. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`String<class_String>` | :ref:`get_start_node<class_AnimationNodeStateMachine_method_get_start_node>` **(** **)** const |
  31. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` | :ref:`get_transition<class_AnimationNodeStateMachine_method_get_transition>` **(** :ref:`int<class_int>` idx **)** const |
  33. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`get_transition_count<class_AnimationNodeStateMachine_method_get_transition_count>` **(** **)** const |
  35. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`String<class_String>` | :ref:`get_transition_from<class_AnimationNodeStateMachine_method_get_transition_from>` **(** :ref:`int<class_int>` idx **)** const |
  37. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`String<class_String>` | :ref:`get_transition_to<class_AnimationNodeStateMachine_method_get_transition_to>` **(** :ref:`int<class_int>` idx **)** const |
  39. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`has_node<class_AnimationNodeStateMachine_method_has_node>` **(** :ref:`String<class_String>` name **)** const |
  41. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`has_transition<class_AnimationNodeStateMachine_method_has_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** const |
  43. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`remove_node<class_AnimationNodeStateMachine_method_remove_node>` **(** :ref:`String<class_String>` name **)** |
  45. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`remove_transition<class_AnimationNodeStateMachine_method_remove_transition>` **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** |
  47. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`remove_transition_by_index<class_AnimationNodeStateMachine_method_remove_transition_by_index>` **(** :ref:`int<class_int>` idx **)** |
  49. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`rename_node<class_AnimationNodeStateMachine_method_rename_node>` **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)** |
  51. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`set_end_node<class_AnimationNodeStateMachine_method_set_end_node>` **(** :ref:`String<class_String>` name **)** |
  53. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_graph_offset<class_AnimationNodeStateMachine_method_set_graph_offset>` **(** :ref:`Vector2<class_Vector2>` offset **)** |
  55. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_node_position<class_AnimationNodeStateMachine_method_set_node_position>` **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` position **)** |
  57. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_start_node<class_AnimationNodeStateMachine_method_set_start_node>` **(** :ref:`String<class_String>` name **)** |
  59. +---------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. Description
  61. -----------
  62. Contains multiple nodes representing animation states, connected in a graph. Nodes 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 programatically. Example:
  63. ::
  64. var state_machine = $AnimationTree.get("parameters/playback")
  65. state_machine.travel("some_state")
  66. Method Descriptions
  67. -------------------
  68. .. _class_AnimationNodeStateMachine_method_add_node:
  69. - void **add_node** **(** :ref:`String<class_String>` name, :ref:`AnimationNode<class_AnimationNode>` node, :ref:`Vector2<class_Vector2>` position=Vector2( 0, 0 ) **)**
  70. Adds a new node to the graph. The ``position`` is used for display in the editor.
  71. ----
  72. .. _class_AnimationNodeStateMachine_method_add_transition:
  73. - void **add_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to, :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` transition **)**
  74. Adds a transition between the given nodes.
  75. ----
  76. .. _class_AnimationNodeStateMachine_method_get_end_node:
  77. - :ref:`String<class_String>` **get_end_node** **(** **)** const
  78. Returns the graph's end node.
  79. ----
  80. .. _class_AnimationNodeStateMachine_method_get_graph_offset:
  81. - :ref:`Vector2<class_Vector2>` **get_graph_offset** **(** **)** const
  82. Returns the draw offset of the graph. Used for display in the editor.
  83. ----
  84. .. _class_AnimationNodeStateMachine_method_get_node:
  85. - :ref:`AnimationNode<class_AnimationNode>` **get_node** **(** :ref:`String<class_String>` name **)** const
  86. Returns the animation node with the given name.
  87. ----
  88. .. _class_AnimationNodeStateMachine_method_get_node_name:
  89. - :ref:`String<class_String>` **get_node_name** **(** :ref:`AnimationNode<class_AnimationNode>` node **)** const
  90. Returns the given animation node's name.
  91. ----
  92. .. _class_AnimationNodeStateMachine_method_get_node_position:
  93. - :ref:`Vector2<class_Vector2>` **get_node_position** **(** :ref:`String<class_String>` name **)** const
  94. Returns the given node's coordinates. Used for display in the editor.
  95. ----
  96. .. _class_AnimationNodeStateMachine_method_get_start_node:
  97. - :ref:`String<class_String>` **get_start_node** **(** **)** const
  98. Returns the graph's end node.
  99. ----
  100. .. _class_AnimationNodeStateMachine_method_get_transition:
  101. - :ref:`AnimationNodeStateMachineTransition<class_AnimationNodeStateMachineTransition>` **get_transition** **(** :ref:`int<class_int>` idx **)** const
  102. Returns the given transition.
  103. ----
  104. .. _class_AnimationNodeStateMachine_method_get_transition_count:
  105. - :ref:`int<class_int>` **get_transition_count** **(** **)** const
  106. Returns the number of connections in the graph.
  107. ----
  108. .. _class_AnimationNodeStateMachine_method_get_transition_from:
  109. - :ref:`String<class_String>` **get_transition_from** **(** :ref:`int<class_int>` idx **)** const
  110. Returns the given transition's start node.
  111. ----
  112. .. _class_AnimationNodeStateMachine_method_get_transition_to:
  113. - :ref:`String<class_String>` **get_transition_to** **(** :ref:`int<class_int>` idx **)** const
  114. Returns the given transition's end node.
  115. ----
  116. .. _class_AnimationNodeStateMachine_method_has_node:
  117. - :ref:`bool<class_bool>` **has_node** **(** :ref:`String<class_String>` name **)** const
  118. Returns ``true`` if the graph contains the given node.
  119. ----
  120. .. _class_AnimationNodeStateMachine_method_has_transition:
  121. - :ref:`bool<class_bool>` **has_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)** const
  122. Returns ``true`` if there is a transition between the given nodes.
  123. ----
  124. .. _class_AnimationNodeStateMachine_method_remove_node:
  125. - void **remove_node** **(** :ref:`String<class_String>` name **)**
  126. Deletes the given node from the graph.
  127. ----
  128. .. _class_AnimationNodeStateMachine_method_remove_transition:
  129. - void **remove_transition** **(** :ref:`String<class_String>` from, :ref:`String<class_String>` to **)**
  130. Deletes the given transition.
  131. ----
  132. .. _class_AnimationNodeStateMachine_method_remove_transition_by_index:
  133. - void **remove_transition_by_index** **(** :ref:`int<class_int>` idx **)**
  134. Deletes the given transition.
  135. ----
  136. .. _class_AnimationNodeStateMachine_method_rename_node:
  137. - void **rename_node** **(** :ref:`String<class_String>` name, :ref:`String<class_String>` new_name **)**
  138. Renames the given node.
  139. ----
  140. .. _class_AnimationNodeStateMachine_method_set_end_node:
  141. - void **set_end_node** **(** :ref:`String<class_String>` name **)**
  142. Sets the given node as the graph end point.
  143. ----
  144. .. _class_AnimationNodeStateMachine_method_set_graph_offset:
  145. - void **set_graph_offset** **(** :ref:`Vector2<class_Vector2>` offset **)**
  146. Sets the draw offset of the graph. Used for display in the editor.
  147. ----
  148. .. _class_AnimationNodeStateMachine_method_set_node_position:
  149. - void **set_node_position** **(** :ref:`String<class_String>` name, :ref:`Vector2<class_Vector2>` position **)**
  150. Sets the node's coordinates. Used for display in the editor.
  151. ----
  152. .. _class_AnimationNodeStateMachine_method_set_start_node:
  153. - void **set_start_node** **(** :ref:`String<class_String>` name **)**
  154. Sets the given node as the graph start point.