mrPlow58/Scripts/compare_kamaz_collections.py
2026-07-03 07:06:16 +03:00

17 lines
902 B
Python

import bpy, json
from pathlib import Path
def collect(path):
bpy.ops.wm.open_mainfile(filepath=path)
data=[]
for c in sorted(bpy.data.collections, key=lambda x:x.name.lower()):
meshes=[o.name for o in c.objects if o.type=='MESH']
if meshes:
data.append({'collection':c.name,'meshCount':len(meshes),'sample':meshes[:30]})
return data
out={
'old': collect(r'C:\Users\post\Documents\mrPlow\in\kamaz_65115_clean.blend'),
'new': collect(r'C:\Users\post\Documents\mrPlow\in\KAMAZ_CR_plusX_previous_modules_fitcheck1.blend')
}
Path(r'VehicleExports\KAMAZ_CR\kamaz_old_new_collection_compare.json').write_text(json.dumps(out,ensure_ascii=False,indent=2),encoding='utf-8')
print(json.dumps({'oldCollections':len(out['old']),'newCollections':len(out['new']),'report':'VehicleExports/KAMAZ_CR/kamaz_old_new_collection_compare.json'},ensure_ascii=False,indent=2))