ifcviewer: per-element visibility (H / Shift+H / Alt+H)

Adds VisibilityState, a CPU-only sibling to SelectionState.  It owns
the canonical hidden-id set plus a flat per-object_id byte vector that
the cull's hot path queries inline (bounds check + byte load + compare
per surviving instance).  Hidden elements never reach the visible[]
SSBO so they don't draw or pick — matching Blender/CAD convention.

ViewportWindow registers every streamed and sidecar-cached object_id
with the new state, resets it on clearScene, and connects the changed
signal to invalidate cached cull state.  Three convenience verbs:
hideSelectedElements (union into hidden), isolateSelectedElements
(replace hidden with live-object_ids minus selection, skipping
model-hidden models so element-hide doesn't pile on top of model-hide),
and showAllElements (clears the override; model-hidden models stay
hidden, per the user's spec).

Bound in the View menu: H hide, Shift+H isolate, Alt+H show all.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-05-11 07:33:09 +10:00
parent 742561c56d
commit 1c598a981e
5 changed files with 269 additions and 3 deletions
+14
View File
@@ -335,6 +335,20 @@ void MainWindow::setupMenus() {
viewport_->toggleVolumeTool();
}, QKeySequence("Ctrl+Shift+V"));
view_menu->addSeparator();
// Element visibility — H hides the current selection, Shift+H
// isolates it (hides everything else within visible models), Alt+H
// restores every element. Model-level hiding is independent and
// stays put.
view_menu->addAction("&Hide Selected", this, [this]() {
viewport_->hideSelectedElements();
}, QKeySequence(Qt::Key_H));
view_menu->addAction("&Isolate Selected", this, [this]() {
viewport_->isolateSelectedElements();
}, QKeySequence(Qt::SHIFT | Qt::Key_H));
view_menu->addAction("&Show All Elements", this, [this]() {
viewport_->showAllElements();
}, QKeySequence(Qt::ALT | Qt::Key_H));
view_menu->addSeparator();
view_menu->addAction("Set &Home View", this, &MainWindow::onSetHomeView);
view_menu->addAction("&Go to Home View", this, &MainWindow::onGoHomeView);
}