Files
gig-line/Tools/export_north_buildings.py
T
zwitschi fee26ade10 frontage: south block frontage, plus the placement bug it exposed
Adds the five remaining verified south-side buildings to the demo block
(6922, 6902, 6838 El Capitan Theatre, 6822 Budget, 6806-6820, 6800 Lee Drug),
exported in place from the OSM blockout by Tools/export_block_frontage.py,
imported to /Game/Hollywood/Frontage/ and staged by the demo builder with the
look material set (stone for the theatres, stucco for the retail run).

Adding neighbours exposed a pre-existing placement bug that was invisible while
the hero facade stood alone in an empty field:

- UE south is +Y here (south sidewalk Y +718..+1447), but the hero sat at
  Y -1450 on the NORTH side of the street.
- It was also at X -12024..-9420, 26 m east of the 6840 footprint; the frontage
  gap between 6902 and 6838 is X -14591..-12082.
- The two north-side buildings were on the SOUTH side, because their exporter
  mirrored Y.

Fixes: hero moved to X -13336 / Y +1307, inside its frontage gap; the frontage
and north-building exporters no longer apply a Y mirror (the FBX preset already
lands Blender -Y south on UE +Y south); player start and demo cameras moved to
the north sidewalk looking south; sun raised to pitch -62 so both frontages read
instead of the north side silhouetting.

Result: the demo is a street - continuous south frontage with the hero in it,
both sidewalks, the road with the designated crossing, and the north-side
buildings across the road.

Screenshots re-rendered and approved by the owner.

Squash of branch frontage-block-0.1.0 (PR #6).
2026-11-08 09:20:11 +01:00

76 lines
2.8 KiB
Python

# Export the two in-scope north-side background buildings from the OSM blockout.
#
# blender -b --factory-startup Art/blender/blockout/blockout-2026-11-06.blend \
# --python Tools/export_north_buildings.py -- --out /tmp/gigline/north
#
# The blockout is already in the shared project frame (metres, X east / Y north /
# Z up, origin Hollywood x Highland), so exporting each object at its own world
# position preserves the offset from the hero facade. The site export preset
# (`ue_metric_v1`) is reused verbatim so the metre->centimetre mapping matches.
import argparse
import os
import sys
import bpy
BUILDINGS = ("TCL Chinese Theatre", "Madame Tussaud's")
def main():
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
ap = argparse.ArgumentParser()
ap.add_argument("--out", default="/tmp/gigline/north")
args = ap.parse_args(argv)
os.makedirs(args.out, exist_ok=True)
print(f"[north] scene objects: {len(bpy.data.objects)}")
for name in BUILDINGS:
obj = bpy.data.objects.get(name)
if obj is None or obj.type != "MESH":
print(f"[north] MISSING {name}")
continue
bpy.ops.object.select_all(action="DESELECT")
obj.select_set(True)
bpy.context.view_layer.objects.active = obj
mesh = obj.data
if not mesh.materials:
mat = bpy.data.materials.new(f"M_{name.replace(' ', '_')}")
mat.diffuse_color = (0.75, 0.72, 0.68, 1.0)
mat.use_nodes = False
mesh.materials.append(mat)
# No copy and no Y mirror: the FBX preset already lands Blender +Y
# (north) on Unreal -Y, and UE north is -Y here (north sidewalk
# Y -1912..-1053). The old mirror put both buildings on the south side.
new_obj = obj
new_mesh = mesh
bpy.ops.object.select_all(action="DESELECT")
new_obj.select_set(True)
bpy.context.view_layer.objects.active = new_obj
path = os.path.join(args.out, name.replace(" ", "_").replace("'", "") + ".fbx")
bpy.ops.export_scene.fbx(
filepath=path,
use_selection=True,
object_types={"MESH"},
apply_unit_scale=True,
apply_scale_options="FBX_SCALE_NONE",
axis_forward="-Y",
axis_up="Z",
use_space_transform=True,
use_mesh_modifiers=True,
mesh_smooth_type="OFF",
path_mode="AUTO",
bake_space_transform=False,
)
world = new_obj.matrix_world
zs = [(world @ v.co).z for v in new_mesh.vertices]
print(f"[north] {name:22} verts {len(new_mesh.vertices):5} z {min(zs):+.2f}..{max(zs):+.2f} m "
f"-> {path}")
bpy.data.objects.remove(new_obj, do_unlink=True)
print(f"[north] done")
main()