Skip to content

[Bugfix] Restore pack-loader LOD setup on scene reload - #1386

Merged
untoldengine merged 1 commit into
developfrom
issue/1326
Oct 24, 2026
Merged

untoldengine merged 1 commit into
developfrom
issue/1326

Conversation

@untoldengine

Copy link
Copy Markdown
Owner

Summary

  • Saving and reloading a scene dropped three things the pack loader sets up at first load: shared GPU builds for repeated placements of a model, the LOD chain of a multi-node model (parts switching level together), and LODComponent.selectsByScreenSize/screenSizeRadius (never serialized).
  • LODData now serializes selectsByScreenSize, screenSizeRadius, and levelsShareMaterials.
  • deserializeScene shares one UntoldBuildCache across the whole reload, so repeated placements of the same .untold build once instead of once per entity.
  • A new packLODChain(forModelAt:) re-derives a multi-node model's LOD chain on reload by finding the .untoldpack that placed it, since a saved scene has no live link back to the originating pack.
  • Also fixes a related pre-existing bug found while verifying this against a real ~800-entity scene: LOD level reloads fired as unbounded concurrent Tasks instead of going through the same bounded dispatcher base-mesh loads already use, which could hang reload entirely on scenes with many LOD entities.

Fixes #1326

Test plan

  • New SceneReloadPackLODTests (round-trips selectsByScreenSize/screenSizeRadius, multi-node LOD chain sync, and shared-build mesh identity across repeated placements, through save→destroy→reload)
  • Full UntoldEngineTests suite passes (1727 tests)
  • Full UntoldEngineRenderTests suite passes
  • Verified end-to-end against a real ~800-entity, LOD-chained .untoldpack scene cooked via the actual exporter CLI: reload went from hanging indefinitely to completing in ~3s with all entities restored

Saving and reloading a scene used to drop three things the pack loader
sets up at first load: shared GPU builds for repeated placements of a
model, the LOD chain of a multi-node model (so its parts switch level
together), and LODComponent.selectsByScreenSize/screenSizeRadius
(never serialized). Reload went through addLODLevel and the plain
mesh path instead of the pack loader.

- LODData now serializes selectsByScreenSize, screenSizeRadius, and
  levelsShareMaterials.
- deserializeScene shares one UntoldBuildCache across the whole
  reload, so repeated placements of the same .untold build once.
- A new packLODChain(forModelAt:) re-derives a multi-node model's LOD
  chain on reload by finding the .untoldpack that placed it, since a
  saved scene has no live link back to the originating pack.
- Also fixes a related pre-existing bug surfaced while testing this
  against a real scene: LOD level reloads fired as unbounded
  concurrent Tasks instead of going through the same bounded
  dispatcher base-mesh loads use, which could hang scenes with many
  LOD entities on reload.

Fixes #1326
@untoldengine
untoldengine merged commit 73ed6c5 into develop Oct 24, 2026
4 checks passed
@untoldengine
untoldengine deleted the issue/1326 branch October 24, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] A scene saved by the editor loses what the pack loader set up: shared builds, LOD chains, and the screen-size selection

1 participant