From cca1649b20162939e4be1d8ea51fedfc511a6f15 Mon Sep 17 00:00:00 2001 From: Miguel Porces Date: Tue, 1 Oct 2019 20:21:12 +0200 Subject: [PATCH] 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 --- source/blender/editors/space_node/node_group.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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; }