"""Dump the node structure + transforms of a GLB (to see what Blender exported)."""
import sys
import numpy as np
import trimesh

s = trimesh.load(sys.argv[1])
print("kind:", type(s).__name__)
print("geometry nodes:", sorted(s.graph.nodes_geometry))
print("all nodes:", sorted(s.graph.nodes))
for node in sorted(s.graph.nodes_geometry):
    T, g = s.graph[node]
    T = np.array(T, float)
    rot = np.degrees(trimesh.transformations.euler_from_matrix(T))
    sc = [round(np.linalg.norm(T[:3, i]), 3) for i in range(3)]
    m = s.geometry[g]
    print(f"{node}: geom={g}  verts={len(m.vertices)} faces={len(m.faces)} watertight={m.is_watertight}")
    print("   pos(raw units):", np.round(T[:3, 3], 3).tolist())
    print("   rot(deg xyz):   ", np.round(rot, 1).tolist())
    print("   per-axis scale: ", sc)
