glTF exporter: Fix color attribute export

This commit is contained in:
Julien Duroure 2022-09-28 08:25:51 +02:00
parent 06ad75f38d
commit 4feb92043c
Notes: blender-bot 2023-02-14 18:19:19 +01:00
Referenced by issue blender/blender#100749: Blender LTS: Maintenance Task 3.3
Referenced by issue blender/blender#100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #99005, gltf exporter does not export non-byte color and non-face-corner vertex colors in 3.3 alpha
2 changed files with 9 additions and 13 deletions

View File

@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 3, 31),
"version": (3, 3, 32),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -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 export_settings[gltf2_blender_export_keys.COLORS]:
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 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