class_animationnodestatemachineplayback.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachinePlayback.xml.
  6. .. _class_AnimationNodeStateMachinePlayback:
  7. AnimationNodeStateMachinePlayback
  8. =================================
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Provides playback control for an :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Allows control of :ref:`AnimationTree<class_AnimationTree>` state machines created with :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>`. Retrieve with ``$AnimationTree.get("parameters/playback")``.
  15. .. tabs::
  16. .. code-tab:: gdscript
  17. var state_machine = $AnimationTree.get("parameters/playback")
  18. state_machine.travel("some_state")
  19. .. code-tab:: csharp
  20. var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>();
  21. stateMachine.Travel("some_state");
  22. .. rst-class:: classref-introduction-group
  23. Tutorials
  24. ---------
  25. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  26. .. rst-class:: classref-reftable-group
  27. Properties
  28. ----------
  29. .. table::
  30. :widths: auto
  31. +-------------------------+-------------------------+---------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | resource_local_to_scene | ``true`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  33. +-------------------------+-------------------------+---------------------------------------------------------------------------------------+
  34. .. rst-class:: classref-reftable-group
  35. Methods
  36. -------
  37. .. table::
  38. :widths: auto
  39. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`float<class_float>` | :ref:`get_current_length<class_AnimationNodeStateMachinePlayback_method_get_current_length>`\ (\ ) |const| |
  41. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`StringName<class_StringName>` | :ref:`get_current_node<class_AnimationNodeStateMachinePlayback_method_get_current_node>`\ (\ ) |const| |
  43. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`float<class_float>` | :ref:`get_current_play_position<class_AnimationNodeStateMachinePlayback_method_get_current_play_position>`\ (\ ) |const| |
  45. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`float<class_float>` | :ref:`get_fading_from_length<class_AnimationNodeStateMachinePlayback_method_get_fading_from_length>`\ (\ ) |const| |
  47. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`StringName<class_StringName>` | :ref:`get_fading_from_node<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`\ (\ ) |const| |
  49. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`float<class_float>` | :ref:`get_fading_from_play_position<class_AnimationNodeStateMachinePlayback_method_get_fading_from_play_position>`\ (\ ) |const| |
  51. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`float<class_float>` | :ref:`get_fading_length<class_AnimationNodeStateMachinePlayback_method_get_fading_length>`\ (\ ) |const| |
  53. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`float<class_float>` | :ref:`get_fading_position<class_AnimationNodeStateMachinePlayback_method_get_fading_position>`\ (\ ) |const| |
  55. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_travel_path<class_AnimationNodeStateMachinePlayback_method_get_travel_path>`\ (\ ) |const| |
  57. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationNodeStateMachinePlayback_method_is_playing>`\ (\ ) |const| |
  59. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | |void| | :ref:`next<class_AnimationNodeStateMachinePlayback_method_next>`\ (\ ) |
  61. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | |void| | :ref:`start<class_AnimationNodeStateMachinePlayback_method_start>`\ (\ node\: :ref:`StringName<class_StringName>`, reset\: :ref:`bool<class_bool>` = true\ ) |
  63. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | |void| | :ref:`stop<class_AnimationNodeStateMachinePlayback_method_stop>`\ (\ ) |
  65. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | |void| | :ref:`travel<class_AnimationNodeStateMachinePlayback_method_travel>`\ (\ to_node\: :ref:`StringName<class_StringName>`, reset_on_teleport\: :ref:`bool<class_bool>` = true\ ) |
  67. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. .. rst-class:: classref-section-separator
  69. ----
  70. .. rst-class:: classref-descriptions-group
  71. Signals
  72. -------
  73. .. _class_AnimationNodeStateMachinePlayback_signal_state_finished:
  74. .. rst-class:: classref-signal
  75. **state_finished**\ (\ state\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_signal_state_finished>`
  76. Emitted when the ``state`` finishes playback. If ``state`` is a state machine set to grouped mode, its signals are passed through with its name prefixed.
  77. If there is a crossfade, this will be fired when the influence of the :ref:`get_fading_from_node()<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>` animation is no longer present.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_AnimationNodeStateMachinePlayback_signal_state_started:
  81. .. rst-class:: classref-signal
  82. **state_started**\ (\ state\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_signal_state_started>`
  83. Emitted when the ``state`` starts playback. If ``state`` is a state machine set to grouped mode, its signals are passed through with its name prefixed.
  84. .. rst-class:: classref-section-separator
  85. ----
  86. .. rst-class:: classref-descriptions-group
  87. Method Descriptions
  88. -------------------
  89. .. _class_AnimationNodeStateMachinePlayback_method_get_current_length:
  90. .. rst-class:: classref-method
  91. :ref:`float<class_float>` **get_current_length**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_length>`
  92. Returns the current state length.
  93. \ **Note:** It is possible that any :ref:`AnimationRootNode<class_AnimationRootNode>` can be nodes as well as animations. This means that there can be multiple animations within a single state. Which animation length has priority depends on the nodes connected inside it. Also, if a transition does not reset, the remaining length at that point will be returned.
  94. .. rst-class:: classref-item-separator
  95. ----
  96. .. _class_AnimationNodeStateMachinePlayback_method_get_current_node:
  97. .. rst-class:: classref-method
  98. :ref:`StringName<class_StringName>` **get_current_node**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_node>`
  99. Returns the currently playing animation state.
  100. \ **Note:** When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_AnimationNodeStateMachinePlayback_method_get_current_play_position:
  104. .. rst-class:: classref-method
  105. :ref:`float<class_float>` **get_current_play_position**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_play_position>`
  106. Returns the playback position within the current animation state.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_length:
  110. .. rst-class:: classref-method
  111. :ref:`float<class_float>` **get_fading_from_length**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_from_length>`
  112. Returns the playback state length of the node from :ref:`get_fading_from_node()<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`. Returns ``0`` if no animation fade is occurring.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_node:
  116. .. rst-class:: classref-method
  117. :ref:`StringName<class_StringName>` **get_fading_from_node**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`
  118. Returns the starting state of currently fading animation.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_play_position:
  122. .. rst-class:: classref-method
  123. :ref:`float<class_float>` **get_fading_from_play_position**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_from_play_position>`
  124. Returns the playback position of the node from :ref:`get_fading_from_node()<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`. Returns ``0`` if no animation fade is occurring.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_length:
  128. .. rst-class:: classref-method
  129. :ref:`float<class_float>` **get_fading_length**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_length>`
  130. Returns the length of the current fade animation. Returns ``0`` if no animation fade is occurring.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_position:
  134. .. rst-class:: classref-method
  135. :ref:`float<class_float>` **get_fading_position**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_position>`
  136. Returns the playback position of the current fade animation. Returns ``0`` if no animation fade is occurring.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_AnimationNodeStateMachinePlayback_method_get_travel_path:
  140. .. rst-class:: classref-method
  141. :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_travel_path**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_travel_path>`
  142. Returns the current travel path as computed internally by the A\* algorithm.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_AnimationNodeStateMachinePlayback_method_is_playing:
  146. .. rst-class:: classref-method
  147. :ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_is_playing>`
  148. Returns ``true`` if an animation is playing.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_AnimationNodeStateMachinePlayback_method_next:
  152. .. rst-class:: classref-method
  153. |void| **next**\ (\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_next>`
  154. If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_AnimationNodeStateMachinePlayback_method_start:
  158. .. rst-class:: classref-method
  159. |void| **start**\ (\ node\: :ref:`StringName<class_StringName>`, reset\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_start>`
  160. Starts playing the given animation.
  161. If ``reset`` is ``true``, the animation is played from the beginning.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_AnimationNodeStateMachinePlayback_method_stop:
  165. .. rst-class:: classref-method
  166. |void| **stop**\ (\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_stop>`
  167. Stops the currently playing animation.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_AnimationNodeStateMachinePlayback_method_travel:
  171. .. rst-class:: classref-method
  172. |void| **travel**\ (\ to_node\: :ref:`StringName<class_StringName>`, reset_on_teleport\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_travel>`
  173. Transitions from the current state to another one, following the shortest path.
  174. If the path does not connect from the current state, the animation will play after the state teleports.
  175. If ``reset_on_teleport`` is ``true``, the animation is played from the beginning when the travel cause a teleportation.
  176. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  177. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  178. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  179. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  180. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  181. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  182. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  183. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  184. .. |void| replace:: :abbr:`void (No return value.)`