Fix - Restore deleting default shader nodes, after recent Blender changes

This commit is contained in:
Julien Duroure
2025-10-04 23:37:34 +02:00
parent 49414a72f6
commit ad131310e3
2 changed files with 3 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ bl_info = {
# This is now displayed as the maintainer, so show the foundation.
# "author": "Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein", # Original Authors
'author': "Blender Foundation, Khronos Group",
"version": (5, 0, 20),
"version": (5, 0, 21),
'blender': (4, 4, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@@ -23,7 +23,7 @@ class BlenderMaterial():
if material_idx is None:
# If no material is specified, we create a default one
mat = bpy.data.materials.new(name="DefaultMaterial")
# Since Blender 5.0, no need to remove default nodes, as they are not created by default
mat.node_tree.nodes.clear()
output_node = mat.node_tree.nodes.new(type='ShaderNodeOutputMaterial')
output_node.location = (0, 0)
shader_node = mat.node_tree.nodes.new(type='ShaderNodeBsdfPrincipled')
@@ -53,7 +53,7 @@ class BlenderMaterial():
BlenderMaterial.set_eevee_surface_render_method(pymaterial, mat)
BlenderMaterial.set_viewport_color(pymaterial, mat, vertex_color)
# Since Blender 5.0, no need to remove default nodes, as they are not created by default
mat.node_tree.nodes.clear()
mh = MaterialHelper(gltf, pymaterial, mat, vertex_color)