[Bf-blender-cvs] [4edde244da3] master: Nodes: Cut hidden links when creating node groups

Leon Schittek noreply at git.blender.org
Wed Mar 30 23:08:13 CEST 2022


Commit: 4edde244da3371f098e44fcf814e9be3a7485b3f
Author: Leon Schittek
Date:   Wed Mar 30 23:07:11 2022 +0200
Branches: master
https://developer.blender.org/rB4edde244da3371f098e44fcf814e9be3a7485b3f

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

===================================================================

M	source/blender/editors/space_node/node_group.cc

===================================================================

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;



More information about the Bf-blender-cvs mailing list