From 512f94a918d35f79fb7388b45c38913855a8e971 Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Wed, 4 Sep 2013 22:29:24 +0000 Subject: [PATCH] patch [#36653] Tiny patch that extends import_ply.py to read edges (and allow for 3D curves import) from Thomas Schiex (treepleks) --- io_mesh_ply/import_ply.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py index a59c94d6d..9cf5df639 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)) -- GitLab