[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19235] branches/blender2.5/blender/source /blender: * fun 2.5 UI commit from seoul airport!

Matt Ebb matt at mke3.net
Mon Mar 9 09:31:45 CET 2009


Revision: 19235
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19235
Author:   broken
Date:     2009-03-09 09:31:45 +0100 (Mon, 09 Mar 2009)

Log Message:
-----------
* fun 2.5 UI commit from seoul airport!

A few UI goodies from on the plane:
- fixed the sliders for non-rounded themes
- Made properties with rna subtype of 'percentage' automatically display a '%' 
character *after* the numerical value, where it belongs. It would also be really great 
to add a ?\194?\176 - degree symbol after angle and perhaps rotation subtypes. This works 
fine with international fonts but not with oldskool bitmap fonts (not part of ascii). I 
wonder if there's a way to get around this?
- Added nice embossing effects on buttons, labels and pulldowns (there you go, brecht :)
- and cooler looking tooltips

And did some work on the file browser. Andrea, I hope this is ok, let me know if 
there are problems and I can work on fixing it up :)
- added some new icons for file types, that are now shown in list view.
icon designers, please feel free to update and make nicer ones!
- tweaked the default colour theme and did some graphical fiddling to make the 
various views look nicer
- rearranged the buttons on the header and swapped the 'P' button for an up arrow 
button, this needs a nicer icon too.
- added outliner style alternating bands to the list view to see info grouping better. 
This has a small prob in columns view though, can fix that.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/interface/interface.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
    branches/blender2.5/blender/source/blender/editors/interface/resources.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
    branches/blender2.5/blender/source/blender/editors/space_file/file_header.c
    branches/blender2.5/blender/source/blender/editors/space_file/filesel.c
    branches/blender2.5/blender/source/blender/editors/space_file/space_file.c
    branches/blender2.5/blender/source/blender/editors/space_info/info_header.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-03-09 07:51:33 UTC (rev 19234)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-03-09 08:31:45 UTC (rev 19235)
@@ -1743,6 +1743,13 @@
 		else {
 			sprintf(but->drawstr, "%s%d", but->str, (int)value);
 		}
+			
+		if(but->rnaprop) {
+			PropertySubType pstype = RNA_property_subtype(&but->rnapoin, but->rnaprop);
+			
+			if (pstype == PROP_PERCENTAGE)
+				strcat(but->drawstr, "%");
+		}
 		break;
 
 	case LABEL:

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-03-09 07:51:33 UTC (rev 19234)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-03-09 08:31:45 UTC (rev 19235)
@@ -896,6 +896,10 @@
 	int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
 	float shadefac;
 	
+	/* emboss */
+	UI_ThemeColorShade(TH_BUT_OUTLINE, 50);
+	uiRoundRectFakeAA(x1, y1-1, x2, y2-1, rad, asp);
+	
 	/* colour shading */
 	if (flag & UI_SELECT) {
 		shadefac = -0.05;
@@ -924,6 +928,10 @@
 {	
 	int alpha_offs= (flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
 	
+	/* emboss */
+	UI_ThemeColorShade(TH_BUT_OUTLINE, 50);
+	uiRoundRectFakeAA(x1, y1-1, x2, y2-1, rad, asp);
+	
 	/* colour shading */
 	if(flag & UI_SELECT) {
 		if (flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -20);
@@ -933,16 +941,13 @@
 		if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, 35);
 		else UI_ThemeColorShade(colorid, 25);
 	}
-	/* end colour shading */
 	
 	/* the solid base */
 	gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
 	
 	/* outline */
 	UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs);
-	
 	uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
-	/* end outline */
 }
 
 static void ui_checkmark_box(int colorid, float x1, float y1, float x2, float y2)
@@ -1993,9 +1998,10 @@
 	ymid= (y1+y2)/2.0;
 	yc= 1.7*aspect;	
 
-	if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -50); 
+	if(flag & UI_ACTIVE) UI_ThemeColorShade(colorid, -60); 
 	else UI_ThemeColorShade(colorid, -40); 
 
+	origround = round;
 	round &= ~(2|4);
 	uiSetRoundBox(round);
 	
@@ -2005,7 +2011,7 @@
 		float start_rad;
 		
 		start_rad = fac;
-		ofsy = (rad - fac) * 0.5;
+		ofsy = (origround!=0) ? ((rad - fac) * 0.5) : 0.f;	/* shrink in Y if rounded but */
 		
 		gl_round_box(GL_POLYGON, x1, y1+ofsy, x1+fac, y2-ofsy, start_rad);
 		
@@ -2013,32 +2019,38 @@
 		/* if the slider is in the middle */
 		
 		gl_round_box(GL_POLYGON, x1, y1, x1+fac, y2, rad);
