[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53088] trunk/blender/source/blender/ editors: UI fixes:

Ton Roosendaal ton at blender.org
Mon Dec 17 18:37:49 CET 2012


Revision: 53088
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53088
Author:   ton
Date:     2012-12-17 17:37:48 +0000 (Mon, 17 Dec 2012)
Log Message:
-----------
UI fixes:

- on setting lower DPI, the regions that were scrolled down would start moving down
  1 pixel on every draw. Caused by rounding error. (int + 0.1 vs int -0.1)
  (Ancient bug)

- circles used in outliner - to denote selection/active - now draw bigger, and better
  centered. (2.66 fix only)

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/view2d.c
    trunk/blender/source/blender/editors/screen/area.c
    trunk/blender/source/blender/editors/space_outliner/outliner_draw.c

Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c	2012-12-17 15:17:51 UTC (rev 53087)
+++ trunk/blender/source/blender/editors/interface/view2d.c	2012-12-17 17:37:48 UTC (rev 53088)
@@ -852,10 +852,11 @@
 	
 	/* hrumf! */
 	/* XXX: there are work arounds for this in the panel and file browse code. */
+	/* round to int, because this is called with width + V2D_SCROLL_WIDTH */
 	if (scroll & V2D_SCROLL_HORIZONTAL) 
-		width -= V2D_SCROLL_WIDTH;
+		width -= (int)V2D_SCROLL_WIDTH;
 	if (scroll & V2D_SCROLL_VERTICAL) 
-		height -= V2D_SCROLL_HEIGHT;
+		height -= (int)V2D_SCROLL_HEIGHT;
 	
 	if (ELEM(0, width, height)) {
 		if (G.debug & G_DEBUG)

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c	2012-12-17 15:17:51 UTC (rev 53087)
+++ trunk/blender/source/blender/editors/screen/area.c	2012-12-17 17:37:48 UTC (rev 53088)
@@ -1703,7 +1703,7 @@
 		v2d->keepofs &= ~(V2D_LOCKOFS_Y | V2D_KEEPOFS_X);
 		v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
 		v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
-		
+
 		/* ensure tot is set correctly, to keep views on bottons, with sliders */
 		y = min_ii(y, v2d->cur.ymin);
 		y = -y;
@@ -1724,8 +1724,8 @@
 		y = -y;
 	}
 
-	/* +V2D_SCROLL_HEIGHT is workaround to set the actual height */
-	UI_view2d_totRect_set(v2d, x + V2D_SCROLL_WIDTH, y + V2D_SCROLL_HEIGHT);
+	/* +V2D_SCROLL_HEIGHT is workaround to set the actual height (needs to be int) */
+	UI_view2d_totRect_set(v2d, x + (int)V2D_SCROLL_WIDTH, y + (int)V2D_SCROLL_HEIGHT);
 
 	/* set the view */
 	UI_view2d_view_ortho(v2d);

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_draw.c	2012-12-17 15:17:51 UTC (rev 53087)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_draw.c	2012-12-17 17:37:48 UTC (rev 53088)
@@ -1227,10 +1227,10 @@
 				float ufac = UI_UNIT_X / 20.0f;
 
 				uiSetRoundBox(UI_CNR_ALL);
-				glColor4ub(255, 255, 255, 100);
-				uiRoundBox((float) *offsx - 1.5f * ufac,
-				           (float)ys + 2.0f * ufac,
-				           (float)*offsx + UI_UNIT_X - 3.0f * ufac,
+				glColor4ub(255, 255, 255, 128);
+				uiRoundBox((float) *offsx - 1.0f * ufac,
+				           (float)ys + 1.0f * ufac,
+				           (float)*offsx + UI_UNIT_X - 1.0f * ufac,
 				           (float)ys + UI_UNIT_Y - 1.0f * ufac,
 				           (float)UI_UNIT_Y / 2.0f - 2.0f * ufac);
 				glEnable(GL_BLEND); /* roundbox disables */
@@ -1278,6 +1278,7 @@
 
 	if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
 		int xmax = ar->v2d.cur.xmax;
+		unsigned char alpha = 128;
 		
 		/* icons can be ui buts, we don't want it to overlap with restrict */
 		if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
@@ -1294,16 +1295,17 @@
 		{
 			char col[4];
 			UI_GetThemeColorType4ubv(TH_MATCH, SPACE_OUTLINER, col);
-			col[3] = 100;
+			col[3] = alpha;
 			glColor4ubv((GLubyte *)col);
 			glRecti(startx, *starty + 1, ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
 		}
 
 		/* colors for active/selected data */
 		if (tselem->type == 0) {
+			
 			if (te->idcode == ID_SCE) {
 				if (tselem->id == (ID *)scene) {
-					glColor4ub(255, 255, 255, 100);
+					glColor4ub(255, 255, 255, alpha);
 					active = 2;
 				}
 			}
@@ -1312,7 +1314,7 @@
 				if (group_select_flag(gr)) {
 					char col[4];
 					UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
-					col[3] = 100;
+					col[3] = alpha;
 					glColor4ubv((GLubyte *)col);
 					
 					active = 2;
@@ -1330,14 +1332,14 @@
 					if (ob == OBACT) {
 						if (ob->flag & SELECT) {
 							UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
-							col[3] = 100;
+							col[3] = alpha;
 						}
 						
 						active = 1; /* means it draws white text */
 					}
 					else if (ob->flag & SELECT) {
 						UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
-						col[3] = 100;
+						col[3] = alpha;
 					}
 					
 					glColor4ubv((GLubyte *)col);
@@ -1345,27 +1347,27 @@
 			
 			}
 			else if (scene->obedit && scene->obedit->data == tselem->id) {
-				glColor4ub(255, 255, 255, 100);
+				glColor4ub(255, 255, 255, alpha);
 				active = 2;
 			}
 			else {
 				if (tree_element_active(C, scene, soops, te, 0)) {
-					glColor4ub(220, 220, 255, 100);
+					glColor4ub(220, 220, 255, alpha);
 					active = 2;
 				}
 			}
 		}
 		else {
 			if (tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active = 2;
-			glColor4ub(220, 220, 255, 100);
+			glColor4ub(220, 220, 255, alpha);
 		}
 		
 		/* active circle */
 		if (active) {
 			uiSetRoundBox(UI_CNR_ALL);
-			uiRoundBox((float)startx + UI_UNIT_X - 1.5f * ufac,
-			           (float)*starty + 2.0f * ufac,
-			           (float)startx + 2.0f * UI_UNIT_X - 3.0f * ufac,
+			uiRoundBox((float)startx + UI_UNIT_X - 1.0f * ufac,
+			           (float)*starty + 1.0f * ufac,
+			           (float)startx + 2.0f * UI_UNIT_X - 1.0f * ufac,
 			           (float)*starty + UI_UNIT_Y - 1.0f * ufac,
 			           UI_UNIT_Y / 2.0f - 2.0f * ufac);
 			glEnable(GL_BLEND); /* roundbox disables it */




More information about the Bf-blender-cvs mailing list