refactor(tools): one FBX export preset instead of six copies

The bpy.ops.export_scene.fbx argument block was duplicated in six scripts (hero,
block frontage, north buildings, site, scale test, MPFB character) and all six
carried mesh_smooth_type="OFF", which drops smoothing groups and made every
Unreal import warn and every round part faceted.

Tools/fbx_export_preset.py now owns the presets:
- preset_kwargs(preset, selection, **overrides) is bpy-free and unit-tested;
- export_static()/export_character() are thin wrappers that import bpy lazily;
- ue_metric_v1 and ue_character_v1 keep the recorded scale contract
  (FBX_SCALE_NONE, apply_unit_scale, -Y forward / Z up) and use FACE smoothing.

Callers switched: hero_facade_build, export_block_frontage, export_north_buildings,
scale_test_export, mpfb_character_export, Art/blender/site/export_site_fbx.

Verified by re-exporting every asset through the preset and re-importing all of
them: 0 smoothing warnings on site, frontage and north buildings; packaging and
-qaselftest all PASS (walk, transect 0 holes, wall probe 0/35, facade probe 0/9).
49 tool tests pass (9 new for the preset contract).
This commit is contained in:
zwitschi committed 2026-11-08 18:00:59 +01:00
1 parent 160e9144f9
commit 286d9f6479
49 files changed
+283 -158

No files matched your search

+23
View File
@@ -460,3 +460,26 @@ Scope: facts and traps that cost time to establish. Planned work lives in [TODO.
- Probe expectations must mirror the staged buildings: the facade probe now carries
explicit X spans per frontage (and the TCL/Tussaud's spans on the north side) so
a gap between buildings is not reported as a defect.
## 2026-11-09 — one FBX export preset instead of six copies
- The `bpy.ops.export_scene.fbx(...)` argument block was duplicated in six scripts
(hero, block frontage, north buildings, site, scale test, MPFB character), and
all six carried `mesh_smooth_type="OFF"` — hence the "No smoothing group
information was found" warning on every import.
- Now `Tools/fbx_export_preset.py` holds `ue_metric_v1` and `ue_character_v1`:
`preset_kwargs()` (bpy-free, unit-tested) plus `export_static()` /
`export_character()` wrappers that import `bpy` lazily. Every caller imports it
and passes `selection=True/False`; the seven duplicated blocks are gone.
- Callers in `Tools/` resolve the module with
`sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))`; the Blender-side
`Art/blender/site/export_site_fbx.py` computes the repo root
(`..`, `..`, `..`) and joins `Tools`. Getting that wrong silently inserts
`Tools/Tools` — check the import path when adding a caller.
- Verified end to end: scale test, hero, frontage (6/6), site (7/7) and north
buildings all re-exported through the preset, re-imported with **0 smoothing
warnings**, DemoMap rebuilt and `-qaselftest` all PASS (walk, transect 0 holes,
wall probe 0/35, facade probe 0/9).
- `mpfb_character_export.py` was not re-run: it needs the MPFB add-on on
`BLENDER_USER_SCRIPTS` ("Add-on not loaded: bl_ext.blender_org.mpfb"), which is
pre-existing and unrelated; the character is not in `0.1.x` gameplay.