mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
bonsaiviewer: View Selected Model from the models panel context menu
Right-clicking a model in the models panel now offers "View Selected Model",
which frames the camera on just that model's geometry — View All, scoped to
one model. With several models selected the action reads "View Selected
Models" and frames their union, matching how the panel's existing Move to
Group already treats a multi-selection.
The AABB fold behind viewAll moves into InstanceCompose, which exists so this
kind of logic is unit-testable without a Qt window or a wgpu device (populating
ViewportCore's model map needs a real GPU, so the fold was previously
untestable in place). It splits in two:
- sceneWorldAabb — every VISIBLE model, what viewAll frames.
- modelsWorldAabb — only the named models, hidden or not. A model the caller
named explicitly is framed even if hidden; second-guessing
that is worse than honouring it. Models with no loaded
geometry contribute nothing, and if none of them do the
camera is left alone rather than flying to the origin.
Both are covered by six new cases in test_instance_compose (131 total).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1402,6 +1402,9 @@ void ViewportWindow::setCamera(float tx, float ty, float tz,
|
||||
// viewAll / frameAabb / computeObjectAabb moved to ViewportCore (#84-i).
|
||||
|
||||
void ViewportWindow::viewAll() { core_.viewAll(); }
|
||||
bool ViewportWindow::viewModels(const std::vector<uint32_t>& session_model_ids) {
|
||||
return core_.viewModels(session_model_ids);
|
||||
}
|
||||
void ViewportWindow::frameAabb(const float mn[3], const float mx[3], float padding) {
|
||||
core_.frameAabb(mn, mx, padding);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user