diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index f34409a17..890f0c711 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -8,6 +8,7 @@ var size: Vector2 setget _size_changed var undo_redo := UndoRedo.new() var tiles: Tiles var undos := 0 # The number of times we added undo properties +var can_undo = true var fill_color := Color(0) var has_changed := false setget _has_changed_changed # frames and layers Arrays should generally only be modified directly when @@ -95,6 +96,8 @@ func remove() -> void: func commit_undo() -> void: + if not can_undo: + return if Global.canvas.selection.is_moving_content: Global.canvas.selection.transform_content_cancel() else: @@ -102,6 +105,8 @@ func commit_undo() -> void: func commit_redo() -> void: + if not can_undo: + return Global.control.redone = true undo_redo.redo() Global.control.redone = false diff --git a/src/Tools/BaseTool.gd b/src/Tools/BaseTool.gd index 8d4caff16..3c347acb1 100644 --- a/src/Tools/BaseTool.gd +++ b/src/Tools/BaseTool.gd @@ -50,6 +50,7 @@ func update_config() -> void: func draw_start(_position: Vector2) -> void: _draw_cache = [] is_moving = true + Global.current_project.can_undo = false func draw_move(position: Vector2) -> void: @@ -62,6 +63,7 @@ func draw_move(position: Vector2) -> void: func draw_end(_position: Vector2) -> void: is_moving = false _draw_cache = [] + Global.current_project.can_undo = true func cursor_move(position: Vector2) -> void: