Fix #104470: Node Wrangler: Lazy Connect changed behaviour #104542
@ -3,8 +3,8 @@
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "Node Wrangler",
|
"name": "Node Wrangler",
|
||||||
"author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
|
"author": "Bartek Skorupa, Greg Zaal, Sebastian Koenig, Christian Brinkmann, Florian Meyer",
|
||||||
"version": (3, 44),
|
"version": (3, 45),
|
||||||
"blender": (3, 4, 0),
|
"blender": (3, 6, 0),
|
||||||
"location": "Node Editor Toolbar or Shift-W",
|
"location": "Node Editor Toolbar or Shift-W",
|
||||||
"description": "Various tools to enhance and speed up node-based workflow",
|
"description": "Various tools to enhance and speed up node-based workflow",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
from bpy_extras.node_utils import connect_sockets
|
||||||
from math import hypot
|
from math import hypot
|
||||||
|
|
||||||
|
|
||||||
@ -29,48 +30,42 @@ def node_mid_pt(node, axis):
|
|||||||
|
|
||||||
|
|
||||||
def autolink(node1, node2, links):
|
def autolink(node1, node2, links):
|
||||||
link_made = False
|
|
||||||
available_inputs = [inp for inp in node2.inputs if inp.enabled]
|
available_inputs = [inp for inp in node2.inputs if inp.enabled]
|
||||||
available_outputs = [outp for outp in node1.outputs if outp.enabled]
|
available_outputs = [outp for outp in node1.outputs if outp.enabled]
|
||||||
for outp in available_outputs:
|
for outp in available_outputs:
|
||||||
for inp in available_inputs:
|
for inp in available_inputs:
|
||||||
if not inp.is_linked and inp.name == outp.name:
|
if not inp.is_linked and inp.name == outp.name:
|
||||||
link_made = True
|
connect_sockets(outp, inp)
|
||||||
links.new(outp, inp)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
for outp in available_outputs:
|
for outp in available_outputs:
|
||||||
for inp in available_inputs:
|
for inp in available_inputs:
|
||||||
if not inp.is_linked and inp.type == outp.type:
|
if not inp.is_linked and inp.type == outp.type:
|
||||||
link_made = True
|
connect_sockets(outp, inp)
|
||||||
links.new(outp, inp)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# force some connection even if the type doesn't match
|
# force some connection even if the type doesn't match
|
||||||
if available_outputs:
|
if available_outputs:
|
||||||
for inp in available_inputs:
|
for inp in available_inputs:
|
||||||
if not inp.is_linked:
|
if not inp.is_linked:
|
||||||
link_made = True
|
connect_sockets(available_outputs[0], inp)
|
||||||
links.new(available_outputs[0], inp)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# even if no sockets are open, force one of matching type
|
# even if no sockets are open, force one of matching type
|
||||||
for outp in available_outputs:
|
for outp in available_outputs:
|
||||||
for inp in available_inputs:
|
for inp in available_inputs:
|
||||||
if inp.type == outp.type:
|
if inp.type == outp.type:
|
||||||
link_made = True
|
connect_sockets(outp, inp)
|
||||||
links.new(outp, inp)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# do something!
|
# do something!
|
||||||
for outp in available_outputs:
|
for outp in available_outputs:
|
||||||
for inp in available_inputs:
|
for inp in available_inputs:
|
||||||
link_made = True
|
connect_sockets(outp, inp)
|
||||||
links.new(outp, inp)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
print("Could not make a link from " + node1.name + " to " + node2.name)
|
print("Could not make a link from " + node1.name + " to " + node2.name)
|
||||||
return link_made
|
return False
|
||||||
|
|
||||||
|
|
||||||
def abs_node_location(node):
|
def abs_node_location(node):
|
||||||
|
Loading…
Reference in New Issue
Block a user