[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19943] branches/blender2.5/blender/source /blender: 2.5

Ton Roosendaal ton at blender.org
Mon Apr 27 15:44:12 CEST 2009


Revision: 19943
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19943
Author:   ton
Date:     2009-04-27 15:44:11 +0200 (Mon, 27 Apr 2009)

Log Message:
-----------
2.5

Summary of ain features:
- Themes and Styles are now editable.
- CTRL+U "Save user defaults" now goes to new .B25.blend, so you
  can use 2.4x and 2.5x next to each other. If B25 doesn't exist, it
  reads the regular .B.blend
- Press Tkey in 3d window for (unfinished) toolbar WIP. It now only
  shows the last operator, if appropriate.
  Nkey properties moved to the other side.

A lot of work was done on removing old themes for good and properly
getting it work with the 2.5 region system. Here's some notes;

- Buttons now all have a complete set of colors, based on button classifications
  (See outliner -> user prefs -> Interface
- Theme colors have been extended with basic colors for region types. 
  Currently colors are defined for Window, Header, List/Channels and
  for Button/Tool views. 
  The screen manager handles this btw, so a TH_BACK will always pick the
  right backdrop color.
- Menu backdrops are in in Button theme colors. Floating Panels will be in
  the per-space type Themes.
- Styles were added in RNA too, but only for the font settings now.
  Only Panel font, widget font and widget-label work now. The 'group label'
  will be for templates mostly.
  Style settings will be expanded with spacing defaults, label conventions, 
  etc.
- Label text colors are stored in per-space Theme too, to make sure they fit.
  Same goes for Panel title color.

Note that 'shadow' for fonts can conflict with text colors; shadow color is
currently stored in Style... shadow code needs a bit of work still.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
    branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
    branches/blender2.5/blender/source/blender/editors/include/UI_resources.h
    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_intern.h
    branches/blender2.5/blender/source/blender/editors/interface/interface_layout.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_utils.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_widgets.c
    branches/blender2.5/blender/source/blender/editors/interface/resources.c
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
    branches/blender2.5/blender/source/blender/editors/space_node/space_node.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_ops.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_select.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_screen_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_userdef_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-04-27 13:44:11 UTC (rev 19943)
@@ -178,7 +178,7 @@
 		- read associated 'direct data'
 		- link direct data (internal and to LibBlock)
 - read FileGlobal
-- read USER data, only when indicated (file is ~/.B.blend)
+- read USER data, only when indicated (file is ~/.B.blend or .B25.blend)
 - free file
 - per Library (per Main)
 	- read file

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/writefile.c	2009-04-27 13:44:11 UTC (rev 19943)
@@ -2240,8 +2240,7 @@
 		return 0;
 	}
 
-	BLI_make_file_string(G.sce, userfilename, BLI_gethome(), ".B.blend");
-
+	BLI_make_file_string(G.sce, userfilename, BLI_gethome(), ".B25.blend");
 	write_user_block= BLI_streq(dir, userfilename);
 
 	err= write_file_handle(mainvar, file, NULL,NULL, write_user_block, write_flags);

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_interface.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_interface.h	2009-04-27 13:44:11 UTC (rev 19943)
@@ -589,6 +589,7 @@
 
 void uiAnimContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index);
 
+
 /* Styled text draw */
 void uiStyleFontSet(struct uiFontStyle *fs);
 void uiStyleFontDraw(struct uiFontStyle *fs, struct rcti *rect, char *str);

Modified: branches/blender2.5/blender/source/blender/editors/include/UI_resources.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/UI_resources.h	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/editors/include/UI_resources.h	2009-04-27 13:44:11 UTC (rev 19943)
@@ -794,45 +794,31 @@
 
 } BIFColorID;
 
