import bpy,json
from pathlib import Path
OUT=Path(__file__).resolve().parent
checks=[]
for key in ['human-common-ground','human-mutual-care','human-autonomy']:
 bpy.ops.wm.open_mainfile(filepath=str(OUT/(key+'.blend')))
 scene=bpy.context.scene
 assert scene.name.startswith('HUMAN / ')
 for ob in scene.objects:ob.select_set(ob.type in {'MESH','CURVE'} and not ob.name.startswith('HUMAN / Gallery floor'))
 bpy.context.view_layer.objects.active=next(ob for ob in scene.objects if ob.select_get())
 bpy.ops.export_scene.gltf(filepath=str(OUT/(key+'.glb')),export_format='GLB',use_selection=True,use_active_scene=True,export_apply=True,export_animations=False,export_cameras=False,export_lights=False,export_extras=True)
 checks.append({'key':key,'scenes':len(bpy.data.scenes),'objects':len(scene.objects),'geometry':sum(o.select_get() for o in scene.objects),'noExternalFiles':len(bpy.data.images)==0})
print('MODEL_CHECKS',json.dumps(checks))
