glTF exporter: ignore muted node when checking tree

This commit is contained in:
Julien Duroure 2020-09-16 17:55:40 +02:00
parent 8e1b4dd71b
commit d7d2bad09f
Notes: blender-bot 2023-02-14 18:51:12 +01:00
Referenced by issue #78926, Materials export blank if unconnected Principled BSDF node is anywhere in a "Background" material during gltf 2.0 export
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,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": (1, 4, 22),
"version": (1, 4, 23),
'blender': (2, 90, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -59,7 +59,7 @@ def get_socket(blender_material: bpy.types.Material, name: str):
# because the newer one is always present in all Principled BSDF materials.
type = bpy.types.ShaderNodeEmission
name = "Color"
nodes = [n for n in blender_material.node_tree.nodes if isinstance(n, type)]
nodes = [n for n in blender_material.node_tree.nodes if isinstance(n, type) and not n.mute]
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if inputs:
return inputs[0]
@ -71,7 +71,7 @@ def get_socket(blender_material: bpy.types.Material, name: str):
name = "Color"
else:
type = bpy.types.ShaderNodeBsdfPrincipled
nodes = [n for n in blender_material.node_tree.nodes if isinstance(n, type)]
nodes = [n for n in blender_material.node_tree.nodes if isinstance(n, type) and not n.mute]
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if inputs:
return inputs[0]