Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-02-22 20:45:36 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-02-22 20:45:36 +0300
commit641db2198b572aa268012370c1ac8c4b3e62db60 (patch)
treecfc3644a8d147b3393efed63b7575b17b18e299c
parent14c202c04cd225192f23d1ea61d5b1dd8c76e266 (diff)
glTF importer: fix vertex color when using specific indices tab
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py11
1 files changed, 10 insertions, 1 deletions
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):