# tools/fixtures/_fbx_blender_stats: run by tools/fixtures/fbx.py inside Blender (blender -b --python -- ): imports each FBX with Blender's importer and prints one JSON line "STATS " with per file # counts: mesh objects, polygons, vertices, materials, bones, actions, shape keys, cameras, lights, images; or # {"failed": message}. import bpy, sys, json paths = json.loads(sys.argv[sys.argv.index("--") + 1]) res = [] for p in paths: bpy.ops.wm.read_factory_settings(use_empty=True) try: r = bpy.ops.import_scene.fbx(filepath=p) if "FINISHED" not in r: raise RuntimeError(str(r)) except Exception as e: res.append({"failed": str(e)[:200]}) continue obs = bpy.context.scene.objects meshes = [o for o in obs if o.type == "MESH"] res.append({ "meshes": len(meshes), "polygons": sum(len(o.data.polygons) for o in meshes), "vertices": sum(len(o.data.vertices) for o in meshes), "materials": len([m for m in bpy.data.materials if m.users > 0]), "bones": sum(len(o.data.bones) for o in obs if o.type == "ARMATURE"), "actions": len(bpy.data.actions), "shapeKeys": sum(len(o.data.shape_keys.key_blocks) - 1 for o in meshes if o.data.shape_keys), "cameras": len([o for o in obs if o.type == "CAMERA"]), "lights": len([o for o in obs if o.type == "LIGHT"]), "images": len([i for i in bpy.data.images if i.users > 0]), }) print("STATS " + json.dumps(res))