[Bf-blender-cvs] [cca1649b201] master: Nodes: discard hidden sockets when grouping a single node.

Miguel Porces noreply at git.blender.org
Tue Oct 1 20:22:00 CEST 2019


Commit: cca1649b20162939e4be1d8ea51fedfc511a6f15
Author: Miguel Porces
Date:   Tue Oct 1 20:21:12 2019 +0200
Branches: master
https://developer.blender.org/rBcca1649b20162939e4be1d8ea51fedfc511a6f15

Nodes: discard hidden sockets when grouping a single node.

At the moment, grouping a single node that has hidden sockets, exposes all
sockets in the node group. This patch just filters hidden sockets, so that
the node group's interface remains the same as the node being grouped.

Differential Revision: https://developer.blender.org/D5533

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

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

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

diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 588fc4d4307..08ac84cbb2f 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -717,7 +717,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
   ListBase anim_basepaths = {NULL, NULL};
   float min[2], max[2], center[2];
   int totselect;
-  bool expose_all = false;
+  bool expose_visible = false;
   bNode *input_node, *output_node;
 
   /* XXX rough guess, not nice but we don't have access to UI constants here ... */
@@ -735,7 +735,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
 
   /* auto-add interface for "solo" nodes */
   if (totselect == 1) {
-    expose_all = true;
+    expose_visible = true;
   }
 
   /* move nodes over */
@@ -879,8 +879,8 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
     }
   }
 
-  /* expose all unlinked sockets too */
-  if (expose_all) {
+  /* expose all unlinked sockets too but only the visible ones*/
+  if (expose_visible) {
     for (node = ngroup->nodes.first; node; node = node->next) {
       if (node_group_make_use_node(node, gnode)) {
         for (sock = node->inputs.first; sock; sock = sock->next) {
@@ -892,6 +892,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
               break;
             }
           }
+          if (sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) {
+              skip = true;
+          }
           if (skip) {
             continue;
           }
@@ -913,6 +916,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
               skip = true;
             }
           }
+          if (sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) {
+              skip = true;
+          }
           if (skip) {
             continue;
           }



More information about the Bf-blender-cvs mailing list