From 8e55b91a3977df48a932bf9a5f7915be7684d95a Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 14 Dec 2024 17:18:52 +0200 Subject: [PATCH] Unmute audio layes when making them visible while the animation is playing --- src/UI/Timeline/LayerButton.gd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/UI/Timeline/LayerButton.gd b/src/UI/Timeline/LayerButton.gd index fbb564bd5..0341a6351 100644 --- a/src/UI/Timeline/LayerButton.gd +++ b/src/UI/Timeline/LayerButton.gd @@ -36,7 +36,7 @@ func _ready() -> void: Global.cel_switched.connect(_on_cel_switched) var layer := Global.current_project.layers[layer_index] layer.name_changed.connect(func(): label.text = layer.name) - layer.visibility_changed.connect(update_buttons) + layer.visibility_changed.connect(_on_layer_visibility_changed) if layer is PixelLayer: linked_button.visible = true elif layer is GroupLayer: @@ -86,6 +86,13 @@ func _on_cel_switched() -> void: _play_audio(true) +func _on_layer_visibility_changed() -> void: + update_buttons() + var layer := Global.current_project.layers[layer_index] + if layer is AudioLayer: + _play_audio(not animation_running) + + func _on_animation_started(_dir: bool) -> void: animation_running = true _play_audio(false)