From 3272f2702d2dec410cfee7e6e4e7b0f511b4c25b Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Sun, 28 Jan 2024 17:00:11 +0100 Subject: [PATCH] glTF exporter: check VC directly on Base Color socket --- io_scene_gltf2/__init__.py | 2 +- .../blender/exp/material/gltf2_blender_search_node_tree.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index 3ecffe3b..9a07073f 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -5,7 +5,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": (4, 1, 43), + "version": (4, 1, 44), 'blender': (4, 1, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/exp/material/gltf2_blender_search_node_tree.py b/io_scene_gltf2/blender/exp/material/gltf2_blender_search_node_tree.py index be9c8246..a5bd46b5 100644 --- a/io_scene_gltf2/blender/exp/material/gltf2_blender_search_node_tree.py +++ b/io_scene_gltf2/blender/exp/material/gltf2_blender_search_node_tree.py @@ -461,6 +461,12 @@ def get_vertex_color_info(color_socket, alpha_socket, export_settings): attribute_color_type = "active" elif use_vc is True and use_active is None and attribute_color is not None: attribute_color_type = "name" + elif node.node.type in ["ATTRIBUTE", "VERTEX_COLOR"]: + use_vc, attribute_color, use_active = get_attribute_name(NodeSocket(node.node.outputs[0], node.group_path), export_settings) + if use_vc is True and use_active is True: + attribute_color_type = "active" + elif use_vc is True and use_active is None and attribute_color is not None: + attribute_color_type = "name" if alpha_socket is not None and alpha_socket.socket is not None: node = previous_node(alpha_socket) @@ -473,6 +479,12 @@ def get_vertex_color_info(color_socket, alpha_socket, export_settings): attribute_alpha_type = "active" elif use_vc is True and use_active is None and attribute_alpha is not None: attribute_alpha_type = "name" + elif node.node.type in ["ATTRIBUTE", "VERTEX_COLOR"]: + use_vc, attribute_color, use_active = get_attribute_name(NodeSocket(node.node.outputs[0], node.group_path), export_settings) + if use_vc is True and use_active is True: + attribute_color_type = "active" + elif use_vc is True and use_active is None and attribute_color is not None: + attribute_color_type = "name" return {"color": attribute_color, "alpha": attribute_alpha, "color_type": attribute_color_type, "alpha_type": attribute_alpha_type} -- 2.11.4.GIT