Magic UV: Get nodes with their types instead of names #104402

Merged
nutti merged 1 commits from pioverfour/blender-addons:dp_fix_new_mat_issue_magicuv into main 2023-02-11 01:33:23 +01:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit cd5d278353 - Show all commits

View File

@ -449,7 +449,8 @@ class MUV_OT_TextureProjection_Project(bpy.types.Operator):
# assign image # assign image
if compat.check_version(2, 80, 0) >= 0: if compat.check_version(2, 80, 0) >= 0:
node_tree = obj.active_material.node_tree node_tree = obj.active_material.node_tree
output_node = node_tree.nodes["Material Output"] output_node = next(n for n in node_tree.nodes
if n.type == "OUTPUT_MATERIAL")
nodes = common.find_texture_nodes_from_material( nodes = common.find_texture_nodes_from_material(
obj.active_material) obj.active_material)

View File

@ -447,7 +447,8 @@ class MUV_OT_UVInspection_PaintUVIsland(bpy.types.Operator):
"MagicUV_PaintUVMaterial_{}".format(i)) "MagicUV_PaintUVMaterial_{}".format(i))
if compat.check_version(2, 80, 0) >= 0: if compat.check_version(2, 80, 0) >= 0:
target_mtrl.use_nodes = True target_mtrl.use_nodes = True
output_node = target_mtrl.node_tree.nodes["Material Output"] output_node = next(n for n in target_mtrl.node_tree.nodes
if n.type == "OUTPUT_MATERIAL")
nodes_to_remove = [n for n in target_mtrl.node_tree.nodes nodes_to_remove = [n for n in target_mtrl.node_tree.nodes
if n != output_node] if n != output_node]
for n in nodes_to_remove: for n in nodes_to_remove: