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>2011-02-23 00:22:27 +0300
committerLukas Toenne <lukas.toenne@googlemail.com>2011-02-23 00:22:27 +0300
commit2d7b4d1579d3bfeae1b0776013b3c75122fb3b5c (patch)
tree6cae579bac7bcfa28f8bd5a2cd256dba1a972202 /source/blender/editors/space_node/node_draw.c
parente7750aa6ed4c448d4a39cf399b02f6b86c676816 (diff)
Empty groups are now displayed with some basic spacing in edit mode. Long socket lists don't outgrow the group box any more; the box height is adjusted to fit the length of the socket list instead.
Diffstat (limited to 'source/blender/editors/space_node/node_draw.c')
-rw-r--r--source/blender/editors/space_node/node_draw.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 77337f57765..a5f69a2dee2 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -390,6 +390,9 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
int counter;
int dy;
+ rect->xmin = rect->xmax = gnode->locx;
+ rect->ymin = rect->ymax = gnode->locy;
+
/* center them, is a bit of abuse of locx and locy though */
for(node= ngroup->nodes.first; node; node= node->next) {
node->locx+= gnode->locx;
@@ -413,14 +416,9 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
}
/* add some room for links to group sockets */
- rect->xmin -= 3*NODE_DY;
- rect->xmax += 3*NODE_DY;
-
- if(counter==1) return; /* should be prevented? */
-
- rect->xmin-= NODE_DY;
+ rect->xmin -= 4*NODE_DY;
+ rect->xmax += 4*NODE_DY;
rect->ymin-= NODE_DY;
- rect->xmax+= NODE_DY;
rect->ymax+= NODE_DY;
/* input sockets */
@@ -429,6 +427,13 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
gsock->locx = rect->xmin;
sock->locx = rect->xmin - NODE_GROUP_FRAME;
sock->locy = gsock->locy = dy;
+
+ /* prevent long socket lists from growing out of the group box */
+ if (dy-3*NODE_DYS < rect->ymin)
+ rect->ymin = dy-3*NODE_DYS;
+ if (dy+3*NODE_DYS > rect->ymax)
+ rect->ymax = dy+3*NODE_DYS;
+
dy -= 2*NODE_DY;
}
@@ -438,6 +443,13 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
gsock->locx = rect->xmax;
sock->locx = rect->xmax + NODE_GROUP_FRAME;
sock->locy = gsock->locy = dy - NODE_DYS;
+
+ /* prevent long socket lists from growing out of the group box */
+ if (dy-3*NODE_DYS < rect->ymin)
+ rect->ymin = dy-3*NODE_DYS;
+ if (dy+3*NODE_DYS > rect->ymax)
+ rect->ymax = dy+3*NODE_DYS;
+
dy -= 2*NODE_DY;
}
}