"""Triangles of the Remora's exterior meshes in its own frame (closed canopy and lid) -> checks/remora_tris.npz""" import bpy, numpy as np, os V, T, NAMES, OFF = [], [], [], 0 for o in bpy.data.objects: if o.type == 'MESH' and o.name.startswith("SM_Remora") and o.name != "SM_Remora_Cabin": me = o.data me.calc_loop_triangles() M = np.array(o.matrix_world) co = np.empty(len(me.vertices) * 3); me.vertices.foreach_get("co", co) co = co.reshape(-1, 3) @ M[:3, :3].T + M[:3, 3] tr = np.empty(len(me.loop_triangles) * 3, np.int64); me.loop_triangles.foreach_get("vertices", tr) V.append(co); T.append(tr.reshape(-1, 3) + OFF); NAMES += [o.name] * len(me.loop_triangles); OFF += len(co) np.savez(os.path.join(os.path.dirname(bpy.data.filepath), "build", "checks", "remora_tris.npz"), v=np.concatenate(V), t=np.concatenate(T), names=np.array(NAMES)) print("TRIS", OFF, sum(len(t) for t in T))