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>2019-04-20 00:06:18 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-04-20 00:06:18 +0300
commite49613a5f9c879b1b525e8ac3e3c8af31c3eabcd (patch)
treed8e799111a5878e86eff2906daeb45d513e02446 /io_scene_gltf2/blender/exp/gltf2_blender_get.py
parente4165cee8b34b216db5ff41b20b9a05991a4b4b7 (diff)
glTF: better occlusion map management
At import, create a node group where you can link an image texture At export, use this node group to create correctly the material TODO: doc update
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_get.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_get.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_get.py b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
index 27d8a341..fef2e684 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_get.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_get.py
@@ -15,6 +15,7 @@
import bpy
from mathutils import Vector, Matrix
+from ..com.gltf2_blender_material_helpers import get_gltf_node_name
from ...blender.com.gltf2_blender_conversion import texture_transform_blender_to_gltf
from io_scene_gltf2.io.com import gltf2_io_debug
@@ -73,16 +74,17 @@ def get_socket_or_texture_slot(blender_material: bpy.types.Material, name: str):
def get_socket_or_texture_slot_old(blender_material: bpy.types.Material, name: str):
"""
- For a given material input name, retrieve the corresponding node tree socket in the special glTF Metallic Roughness nodes (which might be deprecated?).
+ For a given material input name, retrieve the corresponding node tree socket in the special glTF node group.
:param blender_material: a blender material for which to get the socket/slot
:param name: the name of the socket/slot
:return: either a blender NodeSocket, if the material is a node tree or a blender Texture otherwise
"""
+ gltf_node_group_name = get_gltf_node_name().lower()
if blender_material.node_tree and blender_material.use_nodes:
nodes = [n for n in blender_material.node_tree.nodes if \
isinstance(n, bpy.types.ShaderNodeGroup) and \
- n.node_tree.name.startswith('glTF Metallic Roughness')]
+ (n.node_tree.name.startswith('glTF Metallic Roughness') or n.node_tree.name.lower() == gltf_node_group_name)]
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if inputs:
return inputs[0]