[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4739] trunk/py/scripts/addons/ io_mesh_ply/import_ply.py: patch [#36653] Tiny patch that extends import_ply.py to read edges ( and allow for 3D curves import)

Campbell Barton ideasman42 at gmail.com
Thu Sep 5 00:29:24 CEST 2013


Revision: 4739
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4739
Author:   campbellbarton
Date:     2013-09-04 22:29:24 +0000 (Wed, 04 Sep 2013)
Log Message:
-----------
patch [#36653] Tiny patch that extends import_ply.py to read edges (and allow for 3D curves import)
from Thomas Schiex (treepleks)

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_ply/import_ply.py

Modified: trunk/py/scripts/addons/io_mesh_ply/import_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/import_ply.py	2013-09-04 18:07:00 UTC (rev 4738)
+++ trunk/py/scripts/addons/io_mesh_ply/import_ply.py	2013-09-04 22:29:24 UTC (rev 4739)
@@ -245,6 +245,8 @@
             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 @@
 
     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))



More information about the Bf-extensions-cvs mailing list