From c18c7057481986906a09004706ad13ad9041023a Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Tue, 5 Jan 2021 02:12:02 +0100 Subject: [PATCH] Update GUI for Cel.opacity on frame changed instead of on layer change (#420) It's Cel's property and thus it changes when frame_changed is called (also layer_changed calls frame_changed on its own). Co-authored-by: kleonc --- src/Classes/Project.gd | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 624b41535..4cf96f352 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -465,15 +465,16 @@ func frame_changed(value : int) -> void: Global.disable_button(Global.move_left_frame_button, frames.size() == 1 or current_frame == 0) Global.disable_button(Global.move_right_frame_button, frames.size() == 1 or current_frame == frames.size() - 1) + if current_frame < frames.size(): + Global.layer_opacity_slider.value = frames[current_frame].cels[current_layer].opacity * 100 + Global.layer_opacity_spinbox.value = frames[current_frame].cels[current_layer].opacity * 100 + Global.canvas.update() Global.transparent_checker._ready() # To update the rect size func layer_changed(value : int) -> void: current_layer = value - if current_frame < frames.size(): - Global.layer_opacity_slider.value = frames[current_frame].cels[current_layer].opacity * 100 - Global.layer_opacity_spinbox.value = frames[current_frame].cels[current_layer].opacity * 100 for container in Global.layers_container.get_children(): container.pressed = false