-		
+	
 	} else if (x1+fac >= x2-rad) {
 		/* if the slider is in the right end cap */
 		float extx, ofsy;
 		float end_rad;
 		
 		/* draw the full slider area at 100% */
-		uiSetRoundBox(1+2+4+8);
+		uiSetRoundBox(origround);
 		gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
 		
-		/* tricky hack to trim off right end curve by drawing over it */
+		/* don't draw anything else if the slider is completely full */
+		if (x2 - (x1+fac) < 0.05f)	
+			return;
+		
+		/* tricky to trim off right end curve by drawing over it */
 		extx = ((x1 + fac) - (x2 - rad)) * aspect;	/* width of extension bit */
 		end_rad = rad - extx - 1.0;
-		ofsy = extx * 0.4;
+		ofsy = (origround!=0) ? (extx * 0.4) : 0.f; 	/* shrink in Y if rounded but */
 		
 		if (end_rad > 1.0) {
 			
 			if(flag & UI_SELECT) UI_ThemeColorShade(colorid, -20);
 			else UI_ThemeColorShade(colorid, -0);
 			
-			uiSetRoundBox(2+4);
-			gl_round_box(GL_POLYGON, x1+fac-1.0, y1+ofsy, x2, y2-ofsy, end_rad);
+			round = origround;
+			round &= ~(1|8);
+			uiSetRoundBox(round);
+			gl_round_box(GL_POLYGON, x1+fac-1.0, y1+ofsy, x2-1.0, y2-ofsy, end_rad);
 		}
 		
 		UI_ThemeColorBlendShadeAlpha(TH_BUT_OUTLINE, TH_BACK, 0.1, -30, alpha_offs);
-		uiSetRoundBox(1+2+4+8);
+		uiSetRoundBox(origround);
 		uiRoundRectFakeAA(x1, y1, x2, y2, rad, aspect);
 	}
 	
@@ -2191,17 +2203,73 @@
 
 /* ************** TEXT AND ICON DRAWING FUNCTIONS ************* */
 
+#define BUT_TEXT_NORMAL	0
+#define BUT_TEXT_SUNKEN	1
 
