[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35086] trunk/blender/source/blender/ editors/space_node/node_draw.c: Empty groups are now displayed with some basic spacing in edit mode.

Lukas Toenne lukas.toenne at googlemail.com
Tue Feb 22 22:22:27 CET 2011


Revision: 35086
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35086
Author:   lukastoenne
Date:     2011-02-22 21:22:27 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_node/node_draw.c

Modified: trunk/blender/source/blender/editors/space_node/node_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/node_draw.c	2011-02-22 20:49:34 UTC (rev 35085)
+++ trunk/blender/source/blender/editors/space_node/node_draw.c	2011-02-22 21:22:27 UTC (rev 35086)
@@ -390,6 +390,9 @@
 	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 @@
 	}
 	
 	/* 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 @@
 		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 @@
 		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;
 	}
 }




More information about the Bf-blender-cvs mailing list