Skip to content
Snippets Groups Projects
Commit 512f94a9 authored by Campbell Barton's avatar Campbell Barton
Browse files

patch [#36653] Tiny patch that extends import_ply.py to read edges (and allow for 3D curves import)

from Thomas Schiex (treepleks)
parent 53f60194
No related branches found
No related tags found
No related merge requests found
...@@ -245,6 +245,8 @@ def load_ply_mesh(filepath, ply_name): ...@@ -245,6 +245,8 @@ def load_ply_mesh(filepath, ply_name):
findex = el.index(b'vertex_indices') findex = el.index(b'vertex_indices')
elif el.name == b'tristrips': elif el.name == b'tristrips':
trindex = el.index(b'vertex_indices') trindex = el.index(b'vertex_indices')
elif el.name == b'edge':
eindex1, eindex2 = el.index(b'vertex1'), el.index(b'vertex2')
mesh_faces = [] mesh_faces = []
mesh_uvs = [] mesh_uvs = []
...@@ -301,6 +303,10 @@ def load_ply_mesh(filepath, ply_name): ...@@ -301,6 +303,10 @@ def load_ply_mesh(filepath, ply_name):
mesh.vertices.foreach_set("co", [a for v in obj[b'vertex'] for a in (v[vindices_x], v[vindices_y], v[vindices_z])]) mesh.vertices.foreach_set("co", [a for v in obj[b'vertex'] for a in (v[vindices_x], v[vindices_y], v[vindices_z])])
if b'edge' in obj:
mesh.edges.add(len(obj[b'edge']))
mesh.edges.foreach_set("vertices", [a for e in obj[b'edge'] for a in (e[eindex1], e[eindex2])])
if mesh_faces: if mesh_faces:
mesh.tessfaces.add(len(mesh_faces)) mesh.tessfaces.add(len(mesh_faces))
mesh.tessfaces.foreach_set("vertices_raw", unpack_face_list(mesh_faces)) mesh.tessfaces.foreach_set("vertices_raw", unpack_face_list(mesh_faces))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment