summaryrefslogtreecommitdiff
path: root/doc/classes/AnimationNodeOneShot.xml
blob: 0a8998cb9e4f5d5bbb9495030edea395f5064e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="UTF-8" ?>
<class name="AnimationNodeOneShot" inherits="AnimationNodeSync" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
	<brief_description>
		Plays an animation once in [AnimationNodeBlendTree].
	</brief_description>
	<description>
		A resource to add to an [AnimationNodeBlendTree]. This 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 [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
		[/gdscript]
		[csharp]
		// Play child animation connected to "shot" port.
		animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE);

		// Abort child animation connected to "shot" port.
		animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT);
		[/csharp]
		[/codeblocks]
	</description>
	<tutorials>
		<link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link>
		<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
	</tutorials>
	<members>
		<member name="autorestart" type="bool" setter="set_autorestart" getter="has_autorestart" default="false">
			If [code]true[/code], the sub-animation will restart automatically after finishing.
			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.
		</member>
		<member name="autorestart_delay" type="float" setter="set_autorestart_delay" getter="get_autorestart_delay" default="1.0">
			The delay after which the automatic restart is triggered, in seconds.
		</member>
		<member name="autorestart_random_delay" type="float" setter="set_autorestart_random_delay" getter="get_autorestart_random_delay" default="0.0">
			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].
		</member>
		<member name="fadein_time" type="float" setter="set_fadein_time" getter="get_fadein_time" default="0.0">
			The fade-in duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a crossfade that starts at 0 second and ends at 1 second during the animation.
		</member>
		<member name="fadeout_time" type="float" setter="set_fadeout_time" getter="get_fadeout_time" default="0.0">
			The fade-in duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a crossfade that starts at 4 second and ends at 5 second during the animation.
		</member>
		<member name="mix_mode" type="int" setter="set_mix_mode" getter="get_mix_mode" enum="AnimationNodeOneShot.MixMode" default="0">
			The blend type.
		</member>
	</members>
	<constants>
		<constant name="ONE_SHOT_REQUEST_NONE" value="0" enum="OneShotRequest">
			The default state of the request. Nothing is done.
		</constant>
		<constant name="ONE_SHOT_REQUEST_FIRE" value="1" enum="OneShotRequest">
			The request to play the animation connected to "shot" port.
		</constant>
		<constant name="ONE_SHOT_REQUEST_ABORT" value="2" enum="OneShotRequest">
			The request to stop the animation connected to "shot" port.
		</constant>
		<constant name="MIX_MODE_BLEND" value="0" enum="MixMode">
			Blends two animations. See also [AnimationNodeBlend2].
		</constant>
		<constant name="MIX_MODE_ADD" value="1" enum="MixMode">
			Blends two animations additively. See also [AnimationNodeAdd2].
		</constant>
	</constants>
</class>