Files
gig-line/Tools/addon_compat_probe.py
T
zwitschi 1c6b956435 bootstrap: finish project bootstrap — scale test, MPFB character, build docs
- 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.
2026-11-07 09:29:11 +01:00

65 lines
2.1 KiB
Python

# Headless compatibility probe for Blosm and MPFB on the pinned Blender 5.2.
#
# blender -b --factory-startup --python Tools/addon_compat_probe.py
#
# Checks: Blender version, Blosm add-on loads + version, MPFB extension
# enables + version, MPFB can create a default human headless, resulting
# object inventory (mesh/armature/materials/uvs).
import bpy
import sys
REPORT = "/tmp/addon-compat-report.txt"
lines = []
def log(msg):
lines.append(str(msg))
bl = bpy.app.version_string
log(f"Blender: {bl}")
# --- Blosm (legacy add-on, scripts/addons) ---
try:
import blosm # noqa
info = getattr(blosm, "bl_info", {})
log(f"blosm: import OK, version {info.get('version', '?')}, blender {info.get('blender', '?')}")
except Exception as exc: # noqa
log(f"blosm: IMPORT FAILED: {exc!r}")
# --- MPFB (extension, extensions/blender_org/mpfb) ---
try:
import addon_utils
bpy.ops.preferences.addon_enable(module="bl_ext.blender_org.mpfb")
enabled = "bl_ext.blender_org.mpfb" in bpy.context.preferences.addons
version = "?"
try:
import bl_ext.blender_org.mpfb as mpfb_mod
version = getattr(mpfb_mod, "MPFB_VERSION", "?")
except Exception:
pass
log(f"mpfb: enable OK (registered={enabled}), version {version}")
except Exception as exc: # noqa
log(f"mpfb: ENABLE FAILED: {exc!r}")
# --- MPFB create-human smoke test ---
try:
bpy.ops.mpfb.create_human("EXEC_DEFAULT")
meshes = [o for o in bpy.data.objects if o.type == "MESH"]
armatures = [o for o in bpy.data.objects if o.type == "ARMATURE"]
log(f"mpfb.create_human: OK — {len(bpy.data.objects)} objects, "
f"{len(meshes)} meshes, {len(armatures)} armatures")
for o in meshes:
uv = bool(o.data.uv_layers)
mats = [m.name for m in o.data.materials]
log(f" mesh {o.name}: {len(o.data.vertices)} verts, uv={uv}, materials={mats}")
for o in armatures:
log(f" armature {o.name}: {len(o.data.bones)} bones")
except Exception as exc: # noqa
log(f"mpfb.create_human: FAILED: {exc!r}")
with open(REPORT, "w") as f:
f.write("\n".join(lines) + "\n")
print("\n".join(lines))