[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3241] trunk/py/scripts/addons/ io_mesh_ply: own patch [#30877] ply exporter to use shared faces when not exporting the normals

Dalai Felinto dfelinto at gmail.com
Tue Apr 10 16:12:44 CEST 2012


Revision: 3241
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3241
Author:   dfelinto
Date:     2012-04-10 14:12:44 +0000 (Tue, 10 Apr 2012)
Log Message:
-----------
own patch [#30877] ply exporter to use shared faces when not exporting the normals

Faces should be exported with shared vertices whenever possible (otherwise this is simply a STL exporter). Since PLY stores normals per vertex it's understandable that we need 'individual' faces when exporting normals. However when this is not the case I think shared vertices should be default behaviour. This is what this patch implement.

Thanks Campbell for reviewing it. Thanks Aldo Zang for reporting it (off trackers, in the old fashion real life)

Modified Paths:
--------------
    trunk/py/scripts/addons/io_mesh_ply/__init__.py
    trunk/py/scripts/addons/io_mesh_ply/export_ply.py

Modified: trunk/py/scripts/addons/io_mesh_ply/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/__init__.py	2012-04-10 11:20:51 UTC (rev 3240)
+++ trunk/py/scripts/addons/io_mesh_ply/__init__.py	2012-04-10 14:12:44 UTC (rev 3241)
@@ -96,7 +96,7 @@
             )
     use_normals = BoolProperty(
             name="Normals",
-            description="Export Normals for smooth and hard shaded faces",
+            description="Export Normals for smooth and hard shaded faces. Hard shaded faces will be exported as individual faces",
             default=True,
             )
     use_uv_coords = BoolProperty(
@@ -106,7 +106,7 @@
             )
     use_colors = BoolProperty(
             name="Vertex Colors",
-            description="Exort the active vertex color layer",
+            description="Export the active vertex color layer",
             default=True)
 
     @classmethod

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-04-10 11:20:51 UTC (rev 3240)
+++ trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-04-10 14:12:44 UTC (rev 3241)
@@ -106,7 +106,7 @@
     vert_count = 0
     for i, f in enumerate(mesh.tessfaces):
 
-        smooth = f.use_smooth
+        smooth = not use_normals or f.use_smooth
         if not smooth:
             normal = tuple(f.normal)
             normal_key = rvec3d(normal)



More information about the Bf-extensions-cvs mailing list