[Bf-extensions-cvs] [641db219] master: glTF importer: fix vertex color when using specific indices tab
Julien Duroure
noreply at git.blender.org
Fri Feb 22 19:12:10 CET 2019
Commit: 641db2198b572aa268012370c1ac8c4b3e62db60
Author: Julien Duroure
Date: Fri Feb 22 18:45:36 2019 +0100
Branches: master
https://developer.blender.org/rBA641db2198b572aa268012370c1ac8c4b3e62db60
glTF importer: fix vertex color when using specific indices tab
===================================================================
M io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
===================================================================
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index 4439a05c..b4263e34 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -169,7 +169,16 @@ class BlenderMesh():
if vertex_color is None:
vertex_color = obj.data.vertex_colors.new(name="COLOR_0")
- color_data = BinaryData.get_data_from_accessor(gltf, prim.attributes['COLOR_0'])
+ original_color_data = BinaryData.get_data_from_accessor(gltf, prim.attributes['COLOR_0'])
+
+ tmp_indices = {}
+ tmp_idx = 0
+ color_data = []
+ for i in prim.tmp_indices:
+ if i[0] not in tmp_indices.keys():
+ tmp_indices[i[0]] = tmp_idx
+ tmp_idx += 1
+ color_data.append(original_color_data[i[0]])
for poly in mesh.polygons:
for loop_idx in range(poly.loop_start, poly.loop_start + poly.loop_total):
More information about the Bf-extensions-cvs
mailing list