A clean start for the shared repository: the Unity project (Assets, Packages, ProjectSettings), ArtSource, Docs and Tools as they stood at f3666f0 in the old local repository, with its generated prefabs and scene brought up to date. Images, audio, models and binaries go through Git LFS (.gitattributes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.3 KiB
Python
51 lines
2.3 KiB
Python
"""Load the v4_robots FBX files and print per-object origin / bounds (Unity space) / tris / materials,
|
|
and check that the required named children exist.
|
|
Run: blender -b --factory-startup --python verify_v4_robots.py -- [names]"""
|
|
import bpy, os, sys
|
|
|
|
d = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "Assets", "Art", "Models"))
|
|
REQ = {
|
|
"SM_SweeperBot": ["Body", "Lamp", "BrushL", "BrushR"],
|
|
"SM_SweeperDock": ["Body", "Lamp"],
|
|
"SM_Drone": ["Body", "Lamp", "Rotor0", "Rotor1", "Rotor2", "Rotor3", "Claw"],
|
|
"SM_DronePad": ["Body", "Lamp"],
|
|
"SM_Launcher": ["Body", "Plate"],
|
|
"SM_PokeBot": ["Body", "Lamp", "Yaw", "Carriage"],
|
|
"SM_GoldPlater": ["Body", "Belt", "Brush", "Lamp"],
|
|
}
|
|
names = (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []) or list(REQ)
|
|
|
|
|
|
def U(v): # blender -> unity
|
|
return (-v.x, v.z, -v.y)
|
|
|
|
|
|
bad = 0
|
|
for n in names:
|
|
bpy.ops.wm.read_factory_settings(use_empty=True)
|
|
bpy.ops.import_scene.fbx(filepath=os.path.join(d, n + ".fbx"))
|
|
bpy.context.view_layer.update()
|
|
total = 0
|
|
gmn = [1e9] * 3; gmx = [-1e9] * 3
|
|
rows = []
|
|
found = set()
|
|
for o in sorted(bpy.context.scene.objects, key=lambda o: o.name):
|
|
if o.type != "MESH":
|
|
continue
|
|
found.add(o.name)
|
|
tris = sum(len(f.vertices) - 2 for f in o.data.polygons)
|
|
total += tris
|
|
pts = [U(o.matrix_world @ v.co) for v in o.data.vertices]
|
|
mn = [min(p[i] for p in pts) for i in range(3)]
|
|
mx = [max(p[i] for p in pts) for i in range(3)]
|
|
gmn = [min(a, b) for a, b in zip(gmn, mn)]; gmx = [max(a, b) for a, b in zip(gmx, mx)]
|
|
org = U(o.matrix_world.translation)
|
|
mats = ",".join(sorted({m.name for m in o.data.materials if m}))
|
|
rows.append(f" {o.name:<9} origin({org[0]:.3f},{org[1]:.3f},{org[2]:.3f}) x[{mn[0]:.3f},{mx[0]:.3f}] y[{mn[1]:.3f},{mx[1]:.3f}] z[{mn[2]:.3f},{mx[2]:.3f}] tris={tris} [{mats}]")
|
|
missing = [r for r in REQ.get(n, []) if r not in found]
|
|
bad += len(missing)
|
|
print(f"V4|{n}|tris={total}|x[{gmn[0]:.2f},{gmx[0]:.2f}] y[{gmn[1]:.2f},{gmx[1]:.2f}] z[{gmn[2]:.2f},{gmx[2]:.2f}]|missing={missing or 'none'}")
|
|
for r in rows:
|
|
print(r)
|
|
print(f"V4|RESULT|{'OK' if bad == 0 else 'MISSING %d' % bad}")
|