class_animationnodeoneshot.rst 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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/AnimationNodeOneShot.xml.
  6. .. _class_AnimationNodeOneShot:
  7. AnimationNodeOneShot
  8. ====================
  9. **Inherits:** :ref:`AnimationNodeSync<class_AnimationNodeSync>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Plays an animation once in an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A resource to add to an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`. This animation node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters.
  15. After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its ``request`` value to :ref:`ONE_SHOT_REQUEST_NONE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE>`.
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. # Play child animation connected to "shot" port.
  19. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
  20. # Alternative syntax (same result as above).
  21. animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE
  22. # Abort child animation connected to "shot" port.
  23. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
  24. # Alternative syntax (same result as above).
  25. animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT
  26. # Abort child animation with fading out connected to "shot" port.
  27. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)
  28. # Alternative syntax (same result as above).
  29. animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
  30. # Get current state (read-only).
  31. animation_tree.get("parameters/OneShot/active")
  32. # Alternative syntax (same result as above).
  33. animation_tree["parameters/OneShot/active"]
  34. # Get current internal state (read-only).
  35. animation_tree.get("parameters/OneShot/internal_active")
  36. # Alternative syntax (same result as above).
  37. animation_tree["parameters/OneShot/internal_active"]
  38. .. code-tab:: csharp
  39. // Play child animation connected to "shot" port.
  40. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
  41. // Abort child animation connected to "shot" port.
  42. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
  43. // Abort child animation with fading out connected to "shot" port.
  44. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
  45. // Get current state (read-only).
  46. animationTree.Get("parameters/OneShot/active");
  47. // Get current internal state (read-only).
  48. animationTree.Get("parameters/OneShot/internal_active");
  49. .. rst-class:: classref-introduction-group
  50. Tutorials
  51. ---------
  52. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  53. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  54. .. rst-class:: classref-reftable-group
  55. Properties
  56. ----------
  57. .. table::
  58. :widths: auto
  59. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  60. | :ref:`bool<class_bool>` | :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` | ``false`` |
  61. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  62. | :ref:`float<class_float>` | :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>` | ``1.0`` |
  63. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  64. | :ref:`float<class_float>` | :ref:`autorestart_random_delay<class_AnimationNodeOneShot_property_autorestart_random_delay>` | ``0.0`` |
  65. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  66. | :ref:`bool<class_bool>` | :ref:`break_loop_at_end<class_AnimationNodeOneShot_property_break_loop_at_end>` | ``false`` |
  67. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  68. | :ref:`Curve<class_Curve>` | :ref:`fadein_curve<class_AnimationNodeOneShot_property_fadein_curve>` | |
  69. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  70. | :ref:`float<class_float>` | :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` | ``0.0`` |
  71. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  72. | :ref:`Curve<class_Curve>` | :ref:`fadeout_curve<class_AnimationNodeOneShot_property_fadeout_curve>` | |
  73. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  74. | :ref:`float<class_float>` | :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` | ``0.0`` |
  75. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  76. | :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` | :ref:`mix_mode<class_AnimationNodeOneShot_property_mix_mode>` | ``0`` |
  77. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  78. .. rst-class:: classref-section-separator
  79. ----
  80. .. rst-class:: classref-descriptions-group
  81. Enumerations
  82. ------------
  83. .. _enum_AnimationNodeOneShot_OneShotRequest:
  84. .. rst-class:: classref-enumeration
  85. enum **OneShotRequest**: :ref:`🔗<enum_AnimationNodeOneShot_OneShotRequest>`
  86. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_NONE** = ``0``
  89. The default state of the request. Nothing is done.
  90. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FIRE** = ``1``
  93. The request to play the animation connected to "shot" port.
  94. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT:
  95. .. rst-class:: classref-enumeration-constant
  96. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_ABORT** = ``2``
  97. The request to stop the animation connected to "shot" port.
  98. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FADE_OUT:
  99. .. rst-class:: classref-enumeration-constant
  100. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FADE_OUT** = ``3``
  101. The request to fade out the animation connected to "shot" port.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _enum_AnimationNodeOneShot_MixMode:
  105. .. rst-class:: classref-enumeration
  106. enum **MixMode**: :ref:`🔗<enum_AnimationNodeOneShot_MixMode>`
  107. .. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND:
  108. .. rst-class:: classref-enumeration-constant
  109. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_BLEND** = ``0``
  110. Blends two animations. See also :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`.
  111. .. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD:
  112. .. rst-class:: classref-enumeration-constant
  113. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_ADD** = ``1``
  114. Blends two animations additively. See also :ref:`AnimationNodeAdd2<class_AnimationNodeAdd2>`.
  115. .. rst-class:: classref-section-separator
  116. ----
  117. .. rst-class:: classref-descriptions-group
  118. Property Descriptions
  119. ---------------------
  120. .. _class_AnimationNodeOneShot_property_autorestart:
  121. .. rst-class:: classref-property
  122. :ref:`bool<class_bool>` **autorestart** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart>`
  123. .. rst-class:: classref-property-setget
  124. - |void| **set_autorestart**\ (\ value\: :ref:`bool<class_bool>`\ )
  125. - :ref:`bool<class_bool>` **has_autorestart**\ (\ )
  126. If ``true``, the sub-animation will restart automatically after finishing.
  127. In other words, to start auto restarting, the animation must be played once with the :ref:`ONE_SHOT_REQUEST_FIRE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE>` request. The :ref:`ONE_SHOT_REQUEST_ABORT<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT>` request stops the auto restarting, but it does not disable the :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` itself. So, the :ref:`ONE_SHOT_REQUEST_FIRE<class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE>` request will start auto restarting again.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_AnimationNodeOneShot_property_autorestart_delay:
  131. .. rst-class:: classref-property
  132. :ref:`float<class_float>` **autorestart_delay** = ``1.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_delay>`
  133. .. rst-class:: classref-property-setget
  134. - |void| **set_autorestart_delay**\ (\ value\: :ref:`float<class_float>`\ )
  135. - :ref:`float<class_float>` **get_autorestart_delay**\ (\ )
  136. The delay after which the automatic restart is triggered, in seconds.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_AnimationNodeOneShot_property_autorestart_random_delay:
  140. .. rst-class:: classref-property
  141. :ref:`float<class_float>` **autorestart_random_delay** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_random_delay>`
  142. .. rst-class:: classref-property-setget
  143. - |void| **set_autorestart_random_delay**\ (\ value\: :ref:`float<class_float>`\ )
  144. - :ref:`float<class_float>` **get_autorestart_random_delay**\ (\ )
  145. If :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` is ``true``, a random additional delay (in seconds) between 0 and this value will be added to :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>`.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_AnimationNodeOneShot_property_break_loop_at_end:
  149. .. rst-class:: classref-property
  150. :ref:`bool<class_bool>` **break_loop_at_end** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_break_loop_at_end>`
  151. .. rst-class:: classref-property-setget
  152. - |void| **set_break_loop_at_end**\ (\ value\: :ref:`bool<class_bool>`\ )
  153. - :ref:`bool<class_bool>` **is_loop_broken_at_end**\ (\ )
  154. If ``true``, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_AnimationNodeOneShot_property_fadein_curve:
  158. .. rst-class:: classref-property
  159. :ref:`Curve<class_Curve>` **fadein_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadein_curve>`
  160. .. rst-class:: classref-property-setget
  161. - |void| **set_fadein_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
  162. - :ref:`Curve<class_Curve>` **get_fadein_curve**\ (\ )
  163. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_AnimationNodeOneShot_property_fadein_time:
  167. .. rst-class:: classref-property
  168. :ref:`float<class_float>` **fadein_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadein_time>`
  169. .. rst-class:: classref-property-setget
  170. - |void| **set_fadein_time**\ (\ value\: :ref:`float<class_float>`\ )
  171. - :ref:`float<class_float>` **get_fadein_time**\ (\ )
  172. The fade-in duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a cross-fade that starts at 0 second and ends at 1 second during the animation.
  173. \ **Note:** **AnimationNodeOneShot** transitions the current state after the end of the fading. When :ref:`AnimationNodeOutput<class_AnimationNodeOutput>` is considered as the most upstream, so the :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` is scaled depending on the downstream delta. For example, if this value is set to ``1.0`` and a :ref:`AnimationNodeTimeScale<class_AnimationNodeTimeScale>` with a value of ``2.0`` is chained downstream, the actual processing time will be 0.5 second.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_AnimationNodeOneShot_property_fadeout_curve:
  177. .. rst-class:: classref-property
  178. :ref:`Curve<class_Curve>` **fadeout_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_curve>`
  179. .. rst-class:: classref-property-setget
  180. - |void| **set_fadeout_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
  181. - :ref:`Curve<class_Curve>` **get_fadeout_curve**\ (\ )
  182. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_AnimationNodeOneShot_property_fadeout_time:
  186. .. rst-class:: classref-property
  187. :ref:`float<class_float>` **fadeout_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_time>`
  188. .. rst-class:: classref-property-setget
  189. - |void| **set_fadeout_time**\ (\ value\: :ref:`float<class_float>`\ )
  190. - :ref:`float<class_float>` **get_fadeout_time**\ (\ )
  191. The fade-out duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation.
  192. \ **Note:** **AnimationNodeOneShot** transitions the current state after the end of the fading. When :ref:`AnimationNodeOutput<class_AnimationNodeOutput>` is considered as the most upstream, so the :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` is scaled depending on the downstream delta. For example, if this value is set to ``1.0`` and an :ref:`AnimationNodeTimeScale<class_AnimationNodeTimeScale>` with a value of ``2.0`` is chained downstream, the actual processing time will be 0.5 second.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_AnimationNodeOneShot_property_mix_mode:
  196. .. rst-class:: classref-property
  197. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **mix_mode** = ``0`` :ref:`🔗<class_AnimationNodeOneShot_property_mix_mode>`
  198. .. rst-class:: classref-property-setget
  199. - |void| **set_mix_mode**\ (\ value\: :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>`\ )
  200. - :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **get_mix_mode**\ (\ )
  201. The blend type.
  202. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  203. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  204. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  205. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  206. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  207. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  208. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  209. .. |void| replace:: :abbr:`void (No return value.)`