- Static-mesh scale test passes: 1 m = 100.00 cm, origin preserved, axis mapping east→+X / north→−Y / up→+Z (named presets ue_metric_v1 both sides). - MPFB 2.0.18 acceptance passes: generated human + standard 137-bone rig with weights + v2 skin baked to 1024² diffuse; imports as SkeletalMesh with Skeleton, Material, and Texture2D in /Game/Test/Character. - MPFB headless requires XDG_CONFIG_HOME at the Flatpak config tree; documented in Art/blender/README.md, probe in Tools/addon_compat_probe.py. - Docs/build.md completed: fresh-checkout build, packaging, headless checks. - Docs/setup.md reconciled with reality; ROADMAP/bootstrap closed out.
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
# Unreal-side half of the scale test: imports the Blender scale-test FBX with
|
|
# the named import preset "ue_metric_v1" and measures the result.
|
|
#
|
|
# Run headless:
|
|
# <engine>/Engine/Binaries/Linux/UnrealEditor-Cmd <uproject> -run=pythonscript \
|
|
# -script=<repo>/Tools/ue_scale_test_import.py -nullrhi -unattended -nopause -stdout
|
|
|
|
import unreal
|
|
|
|
FBX = "/tmp/gigline/scaletest.fbx"
|
|
DEST = "/Game/Test/ScaleTest"
|
|
|
|
|
|
def import_fbx():
|
|
task = unreal.AssetImportTask()
|
|
task.filename = FBX
|
|
task.destination_path = DEST
|
|
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 = False
|
|
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])
|
|
unreal.EditorLoadingAndSavingUtils.save_dirty_packages(True, True)
|
|
|
|
|
|
def measure():
|
|
# Named import preset "ue_metric_v1" measures in Unreal centimetres.
|
|
lines = ["---- measured local-space bounds (cm) ----"]
|
|
for name in ("ScaleTest_A", "ScaleTest_B", "ScaleTest_C"):
|
|
path = f"{DEST}/{name}"
|
|
asset = unreal.EditorAssetLibrary.load_asset(path)
|
|
if asset is None:
|
|
lines.append(f"MISSING asset {path}")
|
|
continue
|
|
box = asset.get_bounding_box()
|
|
mn, mx = box.min, box.max
|
|
lines.append(
|
|
f"{name}: origin=({(mn.x + mx.x) / 2:.2f}, {(mn.y + mx.y) / 2:.2f}, {(mn.z + mx.z) / 2:.2f}) "
|
|
f"size=({mx.x - mn.x:.2f}, {mx.y - mn.y:.2f}, {mx.z - mn.z:.2f})"
|
|
)
|
|
lines.append(f"assets: {unreal.EditorAssetLibrary.list_assets(DEST)}")
|
|
with open("/tmp/ue-scale-test-result.txt", "w") as f:
|
|
f.write("\n".join(lines))
|
|
|
|
|
|
import_fbx()
|
|
measure()
|