-/* XXX WARNING: this is saved in file, so do not change order! */
 enum {
-	TH_AUTO,	/* for buttons, to signal automatic color assignment */
-	
-// uibutton colors
-	TH_BUT_OUTLINE,
-	TH_BUT_NEUTRAL,
-	TH_BUT_ACTION,
-	TH_BUT_SETTING,
-	TH_BUT_SETTING1,
-	TH_BUT_SETTING2,
-	TH_BUT_NUM,
-	TH_BUT_TEXTFIELD,
-	TH_BUT_POPUP,
-	TH_BUT_TEXT,
-	TH_BUT_TEXT_HI,
-	TH_MENU_BACK,
-	TH_MENU_ITEM,
-	TH_MENU_HILITE,
-	TH_MENU_TEXT,
-	TH_MENU_TEXT_HI,
-	
-	TH_BUT_DRAWTYPE,
-	
 	TH_REDALERT,
-	TH_CUSTOM,
-	
-	TH_BUT_TEXTFIELD_HI,
-	TH_ICONFILE,
-	
+
 	TH_THEMEUI,
 // common colors among spaces
 	
 	TH_BACK,
 	TH_TEXT,
 	TH_TEXT_HI,
+	TH_TITLE,
+	
 	TH_HEADER,
 	TH_HEADERDESEL,
+	TH_HEADER_TEXT,
+	TH_HEADER_TEXT_HI,
+	
+	/* float panels */
 	TH_PANEL,
+	TH_PANEL_TEXT,
+	TH_PANEL_TEXT_HI,
+	
+	TH_BUTBACK,
+	TH_BUTBACK_TEXT,
+	TH_BUTBACK_TEXT_HI,
+	
 	TH_SHADE1,
 	TH_SHADE2,
 	TH_HILITE,
@@ -947,13 +933,8 @@
 // get pointer from RNA pointer
 int		UI_GetIconRNA(struct PointerRNA *ptr);
 
-struct ScrArea;
-
 // internal (blender) usage only, for init and set active
-void 	UI_SetTheme(struct ScrArea *sa);
-void 	ui_theme_init_userdef		(void);
-void	ui_resources_init		(void);
-void	ui_resources_free		(void);
+void 	UI_SetTheme(int spacetype, int regionid);
 
 /* only for buttons in theme editor! */
 char 	*UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid);

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface.c	2009-04-27 13:44:11 UTC (rev 19943)
@@ -650,7 +650,7 @@
 	if(block->flag & UI_BLOCK_LOOP)
 		ui_draw_menu_back(&style, block, &rect);
 	else if(block->panel)
-		ui_draw_panel(ar, &style, block, &rect);
+		ui_draw_aligned_panel(ar, &style, block, &rect);
 
 	if(block->drawextra) block->drawextra(C, block);
 
@@ -1970,13 +1970,7 @@
 {
 	uiBut *prev, *but=NULL, *next;
 	int flag= 0, cols=0, rows=0;
-	int theme= UI_GetThemeValue(TH_BUT_DRAWTYPE);
 	
-	if ( !(ELEM4(theme, TH_MINIMAL, TH_SHADED, TH_ROUNDED, TH_ROUNDSHADED)) ) {
-		block->flag &= ~UI_BUT_ALIGN;	// all 4 flags
-		return;
-	}
-	
 	/* auto align:
 		- go back to first button of align start (ALIGN_DOWN)
 		- compare triples, and define flags
@@ -3052,10 +3046,15 @@
 	ui_resources_init();
 }
 
-void UI_init_userdef()
+/* after reading userdef file */
+void UI_init_userdef(void)
 {
-	uiStyleInit();
+	/* fix saved themes */
+	init_userdef_do_versions();
+	/* set default colors in default theme */
 	ui_theme_init_userdef();
+	
+	uiStyleInit();
 }
 
 void UI_exit(void)

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-04-27 12:44:42 UTC (rev 19942)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_draw.c	2009-04-27 13:44:11 UTC (rev 19943)
@@ -61,10 +61,7 @@
 	/* Not sure the roundbox function is the best place to change this
 	 * if this is undone, its not that big a deal, only makes curves edges
 	 * square for the  */
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) == TH_MINIMAL)
-		roundboxtype= 0;
-	else
-		roundboxtype= type;
+	roundboxtype= type;
 
 	/* flags to set which corners will become rounded:
 
@@ -77,10 +74,7 @@
 
 int uiGetRoundBox(void)
 {
-	if (ELEM3(UI_GetThemeValue(TH_BUT_DRAWTYPE), TH_MINIMAL, TH_SHADED, TH_OLDSKOOL))
-		return 0;
-	else
-		return roundboxtype;
+	return roundboxtype;
 }
 
 void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad)
@@ -176,10 +170,8 @@
 	coldown[1]= color[1]+shadedown; if(coldown[1]<0.0) coldown[1]= 0.0;
 	coldown[2]= color[2]+shadedown; if(coldown[2]<0.0) coldown[2]= 0.0;
 
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
-		glShadeModel(GL_SMOOTH);
-		glBegin(mode);
-	}
+	glShadeModel(GL_SMOOTH);
+	glBegin(mode);
 
 	/* start with corner right-bottom */
 	if(roundboxtype & 4) {
@@ -285,10 +277,8 @@
 	colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0) colRight[1]= 0.0;
 	colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0) colRight[2]= 0.0;
 
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
-		glShadeModel(GL_SMOOTH);
-		glBegin(mode);
-	}
+	glShadeModel(GL_SMOOTH);
+	glBegin(mode);
 
 	/* start with corner right-bottom */
 	if(roundboxtype & 4) {
@@ -379,10 +369,8 @@
 	}
 	
 	/* set antialias line */
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
-		glEnable( GL_LINE_SMOOTH );
-		glEnable( GL_BLEND );
-	}
+	glEnable( GL_LINE_SMOOTH );
+	glEnable( GL_BLEND );
 
 	gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
    
