class_animationnodeoneshot.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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 Demo <https://godotengine.org/asset-library/asset/678>`__
  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:`Curve<class_Curve>` | :ref:`fadein_curve<class_AnimationNodeOneShot_property_fadein_curve>` | |
  67. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  68. | :ref:`float<class_float>` | :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` | ``0.0`` |
  69. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  70. | :ref:`Curve<class_Curve>` | :ref:`fadeout_curve<class_AnimationNodeOneShot_property_fadeout_curve>` | |
  71. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  72. | :ref:`float<class_float>` | :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` | ``0.0`` |
  73. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  74. | :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` | :ref:`mix_mode<class_AnimationNodeOneShot_property_mix_mode>` | ``0`` |
  75. +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Enumerations
  80. ------------
  81. .. _enum_AnimationNodeOneShot_OneShotRequest:
  82. .. rst-class:: classref-enumeration
  83. enum **OneShotRequest**:
  84. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_NONE** = ``0``
  87. The default state of the request. Nothing is done.
  88. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FIRE** = ``1``
  91. The request to play the animation connected to "shot" port.
  92. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT:
  93. .. rst-class:: classref-enumeration-constant
  94. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_ABORT** = ``2``
  95. The request to stop the animation connected to "shot" port.
  96. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FADE_OUT:
  97. .. rst-class:: classref-enumeration-constant
  98. :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FADE_OUT** = ``3``
  99. The request to fade out the animation connected to "shot" port.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _enum_AnimationNodeOneShot_MixMode:
  103. .. rst-class:: classref-enumeration
  104. enum **MixMode**:
  105. .. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_BLEND** = ``0``
  108. Blends two animations. See also :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`.
  109. .. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_ADD** = ``1``
  112. Blends two animations additively. See also :ref:`AnimationNodeAdd2<class_AnimationNodeAdd2>`.
  113. .. rst-class:: classref-section-separator
  114. ----
  115. .. rst-class:: classref-descriptions-group
  116. Property Descriptions
  117. ---------------------
  118. .. _class_AnimationNodeOneShot_property_autorestart:
  119. .. rst-class:: classref-property
  120. :ref:`bool<class_bool>` **autorestart** = ``false``
  121. .. rst-class:: classref-property-setget
  122. - void **set_autorestart** **(** :ref:`bool<class_bool>` value **)**
  123. - :ref:`bool<class_bool>` **has_autorestart** **(** **)**
  124. If ``true``, the sub-animation will restart automatically after finishing.
  125. 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.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_AnimationNodeOneShot_property_autorestart_delay:
  129. .. rst-class:: classref-property
  130. :ref:`float<class_float>` **autorestart_delay** = ``1.0``
  131. .. rst-class:: classref-property-setget
  132. - void **set_autorestart_delay** **(** :ref:`float<class_float>` value **)**
  133. - :ref:`float<class_float>` **get_autorestart_delay** **(** **)**
  134. The delay after which the automatic restart is triggered, in seconds.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_AnimationNodeOneShot_property_autorestart_random_delay:
  138. .. rst-class:: classref-property
  139. :ref:`float<class_float>` **autorestart_random_delay** = ``0.0``
  140. .. rst-class:: classref-property-setget
  141. - void **set_autorestart_random_delay** **(** :ref:`float<class_float>` value **)**
  142. - :ref:`float<class_float>` **get_autorestart_random_delay** **(** **)**
  143. 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>`.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_AnimationNodeOneShot_property_fadein_curve:
  147. .. rst-class:: classref-property
  148. :ref:`Curve<class_Curve>` **fadein_curve**
  149. .. rst-class:: classref-property-setget
  150. - void **set_fadein_curve** **(** :ref:`Curve<class_Curve>` value **)**
  151. - :ref:`Curve<class_Curve>` **get_fadein_curve** **(** **)**
  152. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_AnimationNodeOneShot_property_fadein_time:
  156. .. rst-class:: classref-property
  157. :ref:`float<class_float>` **fadein_time** = ``0.0``
  158. .. rst-class:: classref-property-setget
  159. - void **set_fadein_time** **(** :ref:`float<class_float>` value **)**
  160. - :ref:`float<class_float>` **get_fadein_time** **(** **)**
  161. 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.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_AnimationNodeOneShot_property_fadeout_curve:
  165. .. rst-class:: classref-property
  166. :ref:`Curve<class_Curve>` **fadeout_curve**
  167. .. rst-class:: classref-property-setget
  168. - void **set_fadeout_curve** **(** :ref:`Curve<class_Curve>` value **)**
  169. - :ref:`Curve<class_Curve>` **get_fadeout_curve** **(** **)**
  170. Determines how cross-fading between animations is eased. If empty, the transition will be linear.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_AnimationNodeOneShot_property_fadeout_time:
  174. .. rst-class:: classref-property
  175. :ref:`float<class_float>` **fadeout_time** = ``0.0``
  176. .. rst-class:: classref-property-setget
  177. - void **set_fadeout_time** **(** :ref:`float<class_float>` value **)**
  178. - :ref:`float<class_float>` **get_fadeout_time** **(** **)**
  179. 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.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_AnimationNodeOneShot_property_mix_mode:
  183. .. rst-class:: classref-property
  184. :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **mix_mode** = ``0``
  185. .. rst-class:: classref-property-setget
  186. - void **set_mix_mode** **(** :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` value **)**
  187. - :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **get_mix_mode** **(** **)**
  188. The blend type.
  189. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  190. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  191. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  192. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  193. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  194. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  195. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`