Fix: Node Wrangler: Error in Merge Nodes when only one node selected
Running Node Wrangler's Merge Nodes operator on only one node
resulted in an error. It was introduced in commit db39daf9e7.
That commit assumed that `l[len(l)-2]` and `l[-2]` were the same, but
they are not when `len(l) == 1`. In that case, the former is valid but
the latter is not.
This commit fixes the error by checking how many nodes are selected.
Pull Request: https://projects.blender.org/blender/blender/pulls/146361
This commit is contained in:
committed by
Nika Kutsniashvili
parent
e869ae360c
commit
da92614fd2
@@ -769,7 +769,7 @@ class NWMergeNodes(Operator, NWBase):
|
||||
and nodes_list in (selected_math, selected_vector, selected_mix)
|
||||
and mode == 'MIX'):
|
||||
mode = 'ADD'
|
||||
if merge_position == 'CENTER':
|
||||
if merge_position == 'CENTER' and len(nodes_list) >= 2:
|
||||
# average yloc of last two nodes (lowest two)
|
||||
loc_y = ((nodes_list[-1][2]) + (nodes_list[-2][2])) / 2
|
||||
if nodes_list[-1][-1]: # if last node is hidden, mix should be shifted up a bit
|
||||
|
||||
Reference in New Issue
Block a user