diff --git a/src/UI/Timeline/LayerButton.gd b/src/UI/Timeline/LayerButton.gd index 41022a103..f5f2638d4 100644 --- a/src/UI/Timeline/LayerButton.gd +++ b/src/UI/Timeline/LayerButton.gd @@ -63,18 +63,15 @@ func _on_LayerContainer_gui_input(event: InputEvent) -> void: var frame_layer := [i, j] if !project.selected_cels.has(frame_layer): project.selected_cels.append(frame_layer) + project.current_layer = layer elif Input.is_action_pressed("ctrl"): for i in range(0, project.frames.size()): var frame_layer := [i, layer] if !project.selected_cels.has(frame_layer): project.selected_cels.append(frame_layer) + project.current_layer = layer else: # If the button is pressed without Shift or Control - project.selected_cels.clear() - var frame_layer := [project.current_frame, layer] - if !project.selected_cels.has(frame_layer): - project.selected_cels.append(frame_layer) - - project.current_layer = layer + _select_current_layer() if event.doubleclick: label.visible = false @@ -100,11 +97,13 @@ func _on_VisibilityButton_pressed() -> void: Global.canvas.selection.transform_content_confirm() Global.current_project.layers[layer].visible = !Global.current_project.layers[layer].visible Global.canvas.update() + _select_current_layer() func _on_LockButton_pressed() -> void: Global.canvas.selection.transform_content_confirm() Global.current_project.layers[layer].locked = !Global.current_project.layers[layer].locked + _select_current_layer() func _on_LinkButton_pressed() -> void: @@ -119,9 +118,19 @@ func _on_LinkButton_pressed() -> void: var container = Global.frames_container.get_child(Global.current_project.current_layer) container.get_child(Global.current_project.current_frame).button_setup() + _select_current_layer() Global.current_project.layers = Global.current_project.layers # Call the setter +func _select_current_layer() -> void: + Global.current_project.selected_cels.clear() + var frame_layer := [Global.current_project.current_frame, layer] + if !Global.current_project.selected_cels.has(frame_layer): + Global.current_project.selected_cels.append(frame_layer) + + Global.current_project.current_layer = layer + + func get_drag_data(_position) -> Array: var button := Button.new() button.rect_size = rect_size