Skip to content

Commit be30e33

Browse files
authored
Merge pull request #258 from endlessm/animationplayer-await
Await until animation is finished
2 parents 093f362 + 0f8d008 commit be30e33

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

addons/block_code/blocks/graphics/animationplayer_play.tres

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_resource type="Resource" load_steps=6 format=3 uid="uid://c5e1byehtxwc0"]
1+
[gd_resource type="Resource" load_steps=7 format=3 uid="uid://c5e1byehtxwc0"]
22

33
[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_emeuv"]
44
[ext_resource type="Script" path="res://addons/block_code/code_generation/option_data.gd" id="1_xu43h"]
@@ -14,6 +14,11 @@ script = ExtResource("1_xu43h")
1414
selected = 0
1515
items = ["forward", "backwards"]
1616

17+
[sub_resource type="Resource" id="Resource_17pec"]
18+
script = ExtResource("1_xu43h")
19+
selected = 0
20+
items = ["until done", "in the background"]
21+
1722
[resource]
1823
script = ExtResource("1_emeuv")
1924
name = &"animationplayer_play"
@@ -22,15 +27,18 @@ description = "Play the animation."
2227
category = "Graphics | Animation"
2328
type = 2
2429
variant_type = 0
25-
display_template = "play {animation: STRING} {direction: NIL}"
30+
display_template = "play {animation: STRING} {direction: NIL} {wait_mode: NIL}"
2631
code_template = "if {direction} == \"forward\":
2732
play({animation})
2833
else:
2934
play_backwards({animation})
35+
if {wait_mode} == \"until done\":
36+
await animation_finished
3037
"
3138
defaults = {
3239
"animation": SubResource("Resource_qpxn2"),
33-
"direction": SubResource("Resource_vnp2w")
40+
"direction": SubResource("Resource_vnp2w"),
41+
"wait_mode": SubResource("Resource_17pec")
3442
}
3543
signal_name = ""
3644
scope = ""

0 commit comments

Comments
 (0)