class_animationnodeoneshot.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/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 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. # Get current state (read-only).
  27. animation_tree.get("parameters/OneShot/active"))
  28. # Alternative syntax (same result as above).
  29. animation_tree["parameters/OneShot/active"]
  30. .. code-tab:: csharp
  31. // Play child animation connected to "shot" port.
  32. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
  33. // Abort child animation connected to "shot" port.
  34. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
  35. // Get current state (read-only).
  36. animationTree.Get("parameters/OneShot/active");
  37. .. rst-class:: classref-introduction-group
  38. Tutorials
  39. ---------
  40. - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
  41. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  42. .. rst-class:: classref-reftable-group
  43. Properties
  44. ----------
  45. .. table::
  46. :widths: auto
  47. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  48. | :ref:`bool<class_bool>` | :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` | ``false`` |
  49. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  50. | :ref:`float<class_float>` | :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>` | ``1.0`` |
  51. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  52. | :ref:`float<class_float>` | :ref:`autorestart_random_delay<class_AnimationNodeOneShot_property_autorestart_random_delay>` | ``0.0`` |
  53. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  54. | :ref:`float<class_float>` | :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` | ``0.0`` |
  55. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  56. | :ref:`float<class_float>` | :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` | ``0.0`` |
  57. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  58. | :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` | :ref:`mix_mode<class_AnimationNodeOneShot_property_mix_mode>` | ``0`` |
  59. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  60. .. rst-class:: classref-section-separator
  61. ----
  62. .. rst-class:: classref-descriptions-group
  63. Enumerations
  64. ------------
  65. .. _enum_AnimationNodeOneShot_OneShotRequest:
  66. .. rst-class:: classref-enumeration
  67. enum **OneShotRequest**:
  68. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE:
  69. .. rst-class:: classref-enumeration-constant
  70. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_NONE** = ``0``
  71. The default state of the request. Nothing is done.
  72. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FIRE** = ``1``
  75. The request to play the animation connected to "shot" port.
  76. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT:
  77. .. rst-class:: classref-enumeration-constant
  78. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_ABORT** = ``2``
  79. The request to stop the animation connected to "shot" port.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _enum_AnimationNodeOneShot_MixMode:
  83. .. rst-class:: classref-enumeration
  84. enum **MixMode**:
  85. .. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND:
  86. .. rst-class:: classref-enumeration-constant
  87. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_BLEND** = ``0``
  88. Blends two animations. See also :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`.
  89. .. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD:
  90. .. rst-class:: classref-enumeration-constant
  91. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_ADD** = ``1``
  92. Blends two animations additively. See also :ref:`AnimationNodeAdd2<class_AnimationNodeAdd2>`.
  93. .. rst-class:: classref-section-separator
  94. ----
  95. .. rst-class:: classref-descriptions-group
  96. Property Descriptions
  97. ---------------------
  98. .. _class_AnimationNodeOneShot_property_autorestart:
  99. .. rst-class:: classref-property
  100. :ref:`bool<class_bool>` **autorestart** = ``false``
  101. .. rst-class:: classref-property-setget
  102. - void **set_autorestart** **(** :ref:`bool<class_bool>` value **)**
  103. - :ref:`bool<class_bool>` **has_autorestart** **(** **)**
  104. If ``true``, the sub-animation will restart automatically after finishing.
  105. 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.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_AnimationNodeOneShot_property_autorestart_delay:
  109. .. rst-class:: classref-property
  110. :ref:`float<class_float>` **autorestart_delay** = ``1.0``
  111. .. rst-class:: classref-property-setget
  112. - void **set_autorestart_delay** **(** :ref:`float<class_float>` value **)**
  113. - :ref:`float<class_float>` **get_autorestart_delay** **(** **)**
  114. The delay after which the automatic restart is triggered, in seconds.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_AnimationNodeOneShot_property_autorestart_random_delay:
  118. .. rst-class:: classref-property
  119. :ref:`float<class_float>` **autorestart_random_delay** = ``0.0``
  120. .. rst-class:: classref-property-setget
  121. - void **set_autorestart_random_delay** **(** :ref:`float<class_float>` value **)**
  122. - :ref:`float<class_float>` **get_autorestart_random_delay** **(** **)**
  123. 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>`.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_AnimationNodeOneShot_property_fadein_time:
  127. .. rst-class:: classref-property
  128. :ref:`float<class_float>` **fadein_time** = ``0.0``
  129. .. rst-class:: classref-property-setget
  130. - void **set_fadein_time** **(** :ref:`float<class_float>` value **)**
  131. - :ref:`float<class_float>` **get_fadein_time** **(** **)**
  132. The fade-in duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a crossfade that starts at 0 second and ends at 1 second during the animation.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_AnimationNodeOneShot_property_fadeout_time:
  136. .. rst-class:: classref-property
  137. :ref:`float<class_float>` **fadeout_time** = ``0.0``
  138. .. rst-class:: classref-property-setget
  139. - void **set_fadeout_time** **(** :ref:`float<class_float>` value **)**
  140. - :ref:`float<class_float>` **get_fadeout_time** **(** **)**
  141. The fade-out duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a crossfade that starts at 4 second and ends at 5 second during the animation.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_AnimationNodeOneShot_property_mix_mode:
  145. .. rst-class:: classref-property
  146. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **mix_mode** = ``0``
  147. .. rst-class:: classref-property-setget
  148. - void **set_mix_mode** **(** :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` value **)**
  149. - :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **get_mix_mode** **(** **)**
  150. The blend type.
  151. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  152. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  153. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  154. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  155. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  156. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`