From 7584c50a09bcb1ad853846214dca9002e9ae2ace Mon Sep 17 00:00:00 2001 From: kleonc Date: Mon, 4 Jan 2021 18:40:01 +0100 Subject: [PATCH] Update GUI for Cel.opacity on frame changed instead of on layer change It's Cel's property and thus it changes when frame_changed is called (also layer_changed calls frame_changed on its own). --- 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 624b41535d3d..4cf96f3520b1 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