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>2020-02-22 10:13:21 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-02-22 10:13:21 +0300
commitfb2b2f5cff3ba0256eeff5db217eefde421b25e3 (patch)
tree2e63508335923a98ed97133d511e1f27f4254047
parent1e5d8bd56d968ae29f7d648b95462aa8c3acecff (diff)
glTF: vertex color is RGBA in 2.80+
After removing 2.79 support in upstream repo, we can simplify the code
-rwxr-xr-xio_scene_gltf2/__init__.py2
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_extract.py20
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_primitive.py8
3 files changed, 8 insertions, 22 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 4bbfbd81..0ea3e23f 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -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": (1, 2, 21),
+ "version": (1, 2, 22),
'blender': (2, 82, 7),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
index c7758538..5aef2ca9 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
@@ -671,20 +671,12 @@ def extract_primitives(glTF, blender_mesh, blender_object, blender_vertex_groups
for color_index in range(0, color_max):
color_name = COLOR_PREFIX + str(color_index)
color = vertex_colors[color_name].data[loop_index].color
- 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]
- ])
+ 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]
+ ])
#
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
index fb64df6f..fb515e0f 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
@@ -196,13 +196,7 @@ class BlenderPrimitive():
colors = BinaryData.get_data_from_accessor(gltf, attributes['COLOR_%d' % set_num], cache=True)
- # Check whether Blender takes RGB or RGBA colors (old versions only take RGB)
is_rgba = len(colors[0]) == 4
- blender_num_components = len(bme_verts[0].link_loops[0][layer])
- if is_rgba and blender_num_components == 3:
- gltf2_io_debug.print_console("WARNING",
- "this Blender doesn't support RGBA vertex colors; dropping A"
- )
for bidx, pidx in vert_idxs:
color = colors[pidx]
@@ -211,7 +205,7 @@ class BlenderPrimitive():
color_linear_to_srgb(color[1]),
color_linear_to_srgb(color[2]),
color[3] if is_rgba else 1.0,
- )[:blender_num_components]
+ )
for loop in bme_verts[bidx].link_loops:
loop[layer] = col