Merge branch 'blender-v3.3-release'

This commit is contained in:
Julien Duroure 2022-08-06 12:08:18 +02:00
commit fbf268d184
5 changed files with 13 additions and 10 deletions

View File

@ -4,7 +4,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 4, 3),
"version": (3, 4, 4),
'blender': (3, 3, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@ -1257,7 +1257,7 @@ class GLTF_AddonPreferences(bpy.types.AddonPreferences):
settings_node_ui : bpy.props.BoolProperty(
default= False,
description="Displays glTF Settings node in Shader Editor (Menu Add > Output)"
description="Displays glTF Material Output node in Shader Editor (Menu Add > Output)"
)
KHR_materials_variants_ui : bpy.props.BoolProperty(

View File

@ -3,9 +3,13 @@
import bpy
def get_gltf_node_name():
# Get compatibility at export with old files
def get_gltf_node_old_name():
return "glTF Settings"
def get_gltf_node_name():
return "glTF Material Output"
def create_settings_group(name):
gltf_node_group = bpy.data.node_groups.new(name, 'ShaderNodeTree')
gltf_node_group.inputs.new("NodeSocketFloat", "Occlusion")

View File

@ -5,7 +5,7 @@ import bpy
from ..com.gltf2_blender_material_helpers import get_gltf_node_name, create_settings_group
from ..com.gltf2_blender_material_helpers import get_gltf_pbr_non_converted_name, create_gltf_pbr_non_converted_group
################ glTF Settings node ###########################################
################ glTF Material Output node ###########################################
def create_gltf_ao_group(operator, group_name):
@ -16,10 +16,9 @@ def create_gltf_ao_group(operator, group_name):
class NODE_OT_GLTF_SETTINGS(bpy.types.Operator):
bl_idname = "node.gltf_settings_node_operator"
bl_label = "glTF Settings"
bl_label = "glTF Material Ouptut"
bl_description = "Add a node to the active tree for glTF export"
@classmethod
def poll(cls, context):
space = context.space_data

View File

@ -4,7 +4,7 @@
import bpy
from mathutils import Vector, Matrix
from ..com.gltf2_blender_material_helpers import get_gltf_node_name, get_gltf_pbr_non_converted_name
from ..com.gltf2_blender_material_helpers import get_gltf_node_name, get_gltf_node_old_name, get_gltf_pbr_non_converted_name
from ...blender.com.gltf2_blender_conversion import texture_transform_blender_to_gltf
from io_scene_gltf2.io.com import gltf2_io_debug
from io_scene_gltf2.blender.exp import gltf2_blender_search_node_tree
@ -94,11 +94,11 @@ def get_socket_old(blender_material: bpy.types.Material, name: str):
:param name: the name of the socket
:return: a blender NodeSocket
"""
gltf_node_group_name = get_gltf_node_name().lower()
gltf_node_group_names = [get_gltf_node_name().lower(), get_gltf_node_old_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') or n.node_tree.name.lower() == gltf_node_group_name)]
(n.node_tree.name.startswith('glTF Metallic Roughness') or n.node_tree.name.lower() in gltf_node_group_names)]
inputs = sum([[input for input in node.inputs if input.name == name] for node in nodes], [])
if inputs:
return inputs[0]

View File

@ -65,7 +65,7 @@ def pbr_metallic_roughness(mh: MaterialHelper):
need_volume_node = True
# We also need glTF Settings Node, to set thicknessFactor and thicknessTexture
# We also need glTF Material Output Node, to set thicknessFactor and thicknessTexture
mh.settings_node = make_settings_node(mh)
mh.settings_node.location = additional_location
mh.settings_node.width = 180