diff options
-rwxr-xr-x | io_scene_gltf2/__init__.py | 2 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_get.py | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index cddc50fd..3a048afe 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, 1, 5), + "version": (1, 1, 6), 'blender': (2, 81, 6), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', 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" |