transform: f(vertices, faces) --> transformed (vertices, faces)
(path, data, transform=lambda v,f:(v,f))
| 41 | f.close() |
| 42 | |
| 43 | def 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 | |
| 58 | def meshwrite(filename, verts, faces, norms, colors): |
| 59 | """Save a 3D mesh to a polygon .ply file. |
nothing calls this directly
no outgoing calls
no test coverage detected