glTF exporter: export vertex color alpha

This commit is contained in:
Julien Duroure 2019-08-07 06:59:51 +02:00
parent 8ca469749f
commit 26c53aa581
2 changed files with 15 additions and 7 deletions

View File

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

View File

@ -621,12 +621,20 @@ def extract_primitives(glTF, blender_mesh, blender_vertex_groups, modifiers, exp
for color_index in range(0, color_max):
color_name = COLOR_PREFIX + str(color_index)
color = vertex_colors[color_name].data[loop_index].color
colors.append([
color_srgb_to_scene_linear(color[0]),
color_srgb_to_scene_linear(color[1]),
color_srgb_to_scene_linear(color[2]),
1.0
])
if len(color) == 3:
colors.append([
color_srgb_to_scene_linear(color[0]),
color_srgb_to_scene_linear(color[1]),
color_srgb_to_scene_linear(color[2]),
1.0
])
else:
colors.append([
color_srgb_to_scene_linear(color[0]),
color_srgb_to_scene_linear(color[1]),
color_srgb_to_scene_linear(color[2]),
color[3]
])
#