fix(selection): separate transient visibility

Keep object isolation out of persisted entity visibility and clear stale grips across block-editor transitions.

Refs #512

Refs #517
This commit is contained in:
Hakan Seven 2026-07-27 23:36:02 +03:00
commit d5be78a187
10 changed files with 295 additions and 106 deletions

View file

@ -491,9 +491,16 @@ impl OpenCADStudio {
.push_error("ISOLATEOBJECTS: select the objects to isolate first.");
} else {
let n = self.tabs[i].scene.selected.len();
self.push_undo_snapshot(i, "ISOLATEOBJECTS");
let before = self.tabs[i].scene.object_isolation.clone();
let selected_before =
self.tabs[i].scene.selected.iter().copied().collect();
self.tabs[i].scene.isolate_selected();
self.tabs[i].dirty = true;
self.push_object_visibility_history(
i,
"ISOLATEOBJECTS",
before,
selected_before,
);
self.command_line.push_info(&format!(
"Isolated {n} object(s). UNISOLATEOBJECTS to restore."
));
@ -507,9 +514,17 @@ impl OpenCADStudio {
.push_error("HIDEOBJECTS: select the objects to hide first.");
} else {
let n = self.tabs[i].scene.selected.len();
self.push_undo_snapshot(i, "HIDEOBJECTS");
let before = self.tabs[i].scene.object_isolation.clone();
let selected_before =
self.tabs[i].scene.selected.iter().copied().collect();
self.tabs[i].scene.hide_selected();
self.tabs[i].dirty = true;
self.push_object_visibility_history(
i,
"HIDEOBJECTS",
before,
selected_before,
);
self.refresh_properties();
self.command_line
.push_info(&format!("Hid {n} object(s). UNISOLATEOBJECTS to restore."));
}
@ -518,9 +533,16 @@ impl OpenCADStudio {
// UNISOLATEOBJECTS — bring back everything hidden by Isolate / Hide
"UNISOLATEOBJECTS" => {
if self.tabs[i].scene.is_isolation_active() {
self.push_undo_snapshot(i, "UNISOLATEOBJECTS");
let before = self.tabs[i].scene.object_isolation.clone();
let selected_before =
self.tabs[i].scene.selected.iter().copied().collect();
self.tabs[i].scene.end_isolation();
self.tabs[i].dirty = true;
self.push_object_visibility_history(
i,
"UNISOLATEOBJECTS",
before,
selected_before,
);
self.command_line
.push_info("Isolation ended — all objects shown.");
} else {