Models the two retail buildings beside the hero from their own photograph rather than the generic kit: bronze cornice, mural row, lettering band, stepped Deco parapet and rounded corner tower on 6800 Lee Drug; burgundy fascia, pilasters, white-framed windows and banded parapet on 6806-6820. Reference analysis written before any geometry (Art/blender/retail/ref-analysis.md), every unmeasured proportion carried into the part report as an assumption. 6822 Budget is deferred, not guessed: no photograph of it exists and the 6.0 x 5.5 m sliver cannot be read out of the neighbour shot. Pipeline fixes found on the way: - render_screenshots.sh called ./Engine/... for the capture step while every commandlet used the absolute path; set -e killed the script at 127 *after* the maps were rebuilt, so screenshots silently stayed a day old. - the facade kit applies to every Frontage_*/North_* actor, so it pasted its own language over the new modelled facades; it now skips them, and the trim stages as RetailTrim_*. - pure bay arithmetic moved to Tools/_common.py so it is unit-testable without Blender (4 new tests, 82 total pass). Known gaps recorded in Screenshots/README.md, not hidden: the parapet reads as a blank band, murals and lettering do not resolve at review distance, the tower is a plain cylinder, and the review camera crops the east end.
95 lines
3.1 KiB
Python
95 lines
3.1 KiB
Python
# Import the retail frontage trim (6800 Lee Drug, 6806–6820) into Unreal.
|
||
#
|
||
# blender -b --factory-startup --python Tools/retail_frontage_build.py -- \
|
||
# --out /tmp/gigline/retail --report /tmp/gigline/retail-report.json
|
||
# <engine>/Engine/Binaries/Linux/UnrealEditor-Cmd <uproject> -run=pythonscript \
|
||
# -script=<repo>/Tools/ue_import_retail_detail.py -nullrhi -unattended -nopause -stdout
|
||
#
|
||
# Two meshes arrive, one per building, each already at its world position in the
|
||
# project frame (the FBX carries the offset), so staging spawns at the origin.
|
||
# Destination: /Game/Hollywood/Frontage/<name> — same folder as the block frontage
|
||
# so the demo builder stages them together.
|
||
#
|
||
# Result file: /tmp/gigline/retail-import.txt
|
||
|
||
import glob
|
||
import os
|
||
|
||
import unreal
|
||
|
||
SRC = "/tmp/gigline/retail"
|
||
DEST = "/Game/Hollywood/Frontage"
|
||
RESULT = "/tmp/gigline/retail-import.txt"
|
||
lines = []
|
||
|
||
|
||
def log(msg):
|
||
lines.append(str(msg))
|
||
unreal.log(str(msg))
|
||
|
||
|
||
def import_fbx(path, name):
|
||
task = unreal.AssetImportTask()
|
||
task.filename = path
|
||
task.destination_path = DEST
|
||
task.destination_name = name
|
||
task.automated = True
|
||
task.save = True
|
||
task.replace_existing = True
|
||
|
||
ui = unreal.FbxImportUI()
|
||
ui.import_mesh = True
|
||
ui.import_materials = True
|
||
ui.import_textures = False
|
||
ui.import_as_skeletal = False
|
||
smd = ui.static_mesh_import_data
|
||
smd.import_uniform_scale = 1.0
|
||
smd.combine_meshes = True
|
||
smd.convert_scene_unit = False
|
||
smd.force_front_x_axis = False
|
||
smd.normal_import_method = unreal.FBXNormalImportMethod.FBXNIM_IMPORT_NORMALS
|
||
task.options = ui
|
||
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])
|
||
|
||
mesh = unreal.EditorAssetLibrary.load_asset(f"{DEST}/{name}")
|
||
if mesh is None:
|
||
log(f"MISSING after import: {DEST}/{name}")
|
||
return None
|
||
|
||
# Trim is decoration on a solid the player already collides with: no collision
|
||
# of its own, otherwise the cornice and mullions become snag points.
|
||
try:
|
||
body = mesh.get_editor_property("body_setup")
|
||
body.set_editor_property("collision_trace_flag",
|
||
unreal.CollisionTraceFlag.CTF_USE_COMPLEX_AS_SIMPLE)
|
||
mesh.set_editor_property("body_setup", body)
|
||
except Exception as exc: # noqa: BLE001
|
||
log(f"{name}: collision flag not set ({exc!r})")
|
||
|
||
box = mesh.get_bounding_box()
|
||
mn, mx = box.min, box.max
|
||
log(f"{name:22} X {mn.x:8.0f}..{mx.x:8.0f} Y {mn.y:7.0f}..{mx.y:7.0f} "
|
||
f"Z {mn.z:5.0f}..{mx.z:5.0f} slots {len(mesh.get_editor_property('static_materials'))}")
|
||
return mesh
|
||
|
||
|
||
def main():
|
||
files = sorted(glob.glob(os.path.join(SRC, "*.fbx")))
|
||
if not files:
|
||
log(f"no FBX in {SRC}; run Tools/retail_frontage_build.py first")
|
||
return
|
||
for path in files:
|
||
import_fbx(path, os.path.splitext(os.path.basename(path))[0])
|
||
unreal.EditorLoadingAndSavingUtils.save_dirty_packages(True, True)
|
||
|
||
|
||
try:
|
||
main()
|
||
except Exception as exc: # noqa: BLE001
|
||
import traceback
|
||
log(f"FAILED: {type(exc).__name__}: {exc}")
|
||
log(traceback.format_exc())
|
||
|
||
with open(RESULT, "w") as f:
|
||
f.write("\n".join(lines) + "\n")
|