Campus pipeline hardening: backend parity, wall union, mullion grids, Draco tooling
Sandbox round (Linux): - detect_sheet_frames.py: multi-frame sheet splitter (column AND row layouts), grid-vote per-floor offsets, section-elevation harvesting for storey heights - dwg_dump_json.mjs + dwgjson_to_dxf.py: WASM libredwg DWG->DXF fallback (blocks/INSERT preserved, ATTRIB->TEXT so axis labels survive) - assemble_campus.py: manifest-driven campus assembly with mandatory neighbour-gap gate (overlap = exit 3, 0.1-0.3m flagged as expansion joints) - site_context_from_dump.py: site-context floors (ground/roads/parking/ fence/trees/context massings) from site-plan dumps - write_offline_viewer.py + assets/offline-viewer-libs/: fully-offline single-file viewer (vendored three r147 + pako, gzip-embedded GLB) - audit: clip-scoped coverage figures; report: multi_frame_sheet warning; audit gate floors_aligned catches the diagonal-staircase failure mode Mac round: - build_blender_showcase.py now honors slab_bounds_fallback and prefers footprint polygons for generated roofs (bounds rects made roof plates jut past the facade and buried campuses under full-extent slabs); contract now matches spec_to_glb.py exactly - merge_wall_solids (default off) in BOTH backends: shapely union in spec_to_glb.py, native delaunay_2d_cdt union in Blender; endpoint-shared wall ends pre-extended w/2 so L-corners close seamlessly (flat caps leave a notch a union alone cannot fill) while openings stay flat - glazing_mullions (default off): curtain-wall panel grid (verticals every glazing_panel_w + floor-line transoms) as pseudo wall segments in the <floor>__walls node; glass pane kept - build_showcase_variants.py keeps source_file=="site" floors intact in all variants (roads/trees live on filtered categories) - web template: instanced low-poly trees from metadata site_trees, grade-level shadow catcher (was at basement depth), data-URI favicon - tools/compress.mjs deps pinned (package.json); 15MB campus GLB -> 0.57MB - tests: 24 -> 52 checks (wall union, mullions, byte-identical defaults) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -121,7 +121,30 @@ def inferred_metadata(args_metadata: str | None, manifest_path: Path | None, man
|
||||
return resolve_manifest_path(manifest_path, metadata_value) if manifest_path else Path(metadata_value)
|
||||
|
||||
|
||||
def write_assets(glb: Path, metadata: Path, out_dir: Path, web_variants: list[dict]):
|
||||
def site_trees_from_spec(spec_path: Path | None) -> list[list[float]]:
|
||||
"""Tree anchor points (plan meters) for the viewer's instanced low-poly trees.
|
||||
|
||||
site_context_from_dump.py emits street trees as short posts under the
|
||||
custom `trees` category; the viewer hides those posts and renders
|
||||
trunk+crown InstancedMeshes at these midpoints instead.
|
||||
"""
|
||||
if not spec_path or not spec_path.exists():
|
||||
return []
|
||||
try:
|
||||
spec = json.loads(spec_path.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError):
|
||||
return []
|
||||
trees = []
|
||||
for floor in spec.get("floors", {}).values():
|
||||
for seg in floor.get("segments", {}).get("trees", []):
|
||||
trees.append([
|
||||
round((seg["start"][0] + seg["end"][0]) / 2, 2),
|
||||
round((seg["start"][1] + seg["end"][1]) / 2, 2),
|
||||
])
|
||||
return trees
|
||||
|
||||
|
||||
def write_assets(glb: Path, metadata: Path, out_dir: Path, web_variants: list[dict], site_trees: list[list[float]]):
|
||||
if not glb.exists():
|
||||
raise SystemExit(f"GLB not found: {glb}")
|
||||
if not metadata.exists():
|
||||
@@ -131,6 +154,8 @@ def write_assets(glb: Path, metadata: Path, out_dir: Path, web_variants: list[di
|
||||
meta.setdefault("files", {})["glb"] = "model.glb"
|
||||
if web_variants:
|
||||
meta["model_variants"] = web_variants
|
||||
if site_trees:
|
||||
meta["site_trees"] = site_trees
|
||||
(out_dir / "model_metadata.json").write_text(
|
||||
json.dumps(meta, ensure_ascii=False, indent=2),
|
||||
encoding="utf-8",
|
||||
@@ -148,7 +173,10 @@ def main() -> int:
|
||||
web_variants = copy_variant_assets(manifest_path, variants, out_dir)
|
||||
glb = inferred_default_glb(args.glb, manifest_path, manifest, variants)
|
||||
metadata = inferred_metadata(args.metadata, manifest_path, manifest, variants)
|
||||
write_assets(glb, metadata, out_dir, web_variants)
|
||||
variant = default_variant(manifest, variants)
|
||||
spec_value = variant.get("spec") if variant else None
|
||||
spec_path = resolve_manifest_path(manifest_path, spec_value) if (manifest_path and spec_value) else None
|
||||
write_assets(glb, metadata, out_dir, web_variants, site_trees_from_spec(spec_path))
|
||||
print(json.dumps({"web_dir": str(out_dir), "entry": str(out_dir / "index.html")}, ensure_ascii=False))
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user