Skip to content

Commit

Permalink
Fix: Cannot make optimize button disappear when there's a layer using…
Browse files Browse the repository at this point in the history
… normal map
  • Loading branch information
ucupumar committed Apr 5, 2024
1 parent e8dfa34 commit 59a329d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bl_info = {
"name": "Ucupaint",
"author": "Yusuf Umar, Agni Rakai Sahakarya, Jan Bláha, Ahmad Rifai, morirain, Patrick W. Crawford, neomonkeus",
"version": (1, 2, 1),
"version": (1, 2, 2),
"blender": (2, 80, 0),
"location": "Node Editor > Properties > Ucupaint",
"warning": "",
Expand Down
8 changes: 5 additions & 3 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3247,16 +3247,18 @@ def is_normal_input_unconnected_but_has_wrong_normal_process(node, index, root_c
if root_ch.type != 'NORMAL': return False
unconnected = len(node.inputs[index].links) == 0 and not yp.use_baked
end_linear = node.node_tree.nodes.get(root_ch.end_linear)
if unconnected and end_linear and end_linear.type == 'GROUP' and end_linear.node_tree and 'No Overlay' not in end_linear.node_tree.name:
return True
if (unconnected and not any_layers_using_normal_map(root_ch)
and end_linear and end_linear.type == 'GROUP' and end_linear.node_tree and 'No Overlay' not in end_linear.node_tree.name):
return True
return False

def is_normal_input_connected_but_has_wrong_normal_process(node, index, root_ch):
yp = node.node_tree.yp
if root_ch.type != 'NORMAL': return False
connected = len(node.inputs[index].links) > 0 and not yp.use_baked
end_linear = node.node_tree.nodes.get(root_ch.end_linear)
if connected and end_linear and end_linear.type == 'GROUP' and end_linear.node_tree and 'No Overlay' in end_linear.node_tree.name:
if ((connected or any_layers_using_normal_map(root_ch))
and end_linear and end_linear.type == 'GROUP' and end_linear.node_tree and 'No Overlay' in end_linear.node_tree.name):
return True
return False

Expand Down

0 comments on commit 59a329d

Please sign in to comment.