Invert CTRL behavior with Settings; Reload notification; Lasso Cut Tool; Global Undo/Redo (CDC)#1638
Closed
Z3roCo0l wants to merge 10 commits intocnr-isti-vclab:develfrom
Closed
Invert CTRL behavior with Settings; Reload notification; Lasso Cut Tool; Global Undo/Redo (CDC)#1638Z3roCo0l wants to merge 10 commits intocnr-isti-vclab:develfrom
Z3roCo0l wants to merge 10 commits intocnr-isti-vclab:develfrom
Conversation
Introduce a new edit plugin implementation and update selection/GUI behavior across the app. Added src/common/plugins/interfaces/edit_plugin.cpp and updated its header to expose the edit plugin interface; connected global parameters to the edit-select plugin and modified edit_select sources and factory files. MainWindow Init/RunTime updated to add dialog/security checks for new/reload project, wrap dialog text in tr(), and implement CTRL-modifier selection behavior and modifier pointer/info updates. Also adjusted various edit_* plugin factory headers and updated src/common/CMakeLists.txt to reflect these changes. (Minor fixes for polyline crash and selection-related behavior included.)
Rebrand title and add New Features showcase section covering inverted CTRL selection behavior, global parameter system for edit plugins, and reload confirmation dialogs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
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>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Hi, thanks for the PR! I won't be able to do a proper code review for at least a week, but I have some initial feedback:
|
Keep standard MeshLab selection workflow as default. The inverted behavior is still available as an opt-in setting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
Hi,
Thank you for the detailed feedback, I appreciate you taking the time to
point these out.
I will retarget the PR to the devel branch as soon as possible.
Regarding the selection tool: I agree with your concern and I will not
change the default workflow.
The alternative control scheme will be exposed only as an optional mode,
while the current default interaction will remain unchanged.
Concerning Undo / Redo and the architectural concerns you mentioned (see
#376):
you are right that this is not local to the plugin — my current approach is
implemented as a global undo/redo mechanism.
However, it is intentionally limited in scope: it is based on mesh state
snapshots taken at well-defined operation boundaries, and it does not
attempt to refactor or replace MeshLab’s internal action or
state-management architecture.
To mitigate memory usage, I apply a simple content-deduplication strategy
across snapshots.
I fully agree that a complete, general-purpose undo/redo framework for
MeshLab would require deep architectural changes. My goal with this PR is
not to introduce such a full system, but to provide a constrained,
practical solution for geometry-editing workflows and to explore whether
such an approach can coexist safely with the current architecture.
Regarding your question about AI tools: I do use GitHub Copilot and other
AI tools for research and iteration, similarly to using Stack Overflow. The
design choices and implementation in this PR are my own, and I am happy to
go through the code and the design decisions in detail. But I still can
explain every row in my code as well.
Finally, I will split this PR into smaller ones, since multiple features
were introduced together and they should be reviewed independently.
If you are open to it, I would very much appreciate the opportunity to
discuss the undo/redo design, its limitations, and potential risks once you
have time to review.
|
This was referenced Feb 12, 2026
Author
|
As discussed, I've split this PR into three independent PRs for easier review:
Each PR targets |
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.
New Features
Inverted CTRL Selection Behavior
The default MeshLab selection workflow requires holding CTRL to add to an existing selection, while a bare drag replaces the selection. This fork inverts that behavior:
Invert CTRL Behavior) accessible in MeshLab settings, so you can switch back to the original behavior at any timeThis change applies to all rectangle-based selection tools: Select Faces, Select Vertices, Select Connected Components, and Select Faces/Vertices inside polyline area.
Global Parameter System for Edit Plugins
Edit plugins now support persistent global parameters through the MeshLab settings system. This allows edit tools to expose user-configurable options that are saved across sessions. The
EditPluginbase class providesinitGlobalParameterListandsetCurrentGlobalParamSetfor any plugin to register its own settings.Lasso Cut Tool (
edit_cut)A new editing tool that draws a closed polyline to cut through mesh triangles and select the inside region:
The tool appears in its own Dynart Tools toolbar section, separate from the standard Edit toolbar.
Global Undo/Redo (Ctrl+Z / Ctrl+Y)
MeshLab has no built-in undo system. This adds a full undo/redo stack that works across all filters and edit tools:
How the CDC Undo System Works
Instead of storing full mesh copies (
tri::Append::MeshCopy), the undo system now:ChunkStore(FNV-1a hash identity)Memory savings (1M vertex / 2M face mesh):
The public API (
pushUndo,undo,redo,canUndo,canRedo,clear) is unchanged — all changes are internal tomesh_undo_stack.h.Reload Confirmation Dialogs
Added confirmation prompts before reloading meshes (
ReloadandReload All) to prevent accidental loss of unsaved work.Files Changed
src/meshlab/mesh_undo_stack.h— CDC undo stack (serialize → chunk → dedup pipeline)src/meshlab/mainwindow.h— Undo stack member, undo/redo actions and slotssrc/meshlab/mainwindow_Init.cpp— Ctrl+Z/Y actions, Edit menu entries, Dynart toolbarsrc/meshlab/mainwindow_RunTime.cpp— Undo/redo implementation, filter execution hooksrc/meshlab/glarea.h/glarea.cpp— Selection UI changessrc/meshlabplugins/edit_cut/— New lasso cut pluginsrc/meshlabplugins/edit_select/— Inverted CTRL behaviorsrc/common/plugins/interfaces/edit_plugin.h— Global parameter support