Grass Cutters Together: the project as of moon-sweepers f3666f0
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>
This commit is contained in:
90
ArtSource/Blender/scripts/verify_gc_farm_world.py
Normal file
90
ArtSource/Blender/scripts/verify_gc_farm_world.py
Normal file
@ -0,0 +1,90 @@
|
||||
"""Re-import the gc_farm_world FBX files and compare them with the seaside set they replaced:
|
||||
required named parts, local axes of the spinning parts, bounds (Blender space) and tri counts.
|
||||
Run: blender -b --factory-startup --python ArtSource/Blender/scripts/verify_gc_farm_world.py -- [names]"""
|
||||
import bpy, os, sys, math
|
||||
|
||||
d = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "..", "Assets", "Art", "Models"))
|
||||
# old model: (min xyz, max xyz, tris) measured from the FBX before the rebuild
|
||||
OLD = {
|
||||
"SM_Buoy": ((-0.66, -0.28, -0.07), (0.66, 0.28, 1.97), 2092),
|
||||
"SM_Decor_Beacon": ((-0.6, -0.6, 0.0), (0.6, 0.6, 3.15), 3964),
|
||||
"SM_Decor_Bench": ((-0.93, -0.31, 0.0), (0.93, 0.32, 0.91), 3978),
|
||||
"SM_Decor_Crates": ((-0.85, -0.57, 0.0), (0.88, 0.85, 1.28), 3808),
|
||||
"SM_Decor_Dish": ((-0.74, -0.68, 0.0), (0.74, 0.84, 2.53), 3634),
|
||||
"SM_Decor_Flag": ((-0.25, -0.25, 0.0), (1.55, 0.25, 4.43), 3702),
|
||||
"SM_Decor_Gnome": ((-0.22, -0.22, 0.0), (0.22, 0.22, 0.71), 3904),
|
||||
"SM_Decor_Grill": ((-0.42, -0.4, 0.0), (0.43, 0.71, 1.57), 3698),
|
||||
"SM_Decor_Hammock": ((-1.87, -0.51, 0.0), (1.87, 0.51, 1.68), 3556),
|
||||
"SM_Decor_Lamp": ((-0.34, -0.34, 0.0), (0.34, 0.34, 2.78), 3926),
|
||||
"SM_Decor_Palm": ((-0.55, -0.49, 0.0), (0.56, 0.53, 1.89), 1082),
|
||||
"SM_Decor_Pool": ((-0.96, -0.96, 0.0), (0.96, 0.96, 0.83), 3720),
|
||||
"SM_Decor_Sofa": ((-0.93, -0.41, 0.0), (0.93, 0.45, 0.97), 3728),
|
||||
"SM_Decor_Umbrella": ((-1.08, -1.08, 0.0), (1.08, 1.08, 2.43), 3996),
|
||||
"SM_Decor_Vending": ((-0.64, -0.52, 0.0), (0.51, 0.4, 1.95), 3780),
|
||||
"SM_HoverTanker": ((-2.16, -4.5, -0.01), (2.16, 3.59, 3.77), 19304),
|
||||
"SM_TugPump": ((-1.88, -3.2, -0.11), (1.88, 2.55, 3.37), 12248),
|
||||
"SM_Wreck_Probe": ((-3.56, -3.1, -0.44), (3.56, 3.1, 3.95), 6502),
|
||||
"SM_Wreck_Ship": ((-9.95, -15.72, -2.49), (9.69, 16.69, 11.48), 20326),
|
||||
}
|
||||
# part -> expected world rotation (deg) when it matters, origin when it matters
|
||||
REQ = {
|
||||
"SM_Decor_Beacon": {"Body": None, "Light": dict(org=(0, 0, 2.3), rot=(90, 0, 0))},
|
||||
"SM_Decor_Dish": {"Body": None, "Dish": dict(org=(0, 0, 1.5), rot=(0, 0, 0))},
|
||||
"SM_Decor_Lamp": {"Body": None, "Bulb": dict(org=(0, 0, 2.34))},
|
||||
"SM_Decor_Flag": {"Body": None, "Cloth": dict(org=(0, 0, 3.7))},
|
||||
"SM_Decor_Pool": {"Body": None, "Water": dict(org=(0, 0, 0))},
|
||||
"SM_HoverTanker": {"Body": None, "Fill": None, "Seat": dict(org=(0, -1.95, 1.91)), "Intake": dict(org=(0, -4.15, 0)),
|
||||
"Fan_L": dict(rot=(90, 0, 0)), "Fan_R": dict(rot=(90, 0, 0))},
|
||||
"SM_TugPump": {"Body": None, "Fill": None, "Reel": None, "Arm": None, "Seat": None, "Intake": None, "Wake": None,
|
||||
"Wheel_L1": None, "Wheel_R1": None, "Wheel_L2": None, "Wheel_R2": None},
|
||||
"SM_Wreck_Ship": {"SM_Wreck_Ship": None},
|
||||
"SM_Wreck_Probe": {"SM_Wreck_Probe": None},
|
||||
"SM_Buoy": {"SM_Buoy": None},
|
||||
}
|
||||
for n in ("Bench", "Crates", "Gnome", "Grill", "Hammock", "Palm", "Sofa", "Umbrella", "Vending"):
|
||||
REQ["SM_Decor_" + n] = {"SM_Decor_" + n: None}
|
||||
BUDGET = {"SM_Wreck_Ship": 25000, "SM_Wreck_Probe": 10000, "SM_HoverTanker": 20000, "SM_TugPump": 13000}
|
||||
|
||||
names = (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []) or list(OLD)
|
||||
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()
|
||||
objs = {o.name: o for o in bpy.context.scene.objects}
|
||||
tris = 0
|
||||
mn, mx = [1e9] * 3, [-1e9] * 3
|
||||
mats = set()
|
||||
for o in objs.values():
|
||||
if o.type != "MESH":
|
||||
continue
|
||||
tris += sum(len(f.vertices) - 2 for f in o.data.polygons)
|
||||
mats |= {m.name.split(".")[0] for m in o.data.materials if m}
|
||||
for v in o.data.vertices:
|
||||
w = o.matrix_world @ v.co
|
||||
mn = [min(a, b) for a, b in zip(mn, w)]
|
||||
mx = [max(a, b) for a, b in zip(mx, w)]
|
||||
problems = []
|
||||
for part, want in REQ.get(n, {}).items():
|
||||
if part not in objs:
|
||||
problems.append(f"missing {part}")
|
||||
elif want:
|
||||
o = objs[part]
|
||||
if "org" in want and max(abs(a - b) for a, b in zip(o.matrix_world.translation, want["org"])) > 0.01:
|
||||
problems.append(f"{part} origin {tuple(round(x, 3) for x in o.matrix_world.translation)}")
|
||||
if "rot" in want:
|
||||
e = [math.degrees(a) for a in o.matrix_world.to_euler()]
|
||||
if max(abs(a - b) for a, b in zip(e, want["rot"])) > 0.5:
|
||||
problems.append(f"{part} rotation {tuple(round(x, 1) for x in e)}")
|
||||
budget = BUDGET.get(n, 4000)
|
||||
if tris > budget:
|
||||
problems.append(f"tris {tris} over {budget}")
|
||||
bad += len(problems)
|
||||
omn, omx, otr = OLD.get(n, ((0, 0, 0), (0, 0, 0), 0))
|
||||
size = [b - a for a, b in zip(mn, mx)]
|
||||
osize = [b - a for a, b in zip(omn, omx)]
|
||||
print(f"GFW|{n}|tris {otr}->{tris}|size {osize[0]:.2f}x{osize[1]:.2f}x{osize[2]:.2f} -> {size[0]:.2f}x{size[1]:.2f}x{size[2]:.2f}"
|
||||
f"|min {tuple(round(x, 2) for x in mn)} max {tuple(round(x, 2) for x in mx)}|{'OK' if not problems else problems}")
|
||||
print(f"GFW objects: {sorted(objs)}")
|
||||
print(f"GFW materials: {sorted(mats)}")
|
||||
print(f"GFW|RESULT|{'OK' if bad == 0 else 'PROBLEMS %d' % bad}")
|
||||
Reference in New Issue
Block a user