class_animationnodestatemachineplayback.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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:`StringName<class_StringName>` | :ref:`get_fading_from_node<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`\ (\ ) |const| |
  47. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_travel_path<class_AnimationNodeStateMachinePlayback_method_get_travel_path>`\ (\ ) |const| |
  49. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationNodeStateMachinePlayback_method_is_playing>`\ (\ ) |const| |
  51. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | |void| | :ref:`next<class_AnimationNodeStateMachinePlayback_method_next>`\ (\ ) |
  53. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | |void| | :ref:`start<class_AnimationNodeStateMachinePlayback_method_start>`\ (\ node\: :ref:`StringName<class_StringName>`, reset\: :ref:`bool<class_bool>` = true\ ) |
  55. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | |void| | :ref:`stop<class_AnimationNodeStateMachinePlayback_method_stop>`\ (\ ) |
  57. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | |void| | :ref:`travel<class_AnimationNodeStateMachinePlayback_method_travel>`\ (\ to_node\: :ref:`StringName<class_StringName>`, reset_on_teleport\: :ref:`bool<class_bool>` = true\ ) |
  59. +------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. .. rst-class:: classref-section-separator
  61. ----
  62. .. rst-class:: classref-descriptions-group
  63. Method Descriptions
  64. -------------------
  65. .. _class_AnimationNodeStateMachinePlayback_method_get_current_length:
  66. .. rst-class:: classref-method
  67. :ref:`float<class_float>` **get_current_length**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_length>`
  68. Returns the current state length.
  69. \ **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.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_AnimationNodeStateMachinePlayback_method_get_current_node:
  73. .. rst-class:: classref-method
  74. :ref:`StringName<class_StringName>` **get_current_node**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_node>`
  75. Returns the currently playing animation state.
  76. \ **Note:** When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins.
  77. .. rst-class:: classref-item-separator
  78. ----
  79. .. _class_AnimationNodeStateMachinePlayback_method_get_current_play_position:
  80. .. rst-class:: classref-method
  81. :ref:`float<class_float>` **get_current_play_position**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_current_play_position>`
  82. Returns the playback position within the current animation state.
  83. .. rst-class:: classref-item-separator
  84. ----
  85. .. _class_AnimationNodeStateMachinePlayback_method_get_fading_from_node:
  86. .. rst-class:: classref-method
  87. :ref:`StringName<class_StringName>` **get_fading_from_node**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_fading_from_node>`
  88. Returns the starting state of currently fading animation.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_AnimationNodeStateMachinePlayback_method_get_travel_path:
  92. .. rst-class:: classref-method
  93. :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_travel_path**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_get_travel_path>`
  94. Returns the current travel path as computed internally by the A\* algorithm.
  95. .. rst-class:: classref-item-separator
  96. ----
  97. .. _class_AnimationNodeStateMachinePlayback_method_is_playing:
  98. .. rst-class:: classref-method
  99. :ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_is_playing>`
  100. Returns ``true`` if an animation is playing.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_AnimationNodeStateMachinePlayback_method_next:
  104. .. rst-class:: classref-method
  105. |void| **next**\ (\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_next>`
  106. If there is a next path by travel or auto advance, immediately transitions from the current state to the next state.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_AnimationNodeStateMachinePlayback_method_start:
  110. .. rst-class:: classref-method
  111. |void| **start**\ (\ node\: :ref:`StringName<class_StringName>`, reset\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_start>`
  112. Starts playing the given animation.
  113. If ``reset`` is ``true``, the animation is played from the beginning.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_AnimationNodeStateMachinePlayback_method_stop:
  117. .. rst-class:: classref-method
  118. |void| **stop**\ (\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_stop>`
  119. Stops the currently playing animation.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_AnimationNodeStateMachinePlayback_method_travel:
  123. .. rst-class:: classref-method
  124. |void| **travel**\ (\ to_node\: :ref:`StringName<class_StringName>`, reset_on_teleport\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_AnimationNodeStateMachinePlayback_method_travel>`
  125. Transitions from the current state to another one, following the shortest path.
  126. If the path does not connect from the current state, the animation will play after the state teleports.
  127. If ``reset_on_teleport`` is ``true``, the animation is played from the beginning when the travel cause a teleportation.
  128. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  129. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  130. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  131. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  132. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  133. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  134. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  135. .. |void| replace:: :abbr:`void (No return value.)`