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:
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_get.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_get.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_get.py b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
index a16811d8..fd7d4222 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_get.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
@@ -55,8 +55,17 @@ def get_socket_or_texture_slot(blender_material: bpy.types.Material, name: str):
#i = [input for input in blender_material.node_tree.inputs]
#o = [output for output in blender_material.node_tree.outputs]
if name == "Emissive":
+ # Check for a dedicated Emission node first, it must supersede the newer built-in one
+ # 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)]
+ inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
+ if inputs:
+ return inputs[0]
+ # If a dedicated Emission node was not found, fall back to the Principled BSDF Emission socket.
+ name = "Emission"
+ type = bpy.types.ShaderNodeBsdfPrincipled
elif name == "Background":
type = bpy.types.ShaderNodeBackground
name = "Color"