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>2018-12-01 08:04:52 +0300
committerJulien Duroure <julien.duroure@gmail.com>2018-12-01 08:04:52 +0300
commit40b00140cbf8a8ea06922d984787493062bce52b (patch)
treeb83b07000d9559a9e8d4296574915cad300f4423 /io_scene_gltf2/blender/exp/gltf2_blender_get.py
parent9a627ee667454ce92fbce908f887fe6577f0b297 (diff)
glTF : fixes for emission export, correction nodes for lights & camera
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_get.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_get.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_get.py b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
index 468ba692..03078225 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_get.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
@@ -43,17 +43,14 @@ def get_socket_or_texture_slot(blender_material: bpy.types.Material, name: str):
:return: either a blender NodeSocket, if the material is a node tree or a blender Texture otherwise
"""
if blender_material.node_tree and blender_material.use_nodes:
- if name == "Emissive":
- # Emissive is a special case as the input node in the 'Emission' shader node is named 'Color' and only the
- # output is named 'Emission'
- links = [link for link in blender_material.node_tree.links if link.from_socket.name == 'Emission']
- if not links:
- return None
- return links[0].to_socket
i = [input for input in blender_material.node_tree.inputs]
o = [output for output in blender_material.node_tree.outputs]
nodes = [node for node in blender_material.node_tree.nodes]
- nodes = filter(lambda n: isinstance(n, bpy.types.ShaderNodeBsdfPrincipled), nodes)
+ if name == "Emissive":
+ nodes = filter(lambda n: isinstance(n, bpy.types.ShaderNodeEmission), nodes)
+ name = "Color"
+ else:
+ nodes = filter(lambda n: isinstance(n, bpy.types.ShaderNodeBsdfPrincipled), nodes)
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if not inputs:
return None