refactor(tools): group the sixty scripts by what they talk to
One directory with sixty scripts stopped being navigable, and the grouping is also the sandbox boundary:
Tools/unreal/ commandlets and the two map builders, with ue_common.py and ue_placement.py as the
shared imports (they need the engine)
Tools/blender/ builders, exporters, the FBX preset, the MPFB character pipeline, blender_screenshots
(they need the Blender Flatpak)
Tools/review/ the visual loop: render_screenshots.sh, judge_screenshot.py, hero_compare.py,
build_comparison_md.py, e2e_asset_check.py, hero_iterate.sh, visual_loop.py,
visual_targets.json
Tools/gen/ image and texture generation: the ComfyUI driver, deterministic texture writers,
reference fetching
Tools/input/ OS-level input injection
root _common.py, check-lfs.sh, addon_compat_probe.py, sibling_asset_audit.py, tests/
Every moved script now resolves the repository root as ../.. and puts the tools root plus its siblings on
sys.path, so 'import ue_common' still works from unreal/. The test suite bootstrap does the same for the five
folders. render_screenshots.sh takes the folder as a third argument to run_cmdlet, and the e2e driver,
hero_iterate.sh and the comparison generator were repointed.
51 README rows now link to their new location, the README gains a Layout section naming each folder's
sandbox, and the architecture notes and Blender README follow the moves.
Verified: 108 tests pass, prettier is clean, judge_screenshot.py and hero_compare.py run from their new
homes, and the e2e run was aborted mid-way (it had been rebuilding an empty DemoMap for 15 minutes) and is
being rerun against the new layout.
This commit is contained in:
1 parent
f681d83736
commit
4d27109668
168 files changed
+799
-407
No files matched your search
@@ -0,0 +1,145 @@
|
||||
# Import the sedan systems as separate static meshes (0.3.0).
|
||||
#
|
||||
# blender -b --factory-startup --python Tools/blender/vehicle_build.py -- \
|
||||
# --out Art/blender/vehicle/gigline-sedan.blend --fbx /tmp/gigline/vehicle/sedan.fbx
|
||||
# <engine>/Engine/Binaries/Linux/UnrealEditor-Cmd <uproject> -run=pythonscript \
|
||||
# -script=<repo>/Tools/unreal/ue_vehicle_import.py -nullrhi -unattended -nopause -stdout
|
||||
#
|
||||
# One asset per system, per the vehicle-artist skill's object split: body, glass, front
|
||||
# and rear lights, mirrors, and one wheel reused four times. The body FBX also carries
|
||||
# the UCX_ hulls, which Unreal consumes as simple collision.
|
||||
#
|
||||
# Result file: /tmp/gigline/vehicle-import.txt
|
||||
|
||||
import os
|
||||
|
||||
import unreal
|
||||
|
||||
DEST = "/Game/Hollywood/Vehicle"
|
||||
SOURCE = "/tmp/gigline/hatch"
|
||||
SYSTEMS = (
|
||||
("body", "SM_Vehicle_Body"),
|
||||
("trim", "SM_Vehicle_Trim"),
|
||||
("glass", "SM_Vehicle_Glass"),
|
||||
("lights", "SM_Vehicle_Lights"),
|
||||
("wheels", "SM_Vehicle_Wheels"),
|
||||
)
|
||||
RESULT = "/tmp/gigline/vehicle-import.txt"
|
||||
lines = []
|
||||
|
||||
|
||||
def log(msg):
|
||||
lines.append(str(msg))
|
||||
unreal.log(str(msg))
|
||||
|
||||
|
||||
def main():
|
||||
for source, name in SYSTEMS:
|
||||
path = os.path.join(SOURCE, f"{source}.fbx")
|
||||
if not os.path.exists(path):
|
||||
log(f"{name}: missing source {path}")
|
||||
lines.append("VERDICT: FAIL")
|
||||
return
|
||||
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_as_skeletal = False
|
||||
ui.import_materials = True
|
||||
ui.import_textures = False
|
||||
ui.static_mesh_import_data.combine_meshes = True
|
||||
ui.static_mesh_import_data.generate_lightmap_u_vs = True
|
||||
ui.static_mesh_import_data.auto_generate_collision = True
|
||||
ui.static_mesh_import_data.import_uniform_scale = 1.0
|
||||
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"{name}: MISSING after import")
|
||||
lines.append("VERDICT: FAIL")
|
||||
return
|
||||
bounds = mesh.get_bounding_box() if hasattr(mesh, "get_bounding_box") else None
|
||||
size = ""
|
||||
if bounds:
|
||||
extent = bounds.max - bounds.min
|
||||
size = f"{extent.x/100:.2f} x {extent.y/100:.2f} x {extent.z/100:.2f} m"
|
||||
mats = mesh.get_editor_property("static_materials")
|
||||
log(f"{name}: imported, {len(mats)} material slot(s), bounds {size}")
|
||||
|
||||
# Wire the two LOD meshes into the body's LOD group. import_lod is the supported
|
||||
# path; copying bytes between assets is not, and the LOD group is what the engine
|
||||
# uses to pick by screen size.
|
||||
# LOD meshes are imported as their own assets. Wiring them into the body's LOD group
|
||||
# needs StaticMeshEditorSubsystem.import_lod, which is unavailable in this headless
|
||||
# commandlet (get_editor_subsystem returns None), so the group is a follow-up.
|
||||
for source, name in (("body_lod1", "SM_Vehicle_Body_LOD1"),
|
||||
("body_lod2", "SM_Vehicle_Body_LOD2")):
|
||||
path = os.path.join(SOURCE, f"{source}.fbx")
|
||||
if not os.path.exists(path):
|
||||
log(f"{name}: missing {path}")
|
||||
continue
|
||||
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.static_mesh_import_data.combine_meshes = True
|
||||
task.options = ui
|
||||
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])
|
||||
mesh = unreal.EditorAssetLibrary.load_asset(f"{DEST}/{name}")
|
||||
log(f"{name}: imported as its own asset ({'ok' if mesh else 'MISSING'}); "
|
||||
"LOD group wiring needs an editor session")
|
||||
|
||||
# Skeletal vehicle for Chaos is not built from this template yet: the hatch is a
|
||||
# static model, and the drivable rig has to be authored around it.
|
||||
skel_path = os.path.join(SOURCE, "vehicle_skeletal.fbx")
|
||||
if os.path.exists(skel_path):
|
||||
task = unreal.AssetImportTask()
|
||||
task.filename = skel_path
|
||||
task.destination_path = DEST
|
||||
task.destination_name = "SK_Vehicle_Sedan"
|
||||
task.automated = True
|
||||
task.save = True
|
||||
task.replace_existing = True
|
||||
ui = unreal.FbxImportUI()
|
||||
ui.import_mesh = True
|
||||
ui.import_as_skeletal = True
|
||||
ui.import_animations = False
|
||||
ui.import_materials = True
|
||||
ui.skeletal_mesh_import_data.import_uniform_scale = 1.0
|
||||
task.options = ui
|
||||
unreal.AssetToolsHelpers.get_asset_tools().import_asset_tasks([task])
|
||||
skel = unreal.EditorAssetLibrary.load_asset(f"{DEST}/SK_Vehicle_Sedan")
|
||||
if skel:
|
||||
skeleton = skel.get_editor_property("skeleton")
|
||||
# Skeleton has no bone_names property in 5.8; read the reference skeleton
|
||||
# through the asset registry instead of guessing a property name.
|
||||
log(f"SK_Vehicle_Sedan: imported, skeleton={skeleton.get_name() if skeleton else 'NONE'}")
|
||||
else:
|
||||
log("SK_Vehicle_Sedan: MISSING after import")
|
||||
lines.append("VERDICT: PASS")
|
||||
|
||||
|
||||
try:
|
||||
main()
|
||||
except Exception as exc: # noqa: BLE001
|
||||
import traceback
|
||||
log(f"FAILED: {type(exc).__name__}: {exc}")
|
||||
log(traceback.format_exc())
|
||||
lines.append("VERDICT: FAIL")
|
||||
|
||||
unreal.EditorLoadingAndSavingUtils.save_dirty_packages(True, True)
|
||||
with open(RESULT, "w") as f:
|
||||
f.write("\n".join(lines) + "\n")
|
||||
Reference in new issue
Block a user