From d1793c2e60bf9b1159625fa8d4d567bc51a4ce0b Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 11 Feb 2020 20:05:37 +0200 Subject: [PATCH] Fix bug with undo and drawing after motion draw, again If you did motion drawing, stopped and then went to draw to the frame the motion drawing started, undo wouldn't work properly. That's because can_undo was false. --- Scripts/Canvas.gd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 30da2af..82bc2ee 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -184,6 +184,7 @@ func _input(event : InputEvent) -> void: made_line = false mouse_press_pixels.clear() mouse_press_pressure_values.clear() + can_undo = true current_pixel = get_local_mouse_position() + location if Global.current_frame != frame: @@ -288,7 +289,6 @@ func _input(event : InputEvent) -> void: if can_handle || Global.undos == Global.undo_redo.get_version(): if previous_action != "None" && previous_action != "RectSelect" && current_action != "ColorPicker": handle_redo("Draw") - can_undo = true match current_action: # Handle current tool "Pencil": @@ -475,6 +475,8 @@ func handle_undo(action : String) -> void: can_undo = false func handle_redo(action : String) -> void: + can_undo = true + if Global.undos < Global.undo_redo.get_version(): return var canvases := []