[Bf-extensions-cvs] [6d22ae7] temp-x3d_import-T44758: No validation for IndexedFaceSet; if faces are removed during validation, it throws off per-vertex color assignment

Seva Alekseyev noreply at git.blender.org
Wed Jun 3 20:48:03 CEST 2015


Commit: 6d22ae73521ebdf7f1b5c56f183b90377f34b702
Author: Seva Alekseyev
Date:   Wed Jun 3 14:47:39 2015 -0400
Branches: temp-x3d_import-T44758
https://developer.blender.org/rBA6d22ae73521ebdf7f1b5c56f183b90377f34b702

No validation for IndexedFaceSet; if faces are removed during validation, it throws off per-vertex color assignment

===================================================================

M	io_scene_x3d/import_x3d.py

===================================================================

diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index 65548ba..217036b 100644
--- a/io_scene_x3d/import_x3d.py
+++ b/io_scene_x3d/import_x3d.py
@@ -1894,7 +1894,7 @@ def importMesh_IndexedFaceSet(geom, ancestry, bpyima):
 
     bpymesh = bpy.data.meshes.new(name="IndexedFaceSet")
     bpymesh.from_pydata(points, [], faces)
-    bpymesh.validate(False)
+    # No validation here. It throws off the per-face stuff.
 
     # Similar treatment for normal and color indices
 
@@ -1946,11 +1946,13 @@ def importMesh_IndexedFaceSet(geom, ancestry, bpyima):
         if color_per_vertex:
             cco = [cco for f in processPerVertexIndex(color_index)
                    for v in f for cco in rgb[v]]
-            d.foreach_set('color', cco)
-        else:  # Color per face
+        elif color_index:  # Color per face with index
+            cco = [cco for (i, f) in enumerate(faces) for j in f
+                   for cco in rgb[color_index[i]]]
+        else:  # Color per face without index
             cco = [cco for (i, f) in enumerate(faces) for j in f
-                   for cco in rgb[color_index[i] if color_index else i]]
-            d.foreach_set('color', cco)
+                   for cco in rgb[i]]
+        d.foreach_set('color', cco)
 
     # Texture
     if bpyima:



More information about the Bf-extensions-cvs mailing list