Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(verse): add the art pipeline entry points and a green fbx-ue/1 calibration (#1124)

Ruben Lütke68852d3c4712
diff --git a/docs/verse/unreal/contracts/art-pipeline.md b/docs/verse/unreal/contracts/art-pipeline.md
index 956970934e..5b204ee884 100644
--- a/docs/verse/unreal/contracts/art-pipeline.md
+++ b/docs/verse/unreal/contracts/art-pipeline.md
@@ -493,7 +493,8 @@ repo root gets `.lfsconfig` with `[lfs] fetchexclude = unreal/**`
| `budget_override` | `{field, value, reason, approved_by}`; only the integration owner approves |
`check_art_text.py` fails when a `.uasset` under `Content/Verse/` has no
-record, a record has no asset, a name breaks section 3, or a cap below is
+record (test placeholders under `Content/Verse/Test/` are built by editor code
+and need none), a record has no asset, a name breaks section 3, or a cap below is
exceeded according to the record.
### 10.4 Size budgets
diff --git a/scripts/unreal/check_art_text.py b/scripts/unreal/check_art_text.py
index db9d0c7285..649d0432f4 100644
--- a/scripts/unreal/check_art_text.py
+++ b/scripts/unreal/check_art_text.py
@@ -12,7 +12,8 @@ Runs in the `unreal-static` lane and in `scripts/ci/run_gates.py`. It fails on:
for their content folder (section 9);
* MI recipes (`Art/Materials/MI_*.mi.json`) that break `verse.mi/1` or use a
banned colour (section 8.3);
-* a `.uasset` of an imported kind under `Content/Verse/` with no record, any
+* a `.uasset` of an imported kind under `Content/Verse/` with no record (test
+ placeholders under `Content/Verse/Test/` are built in the editor and exempt), any
asset name outside section 3, engine sample content (section 11), and
banned folder names under `unreal/` and `art/verse/` (section 10.1);
* a `space_vectors.json` that disagrees with `art/verse/lib/ue_space.py`.
@@ -65,6 +66,10 @@ KIND_NAMES = {
#: Prefixes whose assets come from an import record (a .uasset needs one).
IMPORTED_PREFIXES = ("SM_", "SK_", "SKEL_", "PHYS_", "A_", "T_", "GC_")
+#: Folders whose assets are built inside the editor by test code (the G0 test human,
+#: per-package placeholders), not imported from an export: no import record needed.
+EDITOR_BUILT_FOLDERS = ("/Game/Verse/Test/",)
+
#: Triangle caps of section 6.2, first matching rule wins: (path prefix, name test, cap).
TRIANGLE_CAPS: tuple[tuple[str, str, int], ...] = (
("/Game/Verse/Kit/Architecture/", "", 500_000),
@@ -108,9 +113,6 @@ FOLDER_OWNERS: tuple[tuple[str, str], ...] = (
("/Game/Verse/Audio/", "WP19"),
)
_TEST_FOLDER = re.compile(r"^/Game/Verse/Test/(WP\d{2})/")
-#: G0 fixtures built in the editor by scripts/unreal/g0_content.py (G0.9 SK_Test_Human and its
-#: skeleton and physics asset), not by the art pipeline: they carry no import record.
-G0_GENERATED = "/Game/Verse/Test/G0/"
#: Folder names that may not appear under unreal/ or art/verse/ (section 10.1).
BANNED_FOLDERS = {
@@ -413,9 +415,10 @@ class Checker:
on_disk.add(object_path)
for error in name_errors(name):
self.fail(path, error)
- generated = object_path.startswith(G0_GENERATED)
- imported = name.startswith(IMPORTED_PREFIXES) and not generated
- if path.suffix == ".uasset" and imported:
+ needs_record = name.startswith(IMPORTED_PREFIXES) and not object_path.startswith(
+ EDITOR_BUILT_FOLDERS
+ )
+ if path.suffix == ".uasset" and needs_record:
if object_path not in records:
self.fail(path, "no import record in unreal/Verse/Art/Import/")
if ENGINE_CONTENT.search(object_path):
diff --git a/scripts/unreal/import_art.py b/scripts/unreal/import_art.py
index c578b27d55..f30043d6d9 100644
--- a/scripts/unreal/import_art.py
+++ b/scripts/unreal/import_art.py
@@ -57,14 +57,26 @@ def editor_cmd() -> Path:
return engine_root() / "Engine" / "Binaries" / platform / exe
-def command_line(log: Path) -> list[str]:
+#: Commands that spawn actors. The editor places a new actor through the level viewport, which
+#: divides by its size and crashes without an RHI (UE 5.7.1, measured); these run on the GPU
+#: with the window offscreen instead of `-nullrhi`.
+RENDERED_COMMANDS = frozenset({"placements"})
+
+
+def rhi_args(command: str = "") -> list[str]:
+ if command in RENDERED_COMMANDS:
+ return ["-RenderOffscreen", "-ResX=640", "-ResY=360"]
+ return ["-nullrhi"]
+
+
+def command_line(log: Path, command: str = "") -> list[str]:
return [
str(editor_cmd()),
str(art_common.UPROJECT),
f"-ExecutePythonScript={CLI}",
"-unattended",
"-nosplash",
- "-nullrhi",
+ *rhi_args(command),
"-nosound",
"-NoP4",
"-stdout",
@@ -86,7 +98,7 @@ def run_pipeline(argv: list[str]) -> tuple[int, dict, Path]:
VERSE_PIPELINE_RESULT=str(report_path),
VERSE_PIPELINE_QUIT="1",
)
- command = command_line(log)
+ command = command_line(log, argv[0])
if not editor_cmd().is_file():
raise FileNotFoundError(f"{editor_cmd()} not found; set {ENGINE_ENV}")
with art_common.heavy_lock(f"import_art {argv[0]}"):
diff --git a/tests/verse/test_unreal_art_pipeline.py b/tests/verse/test_unreal_art_pipeline.py
index 57e8d20602..11ae1c94e4 100644
--- a/tests/verse/test_unreal_art_pipeline.py
+++ b/tests/verse/test_unreal_art_pipeline.py
@@ -32,9 +32,10 @@ from lib import placement, ue_space, unreal_materials # noqa: E402
from verse_pipeline import ( # noqa: E402
calib,
import_assets,
+ import_meshes,
records,
sync_placements,
- validate_assets, # noqa: E402
+ validate_assets,
)
@@ -657,3 +658,25 @@ def test_export_records_follow_the_kit_rules(tmp_path):
def test_reserved_export_modes_exit_2(capsys):
assert export_unreal.main(["characters"]) == 2
assert "WP13" in capsys.readouterr().err
+
+
+def test_collision_import_flag_keeps_authored_primitives_under_interchange():
+ # Interchange maps the flag onto collision import as a whole (WP12, UE 5.7.1).
+ assert import_meshes.wants_collision_import("auto_box", "legacy")
+ assert import_meshes.wants_collision_import("authored", "interchange")
+ assert not import_meshes.wants_collision_import("authored", "legacy")
+ assert not import_meshes.wants_collision_import("none", "interchange")
+
+
+def test_placement_sync_runs_with_an_offscreen_rhi_and_the_rest_without_one():
+ import_art = _load("import_art", REPO_ROOT / "scripts" / "unreal" / "import_art.py")
+ assert "-RenderOffscreen" in import_art.rhi_args("placements")
+ assert import_art.rhi_args("calib") == ["-nullrhi"]
+
+
+def test_editor_built_test_placeholders_need_no_import_record(tmp_path):
+ root = _scratch_root(tmp_path)
+ _write(root / "unreal/Verse/Content/Verse/Test/G0/SK_Test_Human.uasset", "pointer")
+ assert _errors(root) == []
+ _write(root / "unreal/Verse/Content/Verse/Test/G0/Thing.uasset", "pointer")
+ assert any("prefix not in" in e for e in _errors(root))
diff --git a/unreal/Verse/Content/Python/verse_pipeline/import_meshes.py b/unreal/Verse/Content/Python/verse_pipeline/import_meshes.py
index 88ed9ccad9..a0ba7bbc36 100644
--- a/unreal/Verse/Content/Python/verse_pipeline/import_meshes.py
+++ b/unreal/Verse/Content/Python/verse_pipeline/import_meshes.py
@@ -18,6 +18,8 @@ from .records import split_object_path
IMPORTER_ENV = "VERSE_FBX_IMPORTER"
DEFAULT_IMPORTER = "interchange"
_CVAR = "Interchange.FeatureFlags.Import.FBX"
+#: The importer `use_importer` selected last in this process.
+_active = DEFAULT_IMPORTER
def _unreal():
@@ -34,9 +36,23 @@ def use_importer(name: str | None = None) -> str:
raise ValueError(f"{IMPORTER_ENV} must be interchange or legacy, got {name!r}")
value = "1" if name == "interchange" else "0"
unreal.SystemLibrary.execute_console_command(None, f"{_CVAR} {value}")
+ global _active
+ _active = name
return name
+def wants_collision_import(source: str | None, importer: str | None = None) -> bool:
+ """`auto_generate_collision` for a record's `collision.source`.
+
+ Interchange maps the FbxImportUI flag onto "import collision" as a whole, so with it off the
+ authored `UBX_/USP_/UCP_/UCX_` primitives are dropped too (measured on UE 5.7.1: 0 primitives
+ off, the authored box on). Authored primitives win over the generated box when they exist.
+ """
+ if source == "auto_box":
+ return True
+ return source == "authored" and (importer or _active) == "interchange"
+
+
def _base_options(skeletal: bool):
unreal = _unreal()
ui = unreal.FbxImportUI()
@@ -118,8 +134,9 @@ def run_import(fbx: Path, object_path: str, options, *, save: bool):
def import_static(record: dict, fbx: Path, *, save: bool = True):
nanite = bool(record.get("nanite", {}).get("enabled", False))
collision = record.get("collision", {})
- auto_box = collision.get("source") == "auto_box"
- options = static_mesh_options(nanite=nanite, auto_collision=auto_box)
+ options = static_mesh_options(
+ nanite=nanite, auto_collision=wants_collision_import(collision.get("source"))
+ )
return run_import(fbx, record["asset_path"], options, save=save)
diff --git a/unreal/Verse/Content/Python/verse_pipeline/sync_placements.py b/unreal/Verse/Content/Python/verse_pipeline/sync_placements.py
index e9290c30e2..09ba7d1898 100644
--- a/unreal/Verse/Content/Python/verse_pipeline/sync_placements.py
+++ b/unreal/Verse/Content/Python/verse_pipeline/sync_placements.py
@@ -92,7 +92,8 @@ def _apply(actor, placement: dict, zone: str) -> None:
movable = placement["mobility"] == "movable"
component.set_mobility(mobility.MOVABLE if movable else mobility.STATIC)
component.set_collision_profile_name(placement["collision"])
- component.set_can_ever_affect_navigation(placement["nav"] != "none")
+ # UE 5.7 Python has no setter for this flag; the property itself is editable.
+ component.set_editor_property("can_ever_affect_navigation", placement["nav"] != "none")
for slot, mi in (placement.get("material_overrides") or {}).items():
index = component.get_material_index(slot)
if index >= 0: