diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-05 02:29:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-05 02:29:24 +0400 |
commit | 512f94a918d35f79fb7388b45c38913855a8e971 (patch) | |
tree | 82b07b5aa8b443151a968bfc2612d4290f7c7f1e /io_mesh_ply | |
parent | 53f601943472b520bf484d755b82d01661e0d9d6 (diff) |
patch [#36653] Tiny patch that extends import_ply.py to read edges (and allow for 3D curves import)
from Thomas Schiex (treepleks)
Diffstat (limited to 'io_mesh_ply')
-rw-r--r-- | io_mesh_ply/import_ply.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py index a59c94d6..9cf5df63 100644 --- a/io_mesh_ply/import_ply.py +++ b/io_mesh_ply/import_ply.py @@ -245,6 +245,8 @@ def load_ply_mesh(filepath, ply_name): findex = el.index(b'vertex_indices') elif el.name == b'tristrips': trindex = el.index(b'vertex_indices') + elif el.name == b'edge': + eindex1, eindex2 = el.index(b'vertex1'), el.index(b'vertex2') mesh_faces = [] mesh_uvs = [] @@ -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])]) + 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: mesh.tessfaces.add(len(mesh_faces)) mesh.tessfaces.foreach_set("vertices_raw", unpack_face_list(mesh_faces)) |