diff --git a/src/Autoload/OpenSave.gd b/src/Autoload/OpenSave.gd index 3078ac745..1b53fe69c 100644 --- a/src/Autoload/OpenSave.gd +++ b/src/Autoload/OpenSave.gd @@ -546,16 +546,18 @@ func open_image_as_spritesheet_layer( else: cels.append(layer.new_empty_cel()) - project.undo_redo.add_do_property(project, "current_frame", new_frames_size - 1) - project.undo_redo.add_do_property(project, "current_layer", project.layers.size()) project.undo_redo.add_do_method(project, "add_frames", frames, frame_indices) project.undo_redo.add_do_method(project, "add_layers", [layer], [project.layers.size()], [cels]) + project.undo_redo.add_do_method( + project, "_cel_changed", new_frames_size - 1, project.layers.size() + ) project.undo_redo.add_do_method(Global, "undo_or_redo", false) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) project.undo_redo.add_undo_method(project, "remove_layers", [project.layers.size()]) project.undo_redo.add_undo_method(project, "remove_frames", frame_indices) + project.undo_redo.add_undo_method( + project, "_cel_changed", project.current_frame, project.current_layer + ) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -574,13 +576,13 @@ func open_image_at_cel(image: Image, layer_index := 0, frame_index := 0) -> void project.undo_redo.add_undo_property(cel, "image", cel.image) project.undo_redo.add_do_property(project, "selected_cels", []) - project.undo_redo.add_do_property(project, "current_layer", layer_index) - project.undo_redo.add_do_property(project, "current_frame", frame_index) + project.undo_redo.add_do_method(project, "_cel_changed", frame_index, layer_index) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_property(project, "selected_cels", []) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_undo_method( + project, "_cel_changed", project.current_frame, project.current_layer + ) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -601,13 +603,13 @@ func open_image_as_new_frame(image: Image, layer_index := 0) -> void: project.undo_redo.create_action("Add Frame") project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_do_method(project, "add_frames", [frame], [project.frames.size()]) - project.undo_redo.add_do_property(project, "current_layer", layer_index) - project.undo_redo.add_do_property(project, "current_frame", project.frames.size()) + project.undo_redo.add_do_method(project, "_cel_changed", project.frames.size(), layer_index) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_undo_method(project, "remove_frames", [project.frames.size()]) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_undo_method( + project, "_cel_changed", project.current_frame, project.current_layer + ) project.undo_redo.commit_action() @@ -626,13 +628,13 @@ func open_image_as_new_layer(image: Image, file_name: String, frame_index := 0) else: cels.append(layer.new_empty_cel()) - project.undo_redo.add_do_property(project, "current_layer", project.layers.size()) project.undo_redo.add_do_method(project, "add_layers", [layer], [project.layers.size()], [cels]) - project.undo_redo.add_do_property(project, "current_frame", frame_index) + project.undo_redo.add_do_method(project, "_cel_changed", frame_index, project.layers.size()) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) project.undo_redo.add_undo_method(project, "remove_layers", [project.layers.size()]) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_undo_method( + project, "_cel_changed", project.current_frame, project.current_layer + ) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index d2aac27ba..6b2d5eaab 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -3,6 +3,9 @@ class_name Project extends Reference # A class for project properties. +# warning-ignore:unused_signal +signal cel_changed(frame, layer) + var name := "" setget _name_changed var size: Vector2 setget _size_changed var undo_redo := UndoRedo.new() @@ -16,8 +19,8 @@ var has_changed := false setget _has_changed_changed # the add/remove/move/swap_frames/layers methods var frames := [] # Array of Frames (that contain Cels) var layers := [] # Array of Layers -var current_frame := 0 setget _frame_changed -var current_layer := 0 setget _layer_changed +var current_frame := 0 +var current_layer := 0 var selected_cels := [[0, 0]] # Array of Arrays of 2 integers (frame & layer) var animation_tags := [] setget _animation_tags_changed # Array of AnimationTags @@ -59,6 +62,7 @@ func _init(_frames := [], _name := tr("untitled"), _size := Vector2(64, 64)) -> size = _size tiles = Tiles.new(size) selection_map.create(size.x, size.y, false, Image.FORMAT_LA8) + connect("cel_changed", self, "_cel_changed") Global.tabs.add_tab(name) OpenSave.current_save_paths.append("") @@ -464,64 +468,60 @@ func _size_changed(value: Vector2) -> void: size = value -func _frame_changed(value: int) -> void: +func _cel_changed(new_frame: int, new_layer := -1) -> void: + if new_frame < 0: + new_frame = current_frame + if new_layer < 0: + new_layer = current_layer Global.canvas.selection.transform_content_confirm() - current_frame = value - Global.current_frame_mark_label.text = "%s/%s" % [str(current_frame + 1), frames.size()] - + # Unpress all buttons for i in frames.size(): var frame_button: BaseButton = Global.frame_hbox.get_child(i) - frame_button.pressed = false - for cel_hbox in Global.cel_vbox.get_children(): # De-select all the other cels + frame_button.pressed = false # Unpress all frame buttons + for cel_hbox in Global.cel_vbox.get_children(): if i < cel_hbox.get_child_count(): - cel_hbox.get_child(i).pressed = false + cel_hbox.get_child(i).pressed = false # Unpress all cel buttons + + for layer_button in Global.layer_vbox.get_children(): + layer_button.pressed = false # Unpress all layer buttons if selected_cels.empty(): - selected_cels.append([current_frame, current_layer]) - # Select the new frame - for cel in selected_cels: + selected_cels.append([new_frame, new_layer]) + for cel in selected_cels: # Press selected buttons var frame: int = cel[0] var layer: int = cel[1] if frame < Global.frame_hbox.get_child_count(): var frame_button: BaseButton = Global.frame_hbox.get_child(frame) - frame_button.pressed = true + frame_button.pressed = true # Press selected frame buttons - var vbox_child_count: int = Global.cel_vbox.get_child_count() - if layer < vbox_child_count: - var cel_hbox: Container = Global.cel_vbox.get_child(vbox_child_count - 1 - layer) + var layer_vbox_child_count: int = Global.layer_vbox.get_child_count() + if layer < layer_vbox_child_count: + var layer_button = Global.layer_vbox.get_child(layer_vbox_child_count - 1 - layer) + layer_button.pressed = true # Press selected layer buttons + + var cel_vbox_child_count: int = Global.cel_vbox.get_child_count() + if layer < cel_vbox_child_count: + var cel_hbox: Container = Global.cel_vbox.get_child(cel_vbox_child_count - 1 - layer) if frame < cel_hbox.get_child_count(): - var cel_button = cel_hbox.get_child(frame) - cel_button.pressed = true + var cel_button: BaseButton = cel_hbox.get_child(frame) + cel_button.pressed = true # Press selected cel buttons - if current_frame < frames.size(): + if new_frame != current_frame: # If the frame has changed + current_frame = new_frame + Global.current_frame_mark_label.text = "%s/%s" % [str(current_frame + 1), frames.size()] + toggle_frame_buttons() + + if new_layer != current_layer: # If the layer has changed + current_layer = new_layer + toggle_layer_buttons() + + if current_frame < frames.size(): # Set opacity slider var cel_opacity: float = frames[current_frame].cels[current_layer].opacity Global.layer_opacity_slider.value = cel_opacity * 100 - - toggle_frame_buttons() Global.canvas.update() Global.transparent_checker.update_rect() -func _layer_changed(value: int) -> void: - Global.canvas.selection.transform_content_confirm() - current_layer = value - - toggle_layer_buttons() - - yield(Global.get_tree().create_timer(0.01), "timeout") - self.current_frame = current_frame # Call frame_changed to update UI - for layer_button in Global.layer_vbox.get_children(): - layer_button.pressed = false - - for cel in selected_cels: - var layer: int = cel[1] - if layer < Global.layer_vbox.get_child_count(): - var layer_button = Global.layer_vbox.get_child( - Global.layer_vbox.get_child_count() - 1 - layer - ) - layer_button.pressed = true - - func toggle_frame_buttons() -> void: Global.disable_button(Global.remove_frame_button, frames.size() == 1) Global.disable_button(Global.move_left_frame_button, frames.size() == 1 or current_frame == 0) diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index 402c16de5..7b6b5b8c8 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -160,8 +160,8 @@ func add_frame() -> void: project.undo_redo.add_undo_method(project, "remove_frames", [frame_add_index]) project.undo_redo.add_do_property(project, "animation_tags", new_animation_tags) project.undo_redo.add_undo_property(project, "animation_tags", project.animation_tags) - project.undo_redo.add_do_property(project, "current_frame", project.current_frame + 1) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_do_method(project, "_cel_changed", project.current_frame + 1) + project.undo_redo.add_undo_method(project, "_cel_changed", project.current_frame) project.undo_redo.commit_action() @@ -225,8 +225,8 @@ func delete_frames(indices := []) -> void: project.undo_redo.add_undo_method(project, "add_frames", frames, indices) project.undo_redo.add_do_property(project, "animation_tags", new_animation_tags) project.undo_redo.add_undo_property(project, "animation_tags", project.animation_tags) - project.undo_redo.add_do_property(project, "current_frame", current_frame) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_do_method(project, "_cel_changed", current_frame) + project.undo_redo.add_undo_method(project, "_cel_changed", project.current_frame) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -301,8 +301,8 @@ func copy_frames(indices := []) -> void: project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(project, "add_frames", copied_frames, copied_indices) project.undo_redo.add_undo_method(project, "remove_frames", copied_indices) - project.undo_redo.add_do_property(project, "current_frame", indices[-1] + 1) - project.undo_redo.add_undo_property(project, "current_frame", indices[-1]) + project.undo_redo.add_do_method(project, "_cel_changed", indices[-1] + 1) + project.undo_redo.add_undo_method(project, "_cel_changed", indices[-1]) project.undo_redo.add_do_property(project, "animation_tags", new_animation_tags) project.undo_redo.add_undo_property(project, "animation_tags", project.animation_tags) project.undo_redo.commit_action() @@ -396,7 +396,7 @@ func _on_AnimationTimer_timeout() -> void: if animation_forward: if project.current_frame < last_frame: project.selected_cels.clear() - project.current_frame += 1 + project.emit_signal("cel_changed", project.current_frame + 1, -1) Global.animation_timer.wait_time = ( project.frames[project.current_frame].duration * (1 / fps) @@ -411,7 +411,7 @@ func _on_AnimationTimer_timeout() -> void: is_animation_running = false 1: # Cycle loop project.selected_cels.clear() - project.current_frame = first_frame + project.emit_signal("cel_changed", first_frame, -1) Global.animation_timer.wait_time = ( project.frames[project.current_frame].duration * (1 / fps) @@ -424,7 +424,7 @@ func _on_AnimationTimer_timeout() -> void: else: if project.current_frame > first_frame: project.selected_cels.clear() - project.current_frame -= 1 + project.emit_signal("cel_changed", project.current_frame - 1, -1) Global.animation_timer.wait_time = ( project.frames[project.current_frame].duration * (1 / fps) @@ -439,7 +439,7 @@ func _on_AnimationTimer_timeout() -> void: is_animation_running = false 1: # Cycle loop project.selected_cels.clear() - project.current_frame = last_frame + project.emit_signal("cel_changed", last_frame, -1) Global.animation_timer.wait_time = ( project.frames[project.current_frame].duration * (1 / fps) @@ -497,29 +497,31 @@ func play_animation(play: bool, forward_dir: bool) -> void: func _on_NextFrame_pressed() -> void: + var project := Global.current_project Global.canvas.selection.transform_content_confirm() - Global.current_project.selected_cels.clear() - if Global.current_project.current_frame < Global.current_project.frames.size() - 1: - Global.current_project.current_frame += 1 + project.selected_cels.clear() + if project.current_frame < project.frames.size() - 1: + project.emit_signal("cel_changed", project.current_frame + 1, -1) func _on_PreviousFrame_pressed() -> void: + var project := Global.current_project Global.canvas.selection.transform_content_confirm() - Global.current_project.selected_cels.clear() - if Global.current_project.current_frame > 0: - Global.current_project.current_frame -= 1 + project.selected_cels.clear() + if project.current_frame > 0: + project.emit_signal("cel_changed", project.current_frame - 1, -1) func _on_LastFrame_pressed() -> void: Global.canvas.selection.transform_content_confirm() Global.current_project.selected_cels.clear() - Global.current_project.current_frame = Global.current_project.frames.size() - 1 + Global.current_project.emit_signal("cel_changed", Global.current_project.frames.size() - 1, -1) func _on_FirstFrame_pressed() -> void: Global.canvas.selection.transform_content_confirm() Global.current_project.selected_cels.clear() - Global.current_project.current_frame = 0 + Global.current_project.emit_signal("cel_changed", 0, -1) func _on_FPSValue_value_changed(value: float) -> void: @@ -587,10 +589,10 @@ func add_layer(type: int) -> void: project.undos += 1 project.undo_redo.create_action("Add Layer") - project.undo_redo.add_do_property(project, "current_layer", new_layer_idx) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) project.undo_redo.add_do_method(project, "add_layers", [l], [new_layer_idx], [cels]) project.undo_redo.add_undo_method(project, "remove_layers", [new_layer_idx]) + project.undo_redo.add_do_method(project, "_cel_changed", -1, new_layer_idx) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, project.current_layer) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -646,12 +648,12 @@ func _on_CloneLayer_pressed() -> void: project.undos += 1 project.undo_redo.create_action("Add Layer") - project.undo_redo.add_do_property( - project, "current_layer", project.current_layer + clones.size() - ) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) project.undo_redo.add_do_method(project, "add_layers", clones, indices, cels) project.undo_redo.add_undo_method(project, "remove_layers", indices) + project.undo_redo.add_do_method( + project, "_cel_changed", -1, project.current_layer + clones.size() + ) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, project.current_layer) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -676,10 +678,10 @@ func _on_RemoveLayer_pressed() -> void: project.undos += 1 project.undo_redo.create_action("Remove Layer") - project.undo_redo.add_do_property(project, "current_layer", max(indices[0] - 1, 0)) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) project.undo_redo.add_do_method(project, "remove_layers", indices) project.undo_redo.add_undo_method(project, "add_layers", layers, indices, cels) + project.undo_redo.add_do_method(project, "_cel_changed", -1, max(indices[0] - 1, 0)) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, project.current_layer) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -731,12 +733,12 @@ func change_layer_order(up: bool) -> void: var to_indices := range(to_index, to_index + child_count + 1) project.undo_redo.create_action("Change Layer Order") - project.undo_redo.add_do_property(project, "current_layer", to_index + child_count) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) project.undo_redo.add_do_method(project, "move_layers", from_indices, to_indices, to_parents) project.undo_redo.add_undo_method( project, "move_layers", to_indices, from_indices, from_parents ) + project.undo_redo.add_do_method(project, "_cel_changed", -1, to_index + child_count) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, project.current_layer) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.commit_action() @@ -791,12 +793,12 @@ func _on_MergeDownLayer_pressed() -> void: project.undo_redo.add_do_property(bottom_cel.image, "data", bottom_image.data) project.undo_redo.add_undo_property(bottom_cel.image, "data", bottom_cel.image.data) - project.undo_redo.add_do_property(project, "current_layer", bottom_layer.index) - project.undo_redo.add_undo_property(project, "current_layer", top_layer.index) project.undo_redo.add_do_method(project, "remove_layers", [top_layer.index]) project.undo_redo.add_undo_method( project, "add_layers", [top_layer], [top_layer.index], [top_cels] ) + project.undo_redo.add_do_method(project, "_cel_changed", -1, bottom_layer.index) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, top_layer.index) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.commit_action() diff --git a/src/UI/Timeline/CelButton.gd b/src/UI/Timeline/CelButton.gd index bd1acb304..6ada9d3b0 100644 --- a/src/UI/Timeline/CelButton.gd +++ b/src/UI/Timeline/CelButton.gd @@ -18,7 +18,8 @@ func button_setup() -> void: rect_min_size.x = Global.animation_timeline.cel_size rect_min_size.y = Global.animation_timeline.cel_size - hint_tooltip = tr("Frame: %s, Layer: %s") % [frame + 1, layer] + var base_layer: BaseLayer = Global.current_project.layers[layer] + hint_tooltip = tr("Frame: %s, Layer: %s") % [frame + 1, base_layer.name] cel = Global.current_project.frames[frame].cels[layer] $CelTexture.texture = cel.image_texture if is_instance_valid(linked_indicator): @@ -77,11 +78,11 @@ func _on_CelButton_pressed() -> void: project.selected_cels.append(frame_layer) if change_cel: - project.current_frame = frame - project.current_layer = layer + project.emit_signal("cel_changed", frame, layer) else: - project.current_frame = project.selected_cels[0][0] - project.current_layer = project.selected_cels[0][1] + project.emit_signal( + "cel_changed", project.selected_cels[0][0], project.selected_cels[0][1] + ) release_focus() elif Input.is_action_just_released("right_mouse"): @@ -178,7 +179,7 @@ func _on_PopupMenu_id_pressed(id: int) -> void: func _delete_cel_content() -> void: - var project = Global.current_project + var project: Project = Global.current_project var empty_content = cel.create_empty_content() var old_content = cel.get_content() project.undos += 1 @@ -263,11 +264,10 @@ func drop_data(_pos, data) -> void: project.undo_redo.add_do_method(project, "move_cel", drop_frame, to_frame, layer) project.undo_redo.add_undo_method(project, "move_cel", to_frame, drop_frame, layer) - project.undo_redo.add_do_property(project, "current_layer", layer) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) - if frame != drop_frame: # If the cel moved to a different frame - project.undo_redo.add_do_property(project, "current_frame", frame) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_do_method(project, "_cel_changed", frame, layer) + project.undo_redo.add_undo_method( + project, "_cel_changed", project.current_frame, project.current_layer + ) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.commit_action() diff --git a/src/UI/Timeline/FrameButton.gd b/src/UI/Timeline/FrameButton.gd index c19009945..a17fe052e 100644 --- a/src/UI/Timeline/FrameButton.gd +++ b/src/UI/Timeline/FrameButton.gd @@ -46,7 +46,7 @@ func _button_pressed() -> void: if !Global.current_project.selected_cels.has(frame_layer): Global.current_project.selected_cels.append(frame_layer) - Global.current_project.current_frame = frame + Global.current_project.emit_signal("cel_changed", frame, -1) elif Input.is_action_just_released("right_mouse"): if Global.current_project.frames.size() == 1: @@ -94,11 +94,11 @@ func change_frame_order(rate: int) -> void: project.undo_redo.add_undo_method(project, "move_frame", change, frame) if project.current_frame == frame: - project.undo_redo.add_do_property(project, "current_frame", change) + project.undo_redo.add_do_method(project, "_cel_changed", change) else: - project.undo_redo.add_do_property(project, "current_frame", project.current_frame) + project.undo_redo.add_do_method(project, "_cel_changed", project.current_frame) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_undo_method(project, "_cel_changed", project.current_frame) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.commit_action() @@ -155,10 +155,10 @@ func drop_data(_pos, data) -> void: project.undo_redo.add_undo_method(project, "move_frame", to_frame, drop_frame) if project.current_frame == drop_frame: - project.undo_redo.add_do_property(project, "current_frame", frame) + project.undo_redo.add_do_method(project, "_cel_changed", frame) else: - project.undo_redo.add_do_property(project, "current_frame", project.current_frame) - project.undo_redo.add_undo_property(project, "current_frame", project.current_frame) + project.undo_redo.add_do_method(project, "_cel_changed", project.current_frame) + project.undo_redo.add_undo_method(project, "_cel_changed", project.current_frame) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.commit_action() diff --git a/src/UI/Timeline/LayerButton.gd b/src/UI/Timeline/LayerButton.gd index 4e5ad50b4..ddae2f177 100644 --- a/src/UI/Timeline/LayerButton.gd +++ b/src/UI/Timeline/LayerButton.gd @@ -119,13 +119,13 @@ 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 + project.emit_signal("cel_changed", -1, 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 + project.emit_signal("cel_changed", -1, layer) else: # If the button is pressed without Shift or Control _select_current_layer() @@ -181,7 +181,7 @@ func _select_current_layer() -> void: if !Global.current_project.selected_cels.has(frame_layer): Global.current_project.selected_cels.append(frame_layer) - Global.current_project.current_layer = layer + Global.current_project.emit_signal("cel_changed", -1, layer) func get_drag_data(_position) -> Array: @@ -339,10 +339,10 @@ func drop_data(_pos, data) -> void: project, "move_layers", drop_to_indices, drop_from_indices, drop_from_parents ) if project.current_layer == drop_layer: - project.undo_redo.add_do_property(project, "current_layer", layer) + project.undo_redo.add_do_method(project, "_cel_changed", -1, layer) else: - project.undo_redo.add_do_property(project, "current_layer", project.current_layer) - project.undo_redo.add_undo_property(project, "current_layer", project.current_layer) + project.undo_redo.add_do_method(project, "_cel_changed", -1, project.current_layer) + project.undo_redo.add_undo_method(project, "_cel_changed", -1, project.current_layer) project.undo_redo.add_undo_method(Global, "undo_or_redo", true) project.undo_redo.add_do_method(Global, "undo_or_redo", false) project.undo_redo.commit_action()