+static void ui_draw_text(uiBut *but, float x, float y, int sunken)
+{
+	int alpha_offs= (but->flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
+	int col_offs = 0;
+	int transopts;
+	int len;
+	char *cpoin;
+	
+	if (sunken) {
+		y -= 1.0;
+		col_offs = 230;
+	}
+	
+	/* text color, with pulldown item exception */
+	if(but->dt==UI_EMBOSSP) {
+		if((but->flag & UI_ACTIVE) && but->type!=LABEL) {	// LABEL = title in pulldowns
+			UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, col_offs, alpha_offs);
+		} else {
+			UI_ThemeColorShadeAlpha(TH_MENU_TEXT, col_offs, alpha_offs);
+		}
+	}
+	else {
+		if(but->flag & UI_SELECT) {		
+			UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, col_offs, alpha_offs);
+		} else {
+			UI_ThemeColorShadeAlpha(TH_BUT_TEXT, col_offs, alpha_offs);
+		}
+	}
+	
+	/* LABEL button exception */
+	if(but->type==LABEL && but->min!=0.0) UI_ThemeColorShade(TH_BUT_TEXT_HI, col_offs);
+	
+	ui_rasterpos_safe(x, y, but->aspect);
+	if(but->type==IDPOIN) transopts= 0;	// no translation, of course!
+	else transopts= ui_translate_buttons();
+	
+	/* cut string in 2 parts */
+	cpoin= strchr(but->drawstr, '|');
+	if(cpoin) *cpoin= 0;		
+	
+#ifdef INTERNATIONAL
+	if (but->type == FTPREVIEW)
+		FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
+	else
+		UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
+#else
+	UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
+#endif
+	
+	/* part text right aligned */
+	if(cpoin) {
+		len= UI_GetStringWidth(but->font, cpoin+1, ui_translate_buttons());
+		ui_rasterpos_safe( but->x2 - len*but->aspect-3, y, but->aspect);
+		UI_DrawString(but->font, cpoin+1, ui_translate_buttons());
+		*cpoin= '|';
+	}
+}
 
 /* draws text and icons for buttons */
 static void ui_draw_text_icon(uiBut *but)
 {
-	float x;
-	int len;
-	char *cpoin;
+	float x, y;
 	short t, pos, ch;
 	short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
-	int alpha_offs= (but->flag & UI_BUT_DISABLED)?UI_DISABLED_ALPHA_OFFS:0;
 	
 	/* check for button text label */
 	if (but->type == ICONTEXTROW) {
@@ -2267,13 +2335,8 @@
 		}
 		
 		if(but->drawstr[0]!=0) {
-			int transopts;
 			int tog3= 0;
 			
-			// cut string in 2 parts
-			cpoin= strchr(but->drawstr, '|');
-			if(cpoin) *cpoin= 0;
-
 			/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
 			and offset the text label to accomodate it */
 			
@@ -2309,46 +2372,14 @@
 				if (tog3) glColor3ub(255, 255, 0);
 			}
 			
-			/* text color, with pulldown item exception */
-			if(tog3);	// color already set
-			else if(but->dt==UI_EMBOSSP) {
-				if((but->flag & UI_ACTIVE) && but->type!=LABEL) {	// LABEL = title in pulldowns
-					UI_ThemeColorShadeAlpha(TH_MENU_TEXT_HI, 0, alpha_offs);
-				} else {
-					UI_ThemeColorShadeAlpha(TH_MENU_TEXT, 0, alpha_offs);
-				}
-			}
-			else {
-				if(but->flag & UI_SELECT) {		
-					UI_ThemeColorShadeAlpha(TH_BUT_TEXT_HI, 0, alpha_offs);
-				} else {
-					UI_ThemeColorShadeAlpha(TH_BUT_TEXT, 0, alpha_offs);
-				}
-			}
-
-			/* LABEL button exception */
-			if(but->type==LABEL && but->min!=0.0) UI_ThemeColor(TH_BUT_TEXT_HI);
-		
-			ui_rasterpos_safe(x, (but->y1+but->y2- 9.0)/2.0, but->aspect);
-			if(but->type==IDPOIN) transopts= 0;	// no translation, of course!
-			else transopts= ui_translate_buttons();
+			/* position and draw */
+			y = (but->y1+but->y2- 9.0)/2.0;
 			
-		#ifdef INTERNATIONAL
-			if (but->type == FTPREVIEW)
-				FTF_DrawNewFontString (but->drawstr+but->ofs, FTF_INPUT_UTF8);
-			else
-				UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
-		#else
-			UI_DrawString(but->font, but->drawstr+but->ofs, transopts);
-		#endif
-
-			/* part text right aligned */
-			if(cpoin) {
-				len= UI_GetStringWidth(but->font, cpoin+1, ui_translate_buttons());
-				ui_rasterpos_safe( but->x2 - len*but->aspect-3, (but->y1+but->y2- 9.0)/2.0, but->aspect);
-				UI_DrawString(but->font, cpoin+1, ui_translate_buttons());
-				*cpoin= '|';
-			}
+			if (ELEM(but->type, LABEL, PULLDOWN) && !(but->flag & UI_ACTIVE))
+				ui_draw_text(but, x, y, BUT_TEXT_SUNKEN);
+			
+			ui_draw_text(but, x, y, BUT_TEXT_NORMAL);
+			
 		}
 		/* if there's no text label, then check to see if there's an icon only and draw it */
 		else if( but->flag & UI_HAS_ICON ) {

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c	2009-03-09 07:51:33 UTC (rev 19234)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_regions.c	2009-03-09 08:31:45 UTC (rev 19235)
@@ -261,7 +261,7 @@
 {
 	uiTooltipData *data;
 	int x1, y1, x2, y2;
-
+	
 	data= ar->regiondata;
 
 	x1= ar->winrct.xmin;
@@ -269,34 +269,21 @@
 	x2= ar->winrct.xmax;
 	y2= ar->winrct.ymax;
 
-	/* draw drop shadow */
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	/* draw background */
 	glEnable(GL_BLEND);
-
-	glColor4ub(0, 0, 0, 20);
+	glColor4f(0.15f, 0.15f, 0.15f, 0.85f);
 	
-	gl_round_box(GL_POLYGON, 3, 3, x2-x1-3, y2-y1-2, 2.0);
-	gl_round_box(GL_POLYGON, 3, 2, x2-x1-2, y2-y1-2, 3.0);
+	uiSetRoundBox(15);
+	uiRoundBox(data->bbox.xmin, 2, data->bbox.xmax+10, y2-y1-2, 5.0f);
 	
-	glColor4ub(0, 0, 0, 8);
-	
-	gl_round_box(GL_POLYGON, 3, 1, x2-x1-1, y2-y1-3, 4.0);
-	gl_round_box(GL_POLYGON, 3, 0, x2-x1-0, y2-y1-3, 5.0);
-
-	glDisable(GL_BLEND);
-	
-	/* draw background */
-	glColor3f(1.0f, 1.0f, 0.8666f);
-	glRectf(0, 4, x2-x1-4, y2-y1);
-	
 	/* draw text */
-	glColor3ub(0,0,0);
+	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 
-	/* set the position for drawing text +4 in from the left edge, and leaving
+	/* set the position for drawing text +6 in from the left edge, and leaving
 	 * an equal gap between the top of the background box and the top of the
 	 * string's bbox, and the bottom of the background box, and the bottom of
 	 * the string's bbox */
-	ui_rasterpos_safe(4, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, data->aspect);
+	ui_rasterpos_safe(5, ((y2-data->bbox.ymax)+(y1+data->bbox.ymin))/2 - data->bbox.ymin - y1, data->aspect);
 	UI_SetScale(1.0);
 
 	UI_DrawString(data->font, data->tip, ui_translate_tooltips());


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list