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.
This commit is contained in:
OverloadedOrama 2020-02-11 20:05:37 +02:00
parent f9bcab78f9
commit d1793c2e60

View file

@ -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 := []