Add global undo/redo system with CDC deduplication (Ctrl+Z / Ctrl+Y)#1641
Open
Z3roCo0l wants to merge 7 commits intocnr-isti-vclab:develfrom
Open
Add global undo/redo system with CDC deduplication (Ctrl+Z / Ctrl+Y)#1641Z3roCo0l wants to merge 7 commits intocnr-isti-vclab:develfrom
Z3roCo0l wants to merge 7 commits intocnr-isti-vclab:develfrom
Conversation
…eload confirmations - EditPlugin base class: initGlobalParameterList + setCurrentGlobalParamSet for persistent per-plugin settings - edit_select: opt-in "Invert CTRL Behavior" parameter (default OFF) - Reload/Reload All confirmation dialogs - Updated all edit plugin factory headers for new interface
New edit plugin that lets users draw a polyline on screen and cut through mesh triangles along the path. Splits edges at polyline intersections, re-triangulates affected faces, then selects/deletes faces inside the polyline boundary. Features: - Polyline drawing with mouse clicks - Edge splitting at polyline-mesh intersections using SplitTab - Centroid-based face selection for clean boundary cuts - Two-phase workflow: Q to select (preview), Enter to delete - Full edit_select-style keybindings (Q/W/D/A/I) - GPU buffer refresh after mesh modification Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove deleteSelectedFaces from edit_cut and let filter_select's standard Delete shortcut handle deletion (proper undo/redo support). Preserve selection across endEdit/Escape so the shortcut works. Move edit_cut button from Edit toolbar to new Dynart Tools toolbar. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Strip cutLog/cutLogQ calls, LOG_PATH, and windows.h/cstdio includes. Clean production code ready for release. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Full-mesh snapshot undo stack covering all filters and edit_cut. Uses tri::Append::MeshCopy for deep copies, 10 undo levels max. Edit menu entries with standard keyboard shortcuts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The undo system now serializes meshes to byte buffers, chunks them using content-defined boundaries (Gear hash), and deduplicates chunks in a shared reference-counted store. This reduces memory usage by ~80-90% for typical local edits. Undo limit increased from 10 to 50. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MeshLab has no built-in undo system (see #376). This adds a practical, constrained undo/redo mechanism that works across all filters and edit tools without refactoring MeshLab's internal architecture.
Design Approach
This is intentionally not a full architecture-level undo framework. Instead, it takes mesh state snapshots at well-defined operation boundaries (before each filter execution and before lasso cut operations). The approach coexists with the current architecture without modifying action dispatch, state management, or plugin interfaces.
CDC (Content-Defined Chunking) Deduplication
To make 50 undo levels practical, the system uses content-defined chunking instead of storing full mesh copies:
ChunkStoreavoids duplicationSerialization
The serializer handles all CMeshO components:
UpdateTopologyon restoreLimitations
PointerToAttribute) are not serialized (uncommon in standard workflows)Files Changed
src/meshlab/mesh_undo_stack.h— Complete undo system (CDC pipeline + MeshUndoStack class, ~870 lines, all in single header)src/meshlab/mainwindow.h— Undo stack member, Ctrl+Z/Y actions, slotssrc/meshlab/mainwindow_Init.cpp— Menu entries, keyboard shortcutssrc/meshlab/mainwindow_RunTime.cpp— Pre-filter snapshot hook, undo/redo implementationsrc/meshlabplugins/edit_cut/edit_cut.cpp— Pre-cut snapshot via QMetaObject::invokeMethod (no linker dependency on meshlab.exe)Test plan