ifcviewer-web: pick logs the object's IFC GUID via the on-demand deferred fetch

First real consumer of the v15 deferred property block, and an end-to-end
demonstration that on-demand property loading works. On a left-click pick,
logSelectedObjectGuidWeb ensures the owning model's deferred block is loaded
(loadDeferredMetadataWeb — a network fetch the FIRST time, cached after) and
logs the picked object's GUID to the console.

Fix uncovered while wiring it: applyCachedModel rebases instance object_ids to
a per-model global base (object_id_base) to keep them unique across models,
but the deferred elements carry the sidecar's original local ids — so a lookup
by the picked (global) id missed. Store object_id_base on the model and rebase
the elements by it when the deferred block loads.

Verified: with a streamed model, the deferred block is fetched ONLY after the
first pick (not at load), and the pick logs a valid 22-char IFC GUID. 111/111
unit + 6/6 web smoke pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-01 09:21:33 +10:00
parent 13ec2be807
commit 681de6f817
4 changed files with 45 additions and 1 deletions
+3
View File
@@ -131,6 +131,9 @@ EM_BOOL onMouseUp(int, const EmscriptenMouseEvent* e, void* user) {
const bool remove = e->ctrlKey;
app->core.pickObjectAtAsync(px, py, [app, add, remove](std::uint32_t id) {
app->core.applyPickToSelection(id, add, remove);
// Demo the v15 on-demand deferred fetch: log the picked object's
// IFC GUID (first pick fetches the property block off the network).
if (id != 0) app->core.logSelectedObjectGuidWeb(id);
app->host.requestFrame();
});
}