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>2022-10-21 19:41:06 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-10-21 19:41:06 +0300
commitcd2d9df92577b860419c5b591b9bdd97eb70803d (patch)
tree2190e10b15ed8e1d409a6899f10d0a7c3c8fe14a
parenta1706bd0f04b03ff3fcf52d81acc6e42b4ae96db (diff)
glTF importer: tweak vertex color import
- The first imported one is now set as the rendered one - Color Attribute Node does no more specify the layer, so rendered one is used
-rwxr-xr-xio_scene_gltf2/__init__.py2
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py4
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py2
3 files changed, 6 insertions, 2 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 6650f18d..d06b8b08 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -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, 4, 37),
+ "version": (3, 4, 38),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index c29f5a27..395fde0f 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -305,6 +305,10 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
mesh.color_attributes[layer.name].data.foreach_set('color', squish(loop_cols[col_i]))
+ # Make sure the first Vertex Color Attribute is the rendered one
+ if num_cols > 0:
+ mesh.color_attributes.render_color_index = 0
+
# Skinning
# TODO: this is slow :/
if num_joint_sets and mesh_options.skinning:
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
index b6b8e19f..18cb68ab 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
@@ -440,7 +440,7 @@ def base_color(
# Vertex Color
if mh.vertex_color:
node = mh.node_tree.nodes.new('ShaderNodeVertexColor')
- node.layer_name = 'Col'
+ # Do not set the layer name, so rendered one will be used (At import => The first one)
node.location = x - 250, y - 240
# Outputs
mh.node_tree.links.new(vcolor_color_socket, node.outputs['Color'])