AnimationNodeOneShot
Inherits: AnimationNodeSync < AnimationNode < Resource < RefCounted < Object
Description
Section titled “Description”Plays an animation once in an AnimationNodeBlendTree.
A resource to add to an 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 ONE_SHOT_REQUEST_NONE.
// 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");Optionally, signals can be used by setting an AnimationNodeObserverOneShot through AnimationTree.
var observer = animationTree.Get("parameters/OneShot/observer").As<AnimationNodeObserverOneShot>();observer.Started += OnOneShotStarted;Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | abort_on_reset |
false |
| bool | autorestart |
false |
| float | autorestart_delay |
1.0 |
| float | autorestart_random_delay |
0.0 |
| bool | break_loop_at_end |
false |
| Curve | fadein_curve |
|
| float | fadein_time |
0.0 |
| Curve | fadeout_curve |
|
| float | fadeout_time |
0.0 |
| MixMode | mix_mode |
0 |
Enumerations
Section titled “Enumerations”OneShotRequest
enum OneShotRequest
ONE_SHOT_REQUEST_NONE = 0
The default state of the request. Nothing is done.
ONE_SHOT_REQUEST_FIRE = 1
The request to play the animation connected to “shot” port.
ONE_SHOT_REQUEST_ABORT = 2
The request to stop the animation connected to “shot” port.
ONE_SHOT_REQUEST_FADE_OUT = 3
The request to fade out the animation connected to “shot” port.
MixMode
enum MixMode
MIX_MODE_BLEND = 0
Blends two animations. See also AnimationNodeBlend2.
MIX_MODE_ADD = 1
Blends two animations additively. See also AnimationNodeAdd2.
Property descriptions
Section titled “Property descriptions”abort_on_reset
bool abort_on_reset = false
If true, the sub-animation will abort if resumed with a reset after a prior interruption.
autorestart
bool autorestart = false
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 ONE_SHOT_REQUEST_FIRE request. The ONE_SHOT_REQUEST_ABORT request stops the auto restarting, but it does not disable the autorestart itself. So, the ONE_SHOT_REQUEST_FIRE request will start auto restarting again.
autorestart_delay
float autorestart_delay = 1.0
The delay after which the automatic restart is triggered, in seconds.
autorestart_random_delay
float autorestart_random_delay = 0.0
If autorestart is true, a random additional delay (in seconds) between 0 and this value will be added to autorestart_delay.
break_loop_at_end
bool break_loop_at_end = false
If true, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
fadein_curve
Curve fadein_curve
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.
fadein_time
float fadein_time = 0.0
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 fading has finished.
fadeout_curve
Curve fadeout_curve
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.
fadeout_time
float fadeout_time = 0.0
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 fading has finished.
mix_mode
MixMode mix_mode = 0
The blend type.
