"""Re-imports every exported FBX into an empty scene and reports what Unreal will get. Headless: blender.exe -b --factory-startup --python rc_verify_fbx.py Writes fbx/verify_report.json.""" import bpy, os, math, json F = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "fbx") out = {} for fn in sorted(os.listdir(F)): if not fn.endswith(".fbx"): continue bpy.ops.wm.read_homefile(use_empty=True) bpy.ops.import_scene.fbx(filepath=os.path.join(F, fn)) objs = list(bpy.context.scene.objects) meshes = [o for o in objs if o.type == 'MESH' and not o.name.startswith("UCX_")] rep = {"objects": len(objs), "ucx": sorted(o.name for o in objs if o.name.startswith("UCX_"))[:3] + ["..."] if len([o for o in objs if o.name.startswith("UCX_")]) > 3 else sorted(o.name for o in objs if o.name.startswith("UCX_"))} parts = {} rep["materials_per_mesh"] = {m.name: [x.name for x in m.data.materials] for m in meshes} for m in meshes: me = m.data ws = [m.matrix_world @ v.co for v in me.vertices] parts[m.name] = dict(loc=[round(c, 3) for c in m.location], rot_deg=[round(math.degrees(c), 1) for c in m.rotation_euler], scale=[round(c, 3) for c in m.scale], bbox_lo=[round(min(p[i] for p in ws), 3) for i in range(3)], bbox_hi=[round(max(p[i] for p in ws), 3) for i in range(3)], uvs=[l.name for l in me.uv_layers], mats=[x.name for x in me.materials], tris=sum(len(p.vertices) - 2 for p in me.polygons), ngons=sum(1 for p in me.polygons if len(p.vertices) > 4)) rep["meshes"] = parts if len(parts) <= 2 else {k: dict(tris=v["tris"], loc=v["loc"]) for k, v in parts.items()} arms = [o for o in objs if o.type == 'ARMATURE'] if arms: a = arms[0] act = a.animation_data.action if a.animation_data else None rep["armature"] = dict(name=a.name, bones=[b.name for b in a.data.bones], rot_deg=[round(math.degrees(c), 1) for c in a.rotation_euler], action=act.name if act else None, frames=list(act.frame_range) if act else None) sk = [o for o in meshes if o.find_armature()] rep["skinned"] = {o.name: sorted(g.name for g in o.vertex_groups) for o in sk} out[fn] = rep with open(os.path.join(F, "verify_report.json"), "w", encoding="utf-8") as f: json.dump(out, f, indent=1) print("VERIFY OK", len(out))