MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / export_to_obj_single

Function export_to_obj_single

utils/visualize.py:43–56  ·  view source on GitHub ↗

transform: f(vertices, faces) --> transformed (vertices, faces)

(path, data, transform=lambda v,f:(v,f))

Source from the content-addressed store, hash-verified

41 f.close()
42
43def export_to_obj_single(path, data, transform=lambda v,f:(v,f)):
44 '''
45 transform: f(vertices, faces) --> transformed (vertices, faces)
46 '''
47 v, f = transform(data[0], data[1])
48 if len(data) > 2:
49 v_color = data[2]
50 else:
51 v_color = None
52 mesh = trimesh.Trimesh(v, f, vertex_colors=v_color)
53 out = trimesh.exchange.obj.export_obj(mesh)
54 with open(path, 'w') as f:
55 f.write(out)
56 f.close()
57
58def meshwrite(filename, verts, faces, norms, colors):
59 """Save a 3D mesh to a polygon .ply file.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected