diff options
author | Leon Schittek <leon.schittek@gmx.net> | 2022-03-31 00:07:11 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:31:51 +0300 |
commit | 8d4d4e1f6e8764bb9e9c420c12f6367859f410bc (patch) | |
tree | 0bc55a55ee6ba933f3e7423ad0dfbca7f52c7fbe /source/blender/editors/space_node/node_group.cc | |
parent | 316a6766cdaf87b8a521133ac37f87373dd07160 (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/blender/editors/space_node/node_group.cc')
-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; |