Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-03-20 17:58:03 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-03-20 17:58:03 +0400
commitf88e48fa55497c1f7d977f36a48555a42625a495 (patch)
treeec15e050e14cf7f942ceed9ae33e34d2bc109060 /source/blender/editors/space_node/node_group.c
parent643365818fc3009cd2558f3bd67a47f7770fc680 (diff)
When making a node group always add one input and one output node, regardless of whether there are any exposed sockets. The standard common case is that some sockets will eventually have to be exposed anyway, and it's easier to just delete the unused node instead of having to look it up in the menu.
Diffstat (limited to 'source/blender/editors/space_node/node_group.c')
-rw-r--r--source/blender/editors/space_node/node_group.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 10f9718f1b6..b1e43a2ef0c 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -730,7 +730,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
float min[2], max[2], center[2];
int totselect;
int expose_all = FALSE;
- bNode *input_node = NULL, *output_node = NULL; /* lazy initialized, in case there are no external links */
+ bNode *input_node, *output_node;
/* XXX rough guess, not nice but we don't have access to UI constants here ... */
static const float offsetx = 200;
@@ -797,6 +797,16 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
/* node groups don't use internal cached data */
ntreeFreeCache(ngroup);
+ /* create input node */
+ input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
+ input_node->locx = min[0] - center[0] - offsetx;
+ input_node->locy = -offsety;
+
+ /* create output node */
+ output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
+ output_node->locx = max[0] - center[0] + offsetx;
+ output_node->locy = -offsety;
+
/* relink external sockets */
for (link = ntree->links.first; link; link = linkn) {
int fromselect = node_group_make_use_node(link->fromnode, gnode);
@@ -818,13 +828,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->tonode, link->tosock);
bNodeSocket *input_sock;
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -843,13 +846,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
bNodeSocket *iosock = ntreeAddSocketInterfaceFromSocket(ngroup, link->fromnode, link->fromsock);
bNodeSocket *output_sock;
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
/* update the group node and interface node sockets,
* so the new interface socket can be linked.
*/
@@ -892,13 +888,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!input_node) {
- input_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_INPUT);
-
- input_node->locx = min[0] - center[0] - offsetx;
- input_node->locy = -offsety;
- }
node_group_input_verify(ngroup, input_node, (ID *)ngroup);
/* create new internal link */
@@ -917,14 +906,6 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree,
iosock = ntreeAddSocketInterfaceFromSocket(ngroup, node, sock);
- /* lazy init */
- if (!output_node) {
- output_node = nodeAddStaticNode(C, ngroup, NODE_GROUP_OUTPUT);
-
- output_node->locx = max[0] - center[0] + offsetx;
- output_node->locy = -offsety;
- }
-
node_group_output_verify(ngroup, output_node, (ID *)ngroup);
/* create new internal link */