#!/usr/bin/env python3 """Inspect GLB file attributes. Usage: python inspect_glb.py model.glb""" import json, sys, struct def inspect_glb(path): with open(path, 'rb') as f: if f.read(4) != b'glTF': print("Not a GLB file") return f.read(8) # version + length chunk_len = struct.unpack('I', f.read(4))[0] if f.read(4) != b'JSON': print("JSON chunk not found") return gltf = json.loads(f.read(chunk_len).decode()) print("=" * 50 + "\nGLB FILE INSPECTION\n" + "=" * 50) for mesh in gltf.get('meshes', []): print(f"\n📦 {mesh.get('name', 'Unnamed')}") for prim in mesh.get('primitives', []): print(" Attributes:") for name, idx in prim.get('attributes', {}).items(): acc = gltf['accessors'][idx] print(f" - {name}: {acc['type']}, count={acc['count']}") print("\n💡 Name vertex colors as _COLOR2, _COLOR3, etc. in Blender") if __name__ == "__main__": inspect_glb(sys.argv[1]) if len(sys.argv) > 1 else print("Usage: python inspect_glb.py model.glb")