Table of Contents

Class AnimationNodeOneShot

Plays an animation once in an AnimationNodeBlendTree.

Inheritance
AnimationNodeOneShot

Remarks

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 AnimationNodeOneShot.ONE_SHOT_REQUEST_NONE.

# 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"]

See Also

Properties

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 AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE request. The AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT request stops the auto restarting, but it does not disable the autorestart itself. So, the AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE request will start auto restarting again.

var autorestart : bool = false

Property Value

bool

Remarks

  • void set_autorestart(bool value)
  • bool has_autorestart

autorestart_delay

The delay after which the automatic restart is triggered, in seconds.

var autorestart_delay : float = 1.0

Property Value

float

Remarks

  • void set_autorestart_delay(float value)
  • float get_autorestart_delay

autorestart_random_delay

If autorestart is true, a random additional delay (in seconds) between 0 and this value will be added to autorestart_delay.

var autorestart_random_delay : float = 0.0

Property Value

float

Remarks

  • void set_autorestart_random_delay(float value)
  • float get_autorestart_random_delay

break_loop_at_end

If true, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.

var break_loop_at_end : bool = false

Property Value

bool

Remarks

  • void set_break_loop_at_end(bool value)
  • bool is_loop_broken_at_end

fadein_curve

Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.

var fadein_curve : Curve

Property Value

Curve

Remarks

  • void set_fadein_curve(Curve value)
  • Curve get_fadein_curve

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 AnimationNodeOutput is considered as the most upstream, so the fadein_time is scaled depending on the downstream delta. For example, if this value is set to 1.0 and a AnimationNodeTimeScale with a value of 2.0 is chained downstream, the actual processing time will be 0.5 second.

var fadein_time : float = 0.0

Property Value

float

Remarks

  • void set_fadein_time(float value)
  • float get_fadein_time

fadeout_curve

Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.

var fadeout_curve : Curve

Property Value

Curve

Remarks

  • void set_fadeout_curve(Curve value)
  • Curve get_fadeout_curve

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 AnimationNodeOutput is considered as the most upstream, so the fadeout_time is scaled depending on the downstream delta. For example, if this value is set to 1.0 and an AnimationNodeTimeScale with a value of 2.0 is chained downstream, the actual processing time will be 0.5 second.

var fadeout_time : float = 0.0

Property Value

float

Remarks

  • void set_fadeout_time(float value)
  • float get_fadeout_time

mix_mode

The blend type.

var mix_mode : int = 0

Property Value

int

Remarks

  • void set_mix_mode(int value)
  • int get_mix_mode