diff options
author | Leon Schittek <leon.schittek@gmx.net> | 2022-03-31 00:07:11 +0300 |
---|---|---|
committer | Leon Schittek <leon.schittek@gmx.net> | 2022-03-31 00:07:11 +0300 |
commit | 4edde244da3371f098e44fcf814e9be3a7485b3f (patch) | |
tree | 4e7c9b7f47d50065bd0beccb4f17e90947984835 /source | |
parent | 26700320389cdc82c48ac3a33b215427522fe2b8 (diff) |
Nodes: Cut hidden links when creating node groups
Add a check to the creation of node groups to remove hidden links
that are connected to the outside of the node group. This avoids
creating sockets in the group's interface that aren't (visibly)
connected to anything within the node group.
Reviewed By: Jacques Lucke, Hans Goudey
Differential Revision: https://developer.blender.org/D14249
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/node_group.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 789476a8179..8d5ae12fd93 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -841,6 +841,12 @@ static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree, nodeRemLink(&ntree, link); } else if (toselect && !fromselect) { + /* Remove hidden links to not create unconnected sockets in the interface. */ + if (nodeLinkIsHidden(link)){ + nodeRemLink(&ntree, link); + continue; + } + bNodeSocket *link_sock; bNode *link_node; node_socket_skip_reroutes(&ntree.links, link->tonode, link->tosock, &link_node, &link_sock); @@ -861,6 +867,12 @@ static void node_group_make_insert_selected(const bContext &C, bNodeTree &ntree, link->tosock = node_group_find_input_socket(gnode, iosock->identifier); } else if (fromselect && !toselect) { + /* Remove hidden links to not create unconnected sockets in the interface. */ + if (nodeLinkIsHidden(link)){ + nodeRemLink(&ntree, link); + continue; + } + /* First check whether the source of this link is already connected to an output. * If yes, reuse that output instead of duplicating it. */ bool connected = false; |