[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1416] trunk/py/scripts/addons/ io_mesh_ply/import_ply.py: fix for vertex color import, 0.0 - 1.0, not 0 - 255.

Campbell Barton ideasman42 at gmail.com
Mon Jan 17 09:53:31 CET 2011


Revision: 1416
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1416
Author:   campbellbarton
Date:     2011-01-17 08:53:30 +0000 (Mon, 17 Jan 2011)
Log Message:
-----------
fix for vertex color import, 0.0 - 1.0, not 0 - 255.

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	2011-01-16 17:35:41 UTC (rev 1415)
+++ trunk/py/scripts/addons/io_mesh_ply/import_ply.py	2011-01-17 08:53:30 UTC (rev 1416)
@@ -254,7 +254,7 @@
         if uvindices:
             mesh_uvs.append([(vertices[index][uvindices[0]], 1.0 - vertices[index][uvindices[1]]) for index in indices])
         if colindices:
-            mesh_colors.append([(vertices[index][colindices[0]], vertices[index][colindices[1]], vertices[index][colindices[2]]) for index in indices])
+            mesh_colors.append([(vertices[index][colindices[0]] / 255.0, vertices[index][colindices[1]] / 255.0, vertices[index][colindices[2]] / 255.0) for index in indices])
 
     if uvindices or colindices:
         # If we have Cols or UVs then we need to check the face order.
@@ -309,11 +309,10 @@
                         uv[:] = ply_uv[j]
 
             if colindices:
-                faces = obj['face']
                 for i, f in enumerate(vcol_lay.data):
                     # XXX, colors dont come in right, needs further investigation.
                     ply_col = mesh_colors[i]
-                    if len(faces[i]) == 4:
+                    if len(ply_col) == 4:
                         f_col = f.color1, f.color2, f.color3, f.color4
                     else:
                         f_col = f.color1, f.color2, f.color3



More information about the Bf-extensions-cvs mailing list