fix(materials): stop orphaning references; add a scene audit gate

The blockout cleaning pass found the map was rendering with 604 of 620 mesh actors
unmaterialed - every kit piece and all theatre trim.

Cause: ensure_material() deleted and recreated each /Game/Hollywood/Site/M_* asset on
every run, so actors staged by other tools kept references to deleted assets and fell
back to the default material. Nothing errored; the map looked merely slightly flat.

- Materials are now updated IN PLACE (load, delete_all_material_expressions, rebuild
  the graph, recompile, save). Material.expressions is protected from Python, so the
  editing library's deleter is used.
- 53 duplicated kit actor labels fixed (both shop piers of a bay shared one name).
- New Tools/ue_audit_scene.py gates the scene: every mesh actor has a material, every
  verified frontage span is within +/-1 m (via ue_placement), no duplicate labels.
- render_screenshots.sh now runs the chain in the required order (demo map -> kit ->
  theatre -> audit -> cameras -> capture) and exits non-zero on an audit failure,
  because the demo builder rebuilds materials and later staging must follow it.

Scene audit: 0 failures. Packaged QA PASS. Spawn-view reference score 0.72.
This commit is contained in:
zwitschi committed 2026-11-08 22:48:00 +01:00
1 parent 442d0f3d73
commit 600633cd5b
35 files changed
+226 -55

No files matched your search

+21
View File
@@ -487,3 +487,24 @@ Scope: facts and traps that cost time to establish. Planned work lives in [TODO.
twice on a clean run. Always count instances before believing a perf number.
- Series committed at `Docs/perf/0.1.5-kit-walk-frametimes.csv`; comparison table in
`Docs/release-checks.md`.
## 2026-11-09 — 604 unmaterialed actors: material rebuild was delete+recreate
- The "blockout cleaning pass" turned out to need **material and placement hygiene,
not more geometry**. `Tools/ue_audit_scene.py` (new) found **604 of 620 mesh actors
with no material**: kit pieces and theatre trim all untextured.
- **Cause:** `ensure_material` in `ue_build_demo_map.py` deleted and recreated each
`/Game/Hollywood/Site/M_*` asset every run ("so a look change cannot be masked by a
stale asset"). That orphane every reference: actors staged by other tools pointed at
deleted assets and fell back to the default material. The map looked only *slightly*
flat — no error, no warning.
- **Fix:** update the material **in place** — load it, `MaterialEditingLibrary.
delete_all_material_expressions(mat)`, rebuild the graph, recompile, save. Note
`Material.expressions` is protected from Python; use the library's deleter.
- **Ordering rule now documented and enforced:** the demo builder rebuilds materials,
so kit and theatre staging must run *after* it. `render_screenshots.sh` now runs
demo map → kit assembly → theatre trim → scene audit → shot cameras → capture, and
**fails on a non-zero audit count**.
- Second find: 53 duplicated kit labels (both shop piers of a bay shared one name).
- Scene audit after the fixes: **0 failures** (all materialed, all spans verified, no
duplicate labels). Packaged QA still PASS; spawn-view reference score 0.72.