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>
38 lines
1.8 KiB
Python
38 lines
1.8 KiB
Python
"""Load the v3_belts FBX files and print per-object origin / bounds (Unity space) / tris / materials.
|
|
Run: blender -b --factory-startup --python verify_v3_belts.py -- [names]"""
|
|
import bpy, os, sys
|
|
from mathutils import Vector
|
|
|
|
d = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "Assets", "Art", "Models"))
|
|
ALL = ["SM_Belt", "SM_BeltTurn", "SM_BeltSplitter", "SM_BeltSorter", "SM_WH_Mezzanine", "SM_WH_Stairs", "SM_WH_Crane",
|
|
"SM_WH_Fan", "SM_WH_Banner", "SM_WH_Cage", "SM_WH_Duct", "SM_WH_Bollard"]
|
|
names = (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []) or ALL
|
|
|
|
|
|
def U(v): # blender -> unity
|
|
return (-v.x, v.z, -v.y)
|
|
|
|
|
|
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 = []
|
|
for o in sorted(bpy.context.scene.objects, key=lambda o: o.name):
|
|
if o.type != "MESH":
|
|
continue
|
|
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:<8} origin({org[0]:.2f},{org[1]:.2f},{org[2]:.2f}) x[{mn[0]:.3f},{mx[0]:.3f}] y[{mn[1]:.3f},{mx[1]:.3f}] z[{mn[2]:.3f},{mx[2]:.3f}] tris={tris} [{mats}]")
|
|
print(f"V3B|{n}|tris={total}|x[{gmn[0]:.2f},{gmx[0]:.2f}] y[{gmn[1]:.2f},{gmx[1]:.2f}] z[{gmn[2]:.2f},{gmx[2]:.2f}]")
|
|
for r in rows:
|
|
print(r)
|