Nodes: new operator to join Group Input nodes

This adds a new operator which can join multiple nodes together. Currently, it
only supports joining Group Input nodes. However, in the future it could be
extended to join e.g. Bake and Capture Attribute nodes.

This uses the recently freed up ctrl+J shortcut for this functionality, which
feels natural to me.

The implementation is fairly straight forward. The main tricky aspect is
sometimes the nodes can't be joined when that would result in two sockets being
linked to each other twice. In this case, the a separate Group Input node is
kept.

The selected nodes are merged into the active node (in case the active node is
part of the selection, otherwise there is a fallback).

Pull Request: https://projects.blender.org/blender/blender/pulls/146894
This commit is contained in:
Jacques Lucke
2025-09-29 13:58:27 +02:00
parent cadb3fe5c5
commit f025637e3b
5 changed files with 121 additions and 7 deletions

View File

@@ -2230,6 +2230,7 @@ def km_node_editor(params):
{"properties": [("replace", False)]}),
("node.link_make", {"type": 'J', "value": 'PRESS', "shift": True},
{"properties": [("replace", True)]}),
("node.join_nodes", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
op_menu("NODE_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
op_menu("NODE_MT_swap", {"type": 'S', "value": 'PRESS', "shift": True}),
("node.duplicate_move", {"type": 'D', "value": 'PRESS', "shift": True},

View File

@@ -440,6 +440,7 @@ class NODE_MT_node(Menu):
layout.separator()
layout.operator("node.join", text="Join in New Frame")
layout.operator("node.detach", text="Remove from Frame")
layout.operator("node.join_nodes", text="Join Group Inputs")
layout.separator()
props = layout.operator("wm.call_panel", text="Rename...")