class_animationnodestatemachineplayback.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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. \ **Example:**\
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. var state_machine = $AnimationTree.get("parameters/playback")
  19. state_machine.travel("some_state")
  20. .. code-tab:: csharp
  21. var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback").As<AnimationNodeStateMachinePlayback>();
  22. stateMachine.Travel("some_state");
  23. .. rst-class:: classref-introduction-group
  24. Tutorials
  25. ---------
  26. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +-------------------------+-------------------------+---------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | resource_local_to_scene | ``true`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  34. +-------------------------+-------------------------+---------------------------------------------------------------------------------------+
  35. .. rst-class:: classref-reftable-group
  36. Methods
  37. -------
  38. .. table::
  39. :widths: auto
  40. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`float<class_float>` | :ref:`get_current_length<class_AnimationNodeStateMachinePlayback_method_get_current_length>` **(** **)** |const| |
  42. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`StringName<class_StringName>` | :ref:`get_current_node<class_AnimationNodeStateMachinePlayback_method_get_current_node>` **(** **)** |const| |
  44. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`float<class_float>` | :ref:`get_current_play_position<class_AnimationNodeStateMachinePlayback_method_get_current_play_position>` **(** **)** |const| |
  46. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`StringName<class_StringName>` | :ref:`get_fading_from_node<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>` **(** **)** |const| |
  48. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`StringName[]<class_StringName>` | :ref:`get_travel_path<class_AnimationNodeStateMachinePlayback_method_get_travel_path>` **(** **)** |const| |
  50. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationNodeStateMachinePlayback_method_is_playing>` **(** **)** |const| |
  52. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`next<class_AnimationNodeStateMachinePlayback_method_next>` **(** **)** |
  54. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`start<class_AnimationNodeStateMachinePlayback_method_start>` **(** :ref:`StringName<class_StringName>` node, :ref:`bool<class_bool>` reset=true **)** |
  56. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`stop<class_AnimationNodeStateMachinePlayback_method_stop>` **(** **)** |
  58. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`travel<class_AnimationNodeStateMachinePlayback_method_travel>` **(** :ref:`StringName<class_StringName>` to_node, :ref:`bool<class_bool>` reset_on_teleport=true **)** |
  60. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. .. rst-class:: classref-section-separator
  62. ----
  63. .. rst-class:: classref-descriptions-group
  64. Method Descriptions
  65. -------------------
  66. .. _class_AnimationNodeStateMachinePlayback_method_get_current_length:
  67. .. rst-class:: classref-method
  68. :ref:`float<class_float>` **get_current_length** **(** **)** |const|
  69. Returns the current state length.
  70. \ **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.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _class_AnimationNodeStateMachinePlayback_method_get_current_node:
  74. .. rst-class:: classref-method
  75. :ref:`StringName<class_StringName>` **get_current_node** **(** **)** |const|
  76. Returns the currently playing animation state.
  77. \ **Note:** When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
  78. .. rst-class:: classref-item-separator
  79. ----
  80. .. _class_AnimationNodeStateMachinePlayback_method_get_current_play_position:
  81. .. rst-class:: classref-method
  82. :ref:`float<class_float>` **get_current_play_position** **(** **)** |const|
  83. Returns the playback position within the current animation state.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_node:
  87. .. rst-class:: classref-method
  88. :ref:`StringName<class_StringName>` **get_fading_from_node** **(** **)** |const|
  89. Returns the starting state of currently fading animation.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_AnimationNodeStateMachinePlayback_method_get_travel_path:
  93. .. rst-class:: classref-method
  94. :ref:`StringName[]<class_StringName>` **get_travel_path** **(** **)** |const|
  95. Returns the current travel path as computed internally by the A\* algorithm.
  96. .. rst-class:: classref-item-separator
  97. ----
  98. .. _class_AnimationNodeStateMachinePlayback_method_is_playing:
  99. .. rst-class:: classref-method
  100. :ref:`bool<class_bool>` **is_playing** **(** **)** |const|
  101. Returns ``true`` if an animation is playing.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_AnimationNodeStateMachinePlayback_method_next:
  105. .. rst-class:: classref-method
  106. void **next** **(** **)**
  107. If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_AnimationNodeStateMachinePlayback_method_start:
  111. .. rst-class:: classref-method
  112. void **start** **(** :ref:`StringName<class_StringName>` node, :ref:`bool<class_bool>` reset=true **)**
  113. Starts playing the given animation.
  114. If ``reset`` is ``true``, the animation is played from the beginning.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_AnimationNodeStateMachinePlayback_method_stop:
  118. .. rst-class:: classref-method
  119. void **stop** **(** **)**
  120. Stops the currently playing animation.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_AnimationNodeStateMachinePlayback_method_travel:
  124. .. rst-class:: classref-method
  125. void **travel** **(** :ref:`StringName<class_StringName>` to_node, :ref:`bool<class_bool>` reset_on_teleport=true **)**
  126. Transitions from the current state to another one, following the shortest path.
  127. If the path does not connect from the current state, the animation will play after the state teleports.
  128. If ``reset_on_teleport`` is ``true``, the animation is played from the beginning when the travel cause a teleportation.
  129. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  130. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  131. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  132. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  133. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  134. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  135. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`