[Bf-extensions-cvs] [b966913c] master: glTF importer: use emission/alpha sockets on Principled node

Julien Duroure noreply at git.blender.org
Sun Feb 23 12:04:25 CET 2020


Commit: b966913caab34eef52f148f9ccf6770cf527d87b
Author: Julien Duroure
Date:   Sun Feb 23 12:03:50 2020 +0100
Branches: master
https://developer.blender.org/rBAb966913caab34eef52f148f9ccf6770cf527d87b

glTF importer: use emission/alpha sockets on Principled node

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 29856ca6..df658cad 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, 2, 29),
+    "version": (1, 2, 30),
     'blender': (2, 82, 7),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
index 1c295981..a4910fa0 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_pbrMetallicRoughness.py
@@ -46,28 +46,25 @@ def pbr_metallic_roughness(mh: MaterialHelper):
     pbr_node = mh.node_tree.nodes.new('ShaderNodeBsdfPrincipled')
     pbr_node.location = 10, 300
 
-    # Create material output.
-    # TODO: when the exporter can understand them, use the emission/alpha
-    #       socket on the Principled node instead
-    emission_socket, alpha_socket = make_output_nodes(
+    make_output_nodes(
         mh,
         location=(250, 260),
         shader_socket=pbr_node.outputs[0],
-        make_emission_socket=mh.needs_emissive(),
-        make_alpha_socket=not mh.is_opaque(),
+        make_emission_socket=False,
+        make_alpha_socket=False,
     )
 
     emission(
         mh,
         location=(-200, 860),
-        color_socket=emission_socket,
+        color_socket=pbr_node.inputs['Emission'],
     )
 
     base_color(
         mh,
         location=(-200, 380),
         color_socket=pbr_node.inputs['Base Color'],
-        alpha_socket=alpha_socket,
+        alpha_socket=pbr_node.inputs['Alpha'] if not mh.is_opaque() else None,
     )
 
     metallic_roughness(



More information about the Bf-extensions-cvs mailing list