diff options
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_extract.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_extract.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py index 61906ba0..fd1dce31 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py @@ -35,20 +35,16 @@ def extract_primitives(blender_mesh, uuid_for_skined_data, blender_vertex_groups if blender_mesh.uv_layers.active: tex_coord_max = len(blender_mesh.uv_layers) - color_max = 0 - if export_settings[gltf2_blender_export_keys.COLORS]: - color_max = len(blender_mesh.vertex_colors) - colors_attributes = [] - rendered_color_idx = blender_mesh.attributes.render_color_index - - if color_max > 0: - colors_attributes.append(rendered_color_idx) - # Then find other ones - colors_attributes.extend([ - i for i in range(len(blender_mesh.color_attributes)) if i != rendered_color_idx \ - and blender_mesh.vertex_colors.find(blender_mesh.color_attributes[i].name) != -1 - ]) + if export_settings[gltf2_blender_export_keys.COLORS]: + rendered_color_idx = blender_mesh.attributes.render_color_index + + if rendered_color_idx > -1: + colors_attributes.append(rendered_color_idx) + # Then find other ones + colors_attributes.extend([ + i for i in range(len(blender_mesh.color_attributes)) if i != rendered_color_idx + ]) armature = None |