From 4972bb7a819cb030a6cf9d1ddc069302a5bec9f1 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 24 Jul 2026 17:22:31 +1000 Subject: [PATCH] ifcviewer: reorder sidecar by Morton in the offline bake path SidecarBuilder::build (the one-shot bake used by the models-panel export command in bonsaiviewer) never called reorderSidecarByMorton, unlike the live streaming loader. The chunk table was therefore left empty, so the exported .ifcview had its geometry laid out non-contiguously and only the metadata blocks compressed. Reorder before writeSidecar to match the loader so exported sidecars stream correctly. Co-Authored-By: Claude Opus 4.8 --- src/ifcviewer/SidecarBuilder.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ifcviewer/SidecarBuilder.cpp b/src/ifcviewer/SidecarBuilder.cpp index 9292a81350..9636bbe8bb 100644 --- a/src/ifcviewer/SidecarBuilder.cpp +++ b/src/ifcviewer/SidecarBuilder.cpp @@ -22,6 +22,7 @@ #include "Federation.h" #include "LodBuilder.h" #include "SidecarCache.h" +#include "SidecarLayout.h" #include "VertexQuantization.h" #include @@ -205,6 +206,13 @@ bool SidecarBuilder::build(const QString& ifc_path, SidecarData data = finalize(georef, streamer.drainElements()); + // Match the live loader (SceneLoader::onStreamerFinished): reorder into the + // chunk-contiguous layout, which populates the chunk table so writeSidecar + // actually compresses the geometry. Without it this offline bake path (used + // by the models-panel export command) writes a sidecar whose geometry was + // never laid out contiguously, with only the metadata blocks compressed. + reorderSidecarByMorton(data); + if (!writeSidecar(anchor_path.toStdString(), data)) { last_error_ = "writeSidecar failed"; return false;