123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeOneShot.xml.
- .. _class_AnimationNodeOneShot:
- AnimationNodeOneShot
- ====================
- **Inherits:** :ref:`AnimationNodeSync<class_AnimationNodeSync>` **<** :ref:`AnimationNode<class_AnimationNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
- Plays an animation once in an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- 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.
- 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>`.
- .. tabs::
- .. code-tab:: gdscript
- # Play child animation connected to "shot" port.
- animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
- # Alternative syntax (same result as above).
- animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE
-
- # Abort child animation connected to "shot" port.
- animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
- # Alternative syntax (same result as above).
- animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT
-
- # Abort child animation with fading out connected to "shot" port.
- animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)
- # Alternative syntax (same result as above).
- animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
-
- # Get current state (read-only).
- animation_tree.get("parameters/OneShot/active")
- # Alternative syntax (same result as above).
- animation_tree["parameters/OneShot/active"]
-
- # Get current internal state (read-only).
- animation_tree.get("parameters/OneShot/internal_active")
- # Alternative syntax (same result as above).
- animation_tree["parameters/OneShot/internal_active"]
- .. code-tab:: csharp
- // Play child animation connected to "shot" port.
- animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
-
- // Abort child animation connected to "shot" port.
- animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
-
- // Abort child animation with fading out connected to "shot" port.
- animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
-
- // Get current state (read-only).
- animationTree.Get("parameters/OneShot/active");
-
- // Get current internal state (read-only).
- animationTree.Get("parameters/OneShot/internal_active");
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>`
- - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`autorestart<class_AnimationNodeOneShot_property_autorestart>` | ``false`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`autorestart_delay<class_AnimationNodeOneShot_property_autorestart_delay>` | ``1.0`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`autorestart_random_delay<class_AnimationNodeOneShot_property_autorestart_random_delay>` | ``0.0`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`bool<class_bool>` | :ref:`break_loop_at_end<class_AnimationNodeOneShot_property_break_loop_at_end>` | ``false`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`Curve<class_Curve>` | :ref:`fadein_curve<class_AnimationNodeOneShot_property_fadein_curve>` | |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`fadein_time<class_AnimationNodeOneShot_property_fadein_time>` | ``0.0`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`Curve<class_Curve>` | :ref:`fadeout_curve<class_AnimationNodeOneShot_property_fadeout_curve>` | |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`float<class_float>` | :ref:`fadeout_time<class_AnimationNodeOneShot_property_fadeout_time>` | ``0.0`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- | :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` | :ref:`mix_mode<class_AnimationNodeOneShot_property_mix_mode>` | ``0`` |
- +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Enumerations
- ------------
- .. _enum_AnimationNodeOneShot_OneShotRequest:
- .. rst-class:: classref-enumeration
- enum **OneShotRequest**: :ref:`🔗<enum_AnimationNodeOneShot_OneShotRequest>`
- .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE:
- .. rst-class:: classref-enumeration-constant
- :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_NONE** = ``0``
- The default state of the request. Nothing is done.
- .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE:
- .. rst-class:: classref-enumeration-constant
- :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FIRE** = ``1``
- The request to play the animation connected to "shot" port.
- .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT:
- .. rst-class:: classref-enumeration-constant
- :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_ABORT** = ``2``
- The request to stop the animation connected to "shot" port.
- .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FADE_OUT:
- .. rst-class:: classref-enumeration-constant
- :ref:`OneShotRequest<enum_AnimationNodeOneShot_OneShotRequest>` **ONE_SHOT_REQUEST_FADE_OUT** = ``3``
- The request to fade out the animation connected to "shot" port.
- .. rst-class:: classref-item-separator
- ----
- .. _enum_AnimationNodeOneShot_MixMode:
- .. rst-class:: classref-enumeration
- enum **MixMode**: :ref:`🔗<enum_AnimationNodeOneShot_MixMode>`
- .. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND:
- .. rst-class:: classref-enumeration-constant
- :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_BLEND** = ``0``
- Blends two animations. See also :ref:`AnimationNodeBlend2<class_AnimationNodeBlend2>`.
- .. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD:
- .. rst-class:: classref-enumeration-constant
- :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **MIX_MODE_ADD** = ``1``
- Blends two animations additively. See also :ref:`AnimationNodeAdd2<class_AnimationNodeAdd2>`.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_AnimationNodeOneShot_property_autorestart:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **autorestart** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart>`
- .. rst-class:: classref-property-setget
- - |void| **set_autorestart**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **has_autorestart**\ (\ )
- If ``true``, the sub-animation will restart automatically after finishing.
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_autorestart_delay:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **autorestart_delay** = ``1.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_delay>`
- .. rst-class:: classref-property-setget
- - |void| **set_autorestart_delay**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_autorestart_delay**\ (\ )
- The delay after which the automatic restart is triggered, in seconds.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_autorestart_random_delay:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **autorestart_random_delay** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_autorestart_random_delay>`
- .. rst-class:: classref-property-setget
- - |void| **set_autorestart_random_delay**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_autorestart_random_delay**\ (\ )
- 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>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_break_loop_at_end:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **break_loop_at_end** = ``false`` :ref:`🔗<class_AnimationNodeOneShot_property_break_loop_at_end>`
- .. rst-class:: classref-property-setget
- - |void| **set_break_loop_at_end**\ (\ value\: :ref:`bool<class_bool>`\ )
- - :ref:`bool<class_bool>` **is_loop_broken_at_end**\ (\ )
- If ``true``, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_fadein_curve:
- .. rst-class:: classref-property
- :ref:`Curve<class_Curve>` **fadein_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadein_curve>`
- .. rst-class:: classref-property-setget
- - |void| **set_fadein_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- - :ref:`Curve<class_Curve>` **get_fadein_curve**\ (\ )
- Determines how cross-fading between animations is eased. If empty, the transition will be linear.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_fadein_time:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **fadein_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadein_time>`
- .. rst-class:: classref-property-setget
- - |void| **set_fadein_time**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_fadein_time**\ (\ )
- 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.
- \ **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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_fadeout_curve:
- .. rst-class:: classref-property
- :ref:`Curve<class_Curve>` **fadeout_curve** :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_curve>`
- .. rst-class:: classref-property-setget
- - |void| **set_fadeout_curve**\ (\ value\: :ref:`Curve<class_Curve>`\ )
- - :ref:`Curve<class_Curve>` **get_fadeout_curve**\ (\ )
- Determines how cross-fading between animations is eased. If empty, the transition will be linear.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_fadeout_time:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **fadeout_time** = ``0.0`` :ref:`🔗<class_AnimationNodeOneShot_property_fadeout_time>`
- .. rst-class:: classref-property-setget
- - |void| **set_fadeout_time**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_fadeout_time**\ (\ )
- 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.
- \ **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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimationNodeOneShot_property_mix_mode:
- .. rst-class:: classref-property
- :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **mix_mode** = ``0`` :ref:`🔗<class_AnimationNodeOneShot_property_mix_mode>`
- .. rst-class:: classref-property-setget
- - |void| **set_mix_mode**\ (\ value\: :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>`\ )
- - :ref:`MixMode<enum_AnimationNodeOneShot_MixMode>` **get_mix_mode**\ (\ )
- The blend type.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|