4.0 KiB
4.0 KiB
Extract building module
Goal
Move building assembly out of blender/generate_scene.py into a dedicated
bpy-layer module, keeping generated .blend / .glb / metadata structure
unchanged. This continues the documented P2 feature-module direction after
fountain.py.
Background
.trellis/spec/guides/artifact-parity-guide.mdrecords P2 as partial:water.py,grass.py,scrub.py,tree.py, andfountain.pyare already split out, whilebuildingandroadsstill live ingenerate_scene.py.blender/generate_scene.py:72defines_assemble_building().blender/generate_scene.py:179definesadd_building_details(), which creates office / industrial window bands withMeshBatchandadd_wall_panel().blender/generate_scene.py:789dispatches OSM ways with abuildingtag, incrementscounts["building_count"]andcounts["industrial_count"], and extendsfocus_pointswith the returned ring.blender/generate_scene.py:710createsbuilding_matsfrom the existingcatalog.MATERIALS["building_" + key]entries.blender/generate_scene.py:910persistsoffice_override_way_idsas a scene custom property fromargs["office_overrides"].
Requirements
- Add a new bpy-layer module at
blender/osmassets/building.py. - Move the current building assembly behavior into the new module:
_assemble_building()add_building_details()
- Expose an
assemble(...)function from the new module that returns the same tuple shape currently returned by_assemble_building():(added, industrial_added, ring_pts). - Keep
generate_scene.pyresponsible for:- parsing
--office-overrides; - creating
building_mats; - filtering OSM ways with a
buildingtag andlen(ring) >= 3; - updating
building_count,industrial_count, andfocus_points; - writing
scene["office_override_way_ids"]; - writing the existing
SCENE_DONEJSON shape.
- parsing
- Preserve existing building object names and mesh names:
Building_<way_id>Building_<way_id>_RoofBuilding_<way_id>_Windows
- Preserve existing building custom properties:
osm_heightrender_heightbuilding_kindosm_building_tagoffice_override
- Preserve current height rules:
- industrial buildings use the parsed source height;
- non-industrial buildings under 30m render at 11.4m;
- source height has a 3.0m floor and
parse_height(tag, 12.0)default.
- Preserve current facade behavior:
- industrial buildings use one high horizontal band;
- office buildings use floor-based window bands;
- bevel modifier name, width, and segment count stay unchanged.
- Do not introduce a full
features/registry in this task. - Do not modify roads, material definitions,
MATERIALSorder,ROAD_LAYERSorder, stdout markers, parity ignore lists, or known unrelated defects D1-D3.
Acceptance Criteria
blender/osmassets/building.pycontains building assembly behavior and imports only bpy-layer-safe dependencies.blender/generate_scene.pyimports and calls the new building module; no inline_assemble_building()oradd_building_details()remains there.- Building counts, industrial counts, focus point behavior, scene custom
properties, and
SCENE_DONEJSON keys remain unchanged. python3 -m py_compile blender/osmassets/building.pypasses.python3 -m py_compile blender/generate_scene.pypasses.python3 -m unittest blender/tests/test_pure.pypasses.- A before/after parity comparison is run for the Blender/Cesium stages and any non-ignored diff is either absent or explicitly explained as expected. For this refactor, the expected result is no contract diff.
Out Of Scope
- Full feature registry implementation.
- Road extraction.
- Building visual redesign.
- Building material or Cesium export contract changes.
- Moving CLI parsing or
office_override_way_idsscene metadata out ofgenerate_scene.py. - Changing geometry helper APIs in
osmassets.mesh.
Open Questions
None.