fix(tools): make the e2e chain actually run after the move, and record what it found
The e2e asset check now completes: PASS on all six steps - empty maps 9 s, demo build 10 s, review build 9 s, captures 80 s, judge 388 s, review file. Four breakages from the folder move had to be fixed first: - ue_placement and ue_common are siblings of the scripts that import them, but the rewrite put only the tools root on sys.path, so every Unreal commandlet died with ModuleNotFoundError. Both paths are inserted now. - render_screenshots.sh resolved the repository root one level up, so commandlet paths became Tools/Tools/... and the capture step failed in 0 s. - the driver treated a result file left by an earlier run as success, which is how a ten-second 'demo build' passed without building. Result files are unlinked before each step and child output streams to a per-step log file rather than a pipe. - two editors on one project hang instead of failing, so the driver refuses to start while one is running. Also corrects ue_recreate_maps.py: LevelEditorSubsystem.new_level() refuses a path whose package is still in memory and delete_asset() leaves the file on disk, measured create->delete->create returning False. The step now loads each map, destroys every actor, saves, and reports the count it left (0), which is the property the builders actually need. Open question recorded in TODO.md: the rebuilt map holds 409 actors and 613 KB against 600 and 886 KB before, and the ~190 missing ones look like the facade-kit and theatre-trim placements that run as separate steps.
This commit is contained in:
1 parent
24f1e682fe
commit
dbb42322ff
136 files changed
+279
-199
No files matched your search
@@ -1,16 +1,23 @@
|
||||
"""Rebuild both Unreal maps from an empty level, deleting whatever was there before.
|
||||
"""Empty both Unreal maps before a build, and verify they really are empty.
|
||||
|
||||
<engine>/UnrealEditor-Cmd <uproject> -run=pythonscript \
|
||||
-script=<repo>/Tools/unreal/ue_recreate_maps.py -nullrhi -unattended -nopause -stdout
|
||||
|
||||
Why: `Tools/unreal/ue_build_demo_map.py` and `Tools/unreal/ue_build_review_map.py` load the existing map and destroy the
|
||||
actors they know about. Anything else that accumulated - an actor from an experiment, a material override, a
|
||||
stale world setting - survives every rebuild, which is how a stale road mesh and a duplicated vehicle actor
|
||||
both got saved back into the map. Deleting the `.umap` and creating an empty level makes every run start from
|
||||
the same place.
|
||||
Why this does not delete the `.umap` files: `LevelEditorSubsystem.new_level()` refuses a path whose
|
||||
package is still in memory, and `EditorAssetLibrary.delete_asset()` leaves the file on disk with the package
|
||||
still registered, so deleting and recreating in one session always returns False. Measured:
|
||||
|
||||
The umap files are LFS-tracked and check out read-only, so chmod comes first; and a level cannot be deleted
|
||||
while it is the one the editor has open, so a scratch level is created to release it.
|
||||
new_level fresh -> True
|
||||
delete_asset -> True
|
||||
disk file still present -> True
|
||||
new_level again -> False
|
||||
|
||||
What does work, and is what the maps actually need, is clearing every actor and saving: the builders stage
|
||||
everything they use, so a level with no actors is the blank slate. Anything an experiment left behind - an
|
||||
actor from a probe, a duplicated vehicle, a stale shot camera - is gone, which is the failure this step
|
||||
exists to prevent.
|
||||
|
||||
Both maps are emptied and saved, and the script reports the actor count it left behind.
|
||||
|
||||
Result: /tmp/gigline/recreate-maps.txt
|
||||
"""
|
||||
@@ -20,7 +27,6 @@ import os
|
||||
import unreal
|
||||
|
||||
MAPS = ("/Game/Hollywood/DemoMap", "/Game/Test/ReviewMap")
|
||||
SCRATCH = "/Game/Test/_RecreateScratch"
|
||||
RESULT = "/tmp/gigline/recreate-maps.txt"
|
||||
lines = []
|
||||
|
||||
@@ -31,7 +37,7 @@ def log(message):
|
||||
|
||||
|
||||
def make_writable(path):
|
||||
"""A .umap under Content/ that is read-only cannot be deleted; LFS checks it out that way."""
|
||||
"""A .umap under Content/ that is read-only cannot be saved; LFS checks it out that way."""
|
||||
disk = os.path.join(unreal.Paths.project_content_dir(),
|
||||
path.replace("/Game/", "") + ".umap")
|
||||
try:
|
||||
@@ -45,33 +51,25 @@ def make_writable(path):
|
||||
|
||||
def main():
|
||||
les = unreal.get_editor_subsystem(unreal.LevelEditorSubsystem)
|
||||
scratch_made = False
|
||||
for path in MAPS:
|
||||
make_writable(path)
|
||||
current = unreal.EditorLevelLibrary.get_editor_world()
|
||||
current_path = current.get_path_name().split(".")[0] if current else ""
|
||||
if path == current_path:
|
||||
# The editor cannot delete the map it has open: park it on a scratch level first.
|
||||
if not scratch_made:
|
||||
les.new_level(SCRATCH)
|
||||
scratch_made = True
|
||||
else:
|
||||
les.load_level(SCRATCH)
|
||||
log(f"{path}: released by switching to {SCRATCH}")
|
||||
if unreal.EditorAssetLibrary.does_asset_exist(path):
|
||||
if unreal.EditorAssetLibrary.delete_asset(path):
|
||||
log(f"{path}: deleted")
|
||||
else:
|
||||
log(f"{path}: could not delete")
|
||||
if les.new_level(path):
|
||||
log(f"{path}: created empty")
|
||||
else:
|
||||
log(f"{path}: FAILED to create")
|
||||
if unreal.EditorAssetLibrary.does_asset_exist(SCRATCH):
|
||||
unreal.EditorAssetLibrary.delete_asset(SCRATCH)
|
||||
ok = all(f"{path}: created empty" in line for path in MAPS for line in lines)
|
||||
lines.append(f"VERDICT: {'PASS' if ok else 'FAIL'}")
|
||||
log(f"recreate {'ok' if ok else 'FAILED'}")
|
||||
if not les.load_level(path):
|
||||
log(f"{path}: could not load, and new_level cannot replace an in-memory package")
|
||||
continue
|
||||
removed = 0
|
||||
for actor in list(unreal.EditorLevelLibrary.get_all_level_actors()):
|
||||
try:
|
||||
unreal.EditorLevelLibrary.destroy_actor(actor)
|
||||
removed += 1
|
||||
except Exception: # noqa: BLE001
|
||||
pass
|
||||
left = len(unreal.EditorLevelLibrary.get_all_level_actors())
|
||||
saved = unreal.EditorLoadingAndSavingUtils.save_map(
|
||||
unreal.EditorLevelLibrary.get_editor_world(), path)
|
||||
log(f"{path}: cleared {removed} actors, {left} left, save_map {saved}")
|
||||
empty = all(" 0 left" in line for line in lines)
|
||||
lines.append(f"VERDICT: {'PASS' if empty else 'FAIL'}")
|
||||
log(f"maps emptied: {'yes' if empty else 'no'}")
|
||||
|
||||
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user