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

View File

@ -449,7 +449,8 @@ class MUV_OT_TextureProjection_Project(bpy.types.Operator):
# assign image
if compat.check_version(2, 80, 0) >= 0:
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(
obj.active_material)

View File

@ -447,7 +447,8 @@ class MUV_OT_UVInspection_PaintUVIsland(bpy.types.Operator):
"MagicUV_PaintUVMaterial_{}".format(i))
if compat.check_version(2, 80, 0) >= 0:
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
if n != output_node]
for n in nodes_to_remove: