feat(viewer): strip scans/guides from the bake, re-add from scene data

Scans (LiDAR meshes) and guides (floorplan images) are heavy reference assets
stored elsewhere, not part of the compiled building — and baking them into a
public static GLB would also bypass the per-project show_*_public flags. Strip
both from the export entirely (previously they leaked in as empty identity
nodes, timing-dependent).

The GLB viewer re-adds them at runtime from the scene graph, like lights:
GlbReferenceNodes resolves each scan/guide's registry renderer (no static nodes
import — same nodeRegistry path the viewer already uses) and portals it into its
parent level's baked node, so the node's level-local transform resolves to the
right world pose and rides level stacking. Uses the same GuideRenderer/
ScanRenderer + asset resolver as the parametric viewer, so http-backed assets
show for everyone and local asset:// ones for the owner — exact parity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-25 08:36:02 -04:00
co-authored by Claude Opus 4.8
parent df901b1d4e
commit 5938cb6805
5 changed files with 88 additions and 2 deletions
+12
View File
@@ -97,6 +97,18 @@ export function prepareSceneForExport(
const scene = source.clone(true)
const cloneByOriginal = pairClones(source, scene)
// Scans (LiDAR meshes) and guides (floorplan images) are heavy reference
// assets stored elsewhere and aren't part of the compiled building. Drop them
// from the artifact entirely — `/viewer` re-adds them from the scene graph,
// gated by the project's public-visibility flags, so they never bloat the
// shared GLB nor slip past those flags into a static public file.
for (const [id, original] of sceneRegistry.nodes) {
const node = nodes[id]
if (node?.type === 'scan' || node?.type === 'guide') {
cloneByOriginal.get(original)?.removeFromParent()
}
}
// Object3Ds that carry node identity — never strip these even when they sit on
// a non-scene layer. Some are metadata-only: a zone's visible fill/wall meshes
// are stripped, but its identity node stays to carry the polygon that /viewer