2018-07-26 09:56:21 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "AnimationNodeOneShot" inherits= "AnimationNodeSync" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2018-07-26 09:56:21 +00:00
<brief_description >
2023-04-28 15:16:44 +00:00
Plays an animation once in an [AnimationNodeBlendTree].
2018-07-26 09:56:21 +00:00
</brief_description>
<description >
2023-04-30 14:32:18 +00:00
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.
2023-02-10 02:04:56 +00:00
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 [code]request[/code] value to [constant ONE_SHOT_REQUEST_NONE].
[codeblocks]
[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
2023-02-13 05:16:40 +00:00
2023-05-12 22:20:35 +00:00
# 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
2023-02-13 05:16:40 +00:00
# Get current state (read-only).
2023-05-12 22:20:35 +00:00
animation_tree.get("parameters/OneShot/active")
2023-02-13 05:16:40 +00:00
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/active"]
2023-05-12 22:20:35 +00:00
# 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"]
2023-02-10 02:04:56 +00:00
[/gdscript]
[csharp]
// Play child animation connected to "shot" port.
2023-05-31 15:04:29 +00:00
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
2023-02-10 02:04:56 +00:00
// Abort child animation connected to "shot" port.
2023-05-31 15:04:29 +00:00
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
2023-02-13 05:16:40 +00:00
2023-05-12 22:20:35 +00:00
// Abort child animation with fading out connected to "shot" port.
2023-05-31 15:04:29 +00:00
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
2023-05-12 22:20:35 +00:00
2023-02-13 05:16:40 +00:00
// Get current state (read-only).
animationTree.Get("parameters/OneShot/active");
2023-05-12 22:20:35 +00:00
// Get current internal state (read-only).
animationTree.Get("parameters/OneShot/internal_active");
2023-02-10 02:04:56 +00:00
[/csharp]
[/codeblocks]
2018-07-26 09:56:21 +00:00
</description>
<tutorials >
2023-04-28 15:16:44 +00:00
<link title= "Using AnimationTree" > $DOCS_URL/tutorials/animation/animation_tree.html</link>
2020-10-01 08:34:47 +00:00
<link title= "Third Person Shooter Demo" > https://godotengine.org/asset-library/asset/678</link>
2018-07-26 09:56:21 +00:00
</tutorials>
<members >
2019-06-29 10:38:01 +00:00
<member name= "autorestart" type= "bool" setter= "set_autorestart" getter= "has_autorestart" default= "false" >
2020-03-03 18:21:21 +00:00
If [code]true[/code], the sub-animation will restart automatically after finishing.
2023-02-10 02:04:56 +00:00
In other words, to start auto restarting, the animation must be played once with the [constant ONE_SHOT_REQUEST_FIRE] request. The [constant ONE_SHOT_REQUEST_ABORT] request stops the auto restarting, but it does not disable the [member autorestart] itself. So, the [constant ONE_SHOT_REQUEST_FIRE] request will start auto restarting again.
2018-07-26 09:56:21 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "autorestart_delay" type= "float" setter= "set_autorestart_delay" getter= "get_autorestart_delay" default= "1.0" >
2020-03-03 18:21:21 +00:00
The delay after which the automatic restart is triggered, in seconds.
2018-07-26 09:56:21 +00:00
</member>
2019-06-29 10:38:01 +00:00
<member name= "autorestart_random_delay" type= "float" setter= "set_autorestart_random_delay" getter= "get_autorestart_random_delay" default= "0.0" >
2020-03-03 18:21:21 +00:00
If [member autorestart] is [code]true[/code], a random additional delay (in seconds) between 0 and this value will be added to [member autorestart_delay].
2018-07-26 09:56:21 +00:00
</member>
2023-05-12 22:20:35 +00:00
<member name= "fadein_curve" type= "Curve" setter= "set_fadein_curve" getter= "get_fadein_curve" >
Determines how cross-fading between animations is eased. If empty, the transition will be linear.
</member>
2022-05-04 18:53:48 +00:00
<member name= "fadein_time" type= "float" setter= "set_fadein_time" getter= "get_fadein_time" default= "0.0" >
2023-05-12 22:20:35 +00:00
The fade-in duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a cross-fade that starts at 0 second and ends at 1 second during the animation.
</member>
<member name= "fadeout_curve" type= "Curve" setter= "set_fadeout_curve" getter= "get_fadeout_curve" >
Determines how cross-fading between animations is eased. If empty, the transition will be linear.
2018-07-26 09:56:21 +00:00
</member>
2022-05-04 18:53:48 +00:00
<member name= "fadeout_time" type= "float" setter= "set_fadeout_time" getter= "get_fadeout_time" default= "0.0" >
2023-05-12 22:20:35 +00:00
The fade-out duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation.
2018-07-26 09:56:21 +00:00
</member>
2020-04-16 21:21:11 +00:00
<member name= "mix_mode" type= "int" setter= "set_mix_mode" getter= "get_mix_mode" enum= "AnimationNodeOneShot.MixMode" default= "0" >
2023-02-10 02:04:56 +00:00
The blend type.
2020-04-16 21:21:11 +00:00
</member>
2018-07-26 09:56:21 +00:00
</members>
<constants >
2023-01-12 12:51:03 +00:00
<constant name= "ONE_SHOT_REQUEST_NONE" value= "0" enum= "OneShotRequest" >
2023-02-10 02:04:56 +00:00
The default state of the request. Nothing is done.
2023-01-12 12:51:03 +00:00
</constant>
<constant name= "ONE_SHOT_REQUEST_FIRE" value= "1" enum= "OneShotRequest" >
2023-02-10 02:04:56 +00:00
The request to play the animation connected to "shot" port.
2023-01-12 12:51:03 +00:00
</constant>
<constant name= "ONE_SHOT_REQUEST_ABORT" value= "2" enum= "OneShotRequest" >
2023-02-10 02:04:56 +00:00
The request to stop the animation connected to "shot" port.
2023-01-12 12:51:03 +00:00
</constant>
2023-05-12 22:20:35 +00:00
<constant name= "ONE_SHOT_REQUEST_FADE_OUT" value= "3" enum= "OneShotRequest" >
The request to fade out the animation connected to "shot" port.
</constant>
2018-07-26 09:56:21 +00:00
<constant name= "MIX_MODE_BLEND" value= "0" enum= "MixMode" >
2023-02-10 02:04:56 +00:00
Blends two animations. See also [AnimationNodeBlend2].
2018-07-26 09:56:21 +00:00
</constant>
<constant name= "MIX_MODE_ADD" value= "1" enum= "MixMode" >
2023-02-10 02:04:56 +00:00
Blends two animations additively. See also [AnimationNodeAdd2].
2018-07-26 09:56:21 +00:00
</constant>
</constants>
</class>