2.4 KiB
Design
Architecture
building.py will join the bpy-layer feature modules under
blender/osmassets/. It may import MeshBatch, add_roof,
add_wall_panel, and make_prism from osmassets.mesh, plus
parse_height from osmassets.osm.
The module will expose:
def assemble(ring, way_id, tag, office_overrides, collection, materials):
...
The function returns:
(added, industrial_added, ring_pts)
This keeps generate_scene.py's count and focus-point handling unchanged while
removing building geometry construction from the entry script.
Boundaries
generate_scene.pykeeps CLI parsing, OSM way dispatch, material creation, count accumulation, focus-point accumulation, scene custom properties, and stdout markers.building.pyowns only building object creation and building-specific facade details for a ring that has already been projected.building.pyis a bpy-layer module. It must not be imported by pure Python modules or pure unit tests.catalog.pyremains the material declaration source; no material entries or order change in this task.
Data Flow
generate_scene.pyparsesargs["office_overrides"]into a set.generate_scene.pycreatesbuilding_matsfromcatalog.MATERIALS.- OSM ways are projected to local-meter rings in
generate_scene.py. - For ways with a
buildingtag and at least three ring points,building.assemble(ring, str(way["id"]), tag, args["office_overrides"], buildings_c, building_mats)creates the prism, roof, windows, custom properties, and bevel. generate_scene.pyupdatescounts["building_count"],counts["industrial_count"], andfocus_pointsfrom the return tuple.
Compatibility
The move must preserve object names, mesh names, material assignments, bevel
modifier fields, custom properties, window-band geometry, and return values.
Cesium export consumes the resulting .blend, so parity should see no
non-ignored contract difference.
Trade-Offs
The office_overrides set is passed into building.assemble() rather than
passing the whole args dict. This narrows the module contract while preserving
behavior. A full feature registry remains deferred until building and roads are
both isolated enough to compare safely.
Rollback
Rollback is mechanical: move assemble() and its helper back into
generate_scene.py, restore direct calls, remove the building.py import, and
delete the module.