Skip to content

Implement ClonableUndoCommand for object commands (undo/redo)#4436

Open
abhinavs1920 wants to merge 1 commit into
mapeditor:masterfrom
abhinavs1920:undo-object
Open

Implement ClonableUndoCommand for object commands (undo/redo)#4436
abhinavs1920 wants to merge 1 commit into
mapeditor:masterfrom
abhinavs1920:undo-object

Conversation

@abhinavs1920
Copy link
Copy Markdown

Closes #3471

Problem

When Automapping rules placed both tiles and objects, you had to press Ctrl+Z multiple times (2-3 times) to fully undo the operation. Tiles-only rules worked fine with a single undo.

Solution

Implemented the ClonableUndoCommand interface in AddMapObjects and RemoveMapObjects. This allows the undo system to properly clone and merge object commands, so they undo together with tiles in a single step.

###Changes

  • src/tiled/addremovemapobject.h - Added interface inheritance and method declarations
  • src/tiled/addremovemapobject.cpp - Implemented clone() and mergeWith() methods with proper ownership transfer

I am adding screenshots produced by my manual testing, along with it tests are also added.

Screenshot from 2026-03-15 04-53-29 Screenshot from 2026-03-15 04-53-48 Screenshot from 2026-03-15 04-53-54

Signed-off-by: Abhinav Sharma <abhinavs1920bpl@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automapping - Backtracking after placing Object

1 participant