class_animationnodestatemachine.rst 21 KB

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