[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3132] trunk/py/scripts/addons/ io_mesh_ply: 'bugfix' .ply import/export scripts flip V texture coordinate

Dalai Felinto dfelinto at gmail.com
Mon Mar 19 19:52:44 CET 2012


Revision: 3132
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3132
Author:   dfelinto
Date:     2012-03-19 18:52:42 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
'bugfix' .ply import/export scripts flip V texture coordinate
.PLY has no specification for how to represent the texture coordinates.
The general guideline is to implement this the way is more convenient for the software (this it makes no sense to flip what Blender does internally).

Also, there are some softwares that used to flip V in the past for .ply. This has changed though, and from what I could find in the internet, the current standard is to have the V opposite to what we have in Blender.

Finally I used meshlab for my tests - http://meshlab.sourceforge.net/
Their sample files (the dount one) shows flipped V in blender.

I hope no one gets unhappy with this commit.

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

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-03-19 10:54:28 UTC (rev 3131)
+++ trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2012-03-19 18:52:42 UTC (rev 3132)
@@ -129,10 +129,10 @@
                 normal_key = rvec3d(normal)
 
             if has_uv:
-                uvcoord = uv[j][0], 1.0 - uv[j][1]
+                uvcoord = uv[j][0], uv[j][1]
                 uvcoord_key = rvec2d(uvcoord)
             elif has_uv_vertex:
-                uvcoord = v.uvco[0], 1.0 - v.uvco[1]
+                uvcoord = v.uvco[0], v.uvco[1]
                 uvcoord_key = rvec2d(uvcoord)
 
             if has_vcol:

Modified: trunk/py/scripts/addons/io_mesh_ply/import_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/import_ply.py	2012-03-19 10:54:28 UTC (rev 3131)
+++ trunk/py/scripts/addons/io_mesh_ply/import_ply.py	2012-03-19 18:52:42 UTC (rev 3132)
@@ -257,7 +257,7 @@
     def add_face(vertices, indices, uvindices, colindices):
         mesh_faces.append(indices)
         if uvindices:
-            mesh_uvs.append([(vertices[index][uvindices[0]], 1.0 - vertices[index][uvindices[1]]) for index in indices])
+            mesh_uvs.append([(vertices[index][uvindices[0]], vertices[index][uvindices[1]]) for index in indices])
         if colindices:
             mesh_colors.append([(vertices[index][colindices[0]] * colmultiply[0],
                                  vertices[index][colindices[1]] * colmultiply[1],



More information about the Bf-extensions-cvs mailing list