@@ -435,10 +423,8 @@
 	gl_round_box(GL_POLYGON, minx, miny, maxx, maxy, rad);
 	
 	/* set antialias line */
-	if (UI_GetThemeValue(TH_BUT_DRAWTYPE) != TH_MINIMAL) {
-		glEnable( GL_LINE_SMOOTH );
-		glEnable( GL_BLEND );
-	}
+	glEnable( GL_LINE_SMOOTH );
+	glEnable( GL_BLEND );
 	
 	gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
 	
@@ -663,7 +649,7 @@
 #endif // INTERNATIONAL
 #endif
 
-void ui_draw_but_COLORBAND(uiBut *but, rcti *rect)
+void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
 	ColorBand *coba;
 	CBData *cbd;
@@ -790,7 +776,7 @@
 	glEnd();
 }
 
-void ui_draw_but_NORMAL(uiBut *but, rcti *rect)
+void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
 	static GLuint displist=0;
 	int a, old[8];
@@ -802,7 +788,7 @@
 	glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
 		
 	/* backdrop */
-	UI_ThemeColor(TH_BUT_NEUTRAL);
+	glColor3ubv(wcol->inner);
 	uiSetRoundBox(15);
 	gl_round_box(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f);
 	
@@ -892,8 +878,15 @@
 	
 }
 
-void ui_draw_but_CURVE(ARegion *ar, uiBut *but, rcti *rect)
+static void glColor3ubvShade(char *col, int shade)
 {
+	glColor3ub(col[0]-shade>0?col[0]-shade:0, 
+			   col[1]-shade>0?col[1]-shade:0,
+			   col[2]-shade>0?col[2]-shade:0);
+}
+
+void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect)
+{
 	CurveMapping *cumap;
 	CurveMap *cuma;
 	CurveMapPoint *cmp;
@@ -916,27 +909,27 @@
 	
 	/* backdrop */
 	if(cumap->flag & CUMA_DO_CLIP) {
-		UI_ThemeColorShade(TH_BUT_NEUTRAL, -20);
+		glColor3ubvShade(wcol->inner, -20);
 		glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
-		UI_ThemeColor(TH_BUT_NEUTRAL);
+		glColor3ubv(wcol->inner);
 		glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx),
 				rect->ymin + zoomy*(cumap->clipr.ymin-offsy),
 				rect->xmin + zoomx*(cumap->clipr.xmax-offsx),
 				rect->ymin + zoomy*(cumap->clipr.ymax-offsy));
 	}
 	else {
-		UI_ThemeColor(TH_BUT_NEUTRAL);
+		glColor3ubv(wcol->inner);
 		glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 	}
 	
 	/* grid, every .25 step */
-	UI_ThemeColorShade(TH_BUT_NEUTRAL, -16);
+	glColor3ubvShade(wcol->inner, -16);
 	ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
 	/* grid, every 1.0 step */
-	UI_ThemeColorShade(TH_BUT_NEUTRAL, -24);
+	glColor3ubvShade(wcol->inner, -24);
 	ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
 	/* axes */
-	UI_ThemeColorShade(TH_BUT_NEUTRAL, -50);
+	glColor3ubvShade(wcol->inner, -50);
 	glBegin(GL_LINES);
 	glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy));
 	glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy));
@@ -981,7 +974,7 @@
 	}*/
 	
 	/* the curve */
-	UI_ThemeColorBlend(TH_TEXT, TH_BUT_NEUTRAL, 0.35);
+	glColor3ubv(wcol->item);
 	glEnable(GL_LINE_SMOOTH);
 	glEnable(GL_BLEND);
 	glBegin(GL_LINE_STRIP);
@@ -1035,7 +1028,7 @@
 	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 
 	/* outline */
-	UI_ThemeColor(TH_BUT_OUTLINE);
+	glColor3ubv(wcol->outline);
 	fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 }
 

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_intern.h

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list