diff options
author | Matt Ebb <matt@mke3.net> | 2008-12-28 10:39:23 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-12-28 10:39:23 +0300 |
commit | fb3242033016a026a25783a9e75150141cb60a93 (patch) | |
tree | a77fde78e9691e2bb62caa52b65df0f0667139de /source/blender/editors/interface/interface_icons.c | |
parent | 452f1d1ea9ecc637103a55ad97564a44371b228a (diff) |
2.5 - Reworked the icon system a bit
* After several hours of manual dragging and typing the icon file is now
enlarged and completely reorganised logically, rather than scattered
throughout. This should provide a lot more room for growth, and is a
lot easier to work with (also allowing more space for toggle buttons
that require two icon slots next to each other). The icon grid has now
25 x 24 icons - hopefully this might last us for a couple more years :)
Some of the naming of icon defines is a bit ancient and can be cleaned
up a bit further. Other devs, if when bringing spaces back, it's
finding the wrong icon, or missing a define, try and look to see if
it's already existing in the new icon file, or drop me a note and I'll
fix it up.
Note: after these changes, older custom blender 2.4 icon
files won't work and will need to be updated to the new layout.
* Enlarged the icons themselves from 15x16 pixels to 16x16 pixels (icon
designer request). This is a more standard size, and is easier to fit
stuff in proportionally.
* Added a bunch more of jendrzych's icons that weren't added previously
since there wasn't space in the icon file (including a few more
modifier icons)
* Tweaked the outliner somewhat, so that instead of just showing a
generic 'object' icon for all objects, it shows 'object type' icons,
per object type. This makes the outliner a lot more useful for browsing
at a glance - a huge row of identical 'object' icons doesn't really
give much useful information. See here:
http://mke3.net/blender/devel/2.5/outliner_obtypes.png
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 22496513796..4f66a263b04 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -64,14 +64,14 @@ #include "interface_intern.h" #include "ED_datafiles.h" -#define ICON_IMAGE_W 512 -#define ICON_IMAGE_H 256 +#define ICON_IMAGE_W 600 +#define ICON_IMAGE_H 512 #define ICON_GRID_COLS 25 -#define ICON_GRID_ROWS 12 +#define ICON_GRID_ROWS 24 #define ICON_GRID_MARGIN 5 -#define ICON_GRID_W 15 +#define ICON_GRID_W 16 #define ICON_GRID_H 16 typedef struct IconImage { @@ -123,7 +123,7 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs) /* Here we store the rect in the icon - same as before */ for (y=0; y<ICON_DEFAULT_HEIGHT; y++) { - memcpy(&iimg->rect[y*ICON_DEFAULT_HEIGHT], &bbuf->rect[(y+yofs)*512+xofs], ICON_DEFAULT_HEIGHT*sizeof(int)); + memcpy(&iimg->rect[y*ICON_DEFAULT_HEIGHT], &bbuf->rect[(y+yofs)*ICON_IMAGE_W+xofs], ICON_DEFAULT_HEIGHT*sizeof(int)); } di->icon = iimg; @@ -399,39 +399,6 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float alpha) glDisable(GL_LINE_SMOOTH); } -/***/ - -static void clear_icon_grid_margins(unsigned char *rect, int w, int h) -{ - int x, y; - int xoffs=ICON_GRID_W+ICON_GRID_MARGIN; - int yoffs=ICON_GRID_H+ICON_GRID_MARGIN; - - for (y=0; y<h; y++) { - unsigned char *row= &rect[y*w*4]; - - for (x=0; x<w; x++) { - unsigned char *pxl= &row[x*4]; - - if ((x % xoffs < ICON_GRID_MARGIN-2) || (x % xoffs > ICON_GRID_W+2)) - pxl[3] = 0; //alpha channel == x+3 - else if ((y % yoffs < ICON_GRID_MARGIN-2) || (y % yoffs > ICON_GRID_H+2)) - pxl[3] = 0; - } - } -} - -static void prepare_internal_icons(ImBuf *bbuf) -{ - - unsigned char *back= (unsigned char *)bbuf->rect; - - /* this sets the icon grid margin area outside of icon to zero alpha */ - clear_icon_grid_margins(back, bbuf->x, bbuf->y); - -} - - static void init_internal_icons() { bTheme *btheme= U.themes.first; @@ -458,14 +425,12 @@ static void init_internal_icons() } else { bbuf = IMB_ibImageFromMemory((int *)datatoc_blenderbuttons, datatoc_blenderbuttons_size, IB_rect); } - - prepare_internal_icons(bbuf); for (y=0; y<ICON_GRID_ROWS; y++) { for (x=0; x<ICON_GRID_COLS; x++) { def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x, - x*(ICON_GRID_W+ICON_GRID_MARGIN)+3, - y*(ICON_GRID_H+ICON_GRID_MARGIN)+3); + x*(ICON_GRID_W+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, + y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN); } } |