Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Show First 20 Lines • Show All 689 Lines • ▼ Show 20 Lines | if (iimg->datatoc_rect) { | ||||
| iimg->rect = bbuf->rect; | iimg->rect = bbuf->rect; | ||||
| bbuf->rect = NULL; | bbuf->rect = NULL; | ||||
| IMB_freeImBuf(bbuf); | IMB_freeImBuf(bbuf); | ||||
| } | } | ||||
| } | } | ||||
| static void init_internal_icons(void) | static void init_internal_icons(void) | ||||
| { | { | ||||
| // bTheme *btheme = UI_GetTheme(); | |||||
| ImBuf *b16buf = NULL, *b32buf = NULL; | ImBuf *b16buf = NULL, *b32buf = NULL; | ||||
| int x, y; | int x, y; | ||||
| char iconfilepath[FILE_MAX]; | |||||
| /* User's override files must be somewhere like ~/.config/blender/2.80/datafiles/icons/ */ | |||||
| const char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); | |||||
| #if 0 // temp disabled | b16buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons16_png, | ||||
| if ((btheme != NULL) && btheme->tui.iconfile[0]) { | datatoc_blender_icons16_png_size, IB_rect, | ||||
| char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); | NULL, "<blender icons 16>"); | ||||
| char iconfilestr[FILE_MAX]; | |||||
| if (icondir) { | |||||
| BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile); | |||||
| /* if the image is missing bbuf will just be NULL */ | |||||
| bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); | |||||
| if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) { | if (icondir && b16buf) { | ||||
| printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr); | const char *iconfile16 = "blender_icons.16.png"; | ||||
brecht: The PNG file generated by `blender_icons_update.py` is called `blender_icons16.png`. It's… | |||||
| IMB_freeImBuf(bbuf); | ImBuf *f16buf = NULL; | ||||
| bbuf = NULL; | |||||
| BLI_join_dirfile(iconfilepath, sizeof(iconfilepath), icondir, iconfile16); | |||||
| f16buf = IMB_loadiffname(iconfilepath, IB_rect, NULL); | |||||
| if (f16buf) { | |||||
| /* Check dims against memory version, keep if valid, free unwanted version. */ | |||||
| if (b16buf->x != f16buf->x || b16buf->y != f16buf->y) { | |||||
| printf("WARNING: ignoring %s\n" | |||||
| " 16 * 16 icon sheet is %i * %i pixels image, expected %i * %i\n", | |||||
brechtUnsubmitted Not Done Inline ActionsUse CLOG_WARN for these kinds of prints. brecht: Use `CLOG_WARN` for these kinds of prints. | |||||
| iconfilepath, f16buf->x, f16buf->y, b16buf->x, b16buf->y); | |||||
| IMB_freeImBuf(f16buf); | |||||
| } | |||||
| else { | |||||
| IMB_freeImBuf(b16buf); | |||||
| b16buf = f16buf; | |||||
| } | } | ||||
| f16buf = NULL; | |||||
| } | } | ||||
| else { | else { | ||||
| printf("%s: 'icons' data path not found, continuing\n", __func__); | /* File path is there but not loading correctly? Tell user explicitly. */ | ||||
| if (BLI_exists(iconfilepath)) { | |||||
| printf("WARNING: unknown/unsupported 16 * 16 icon file %s\n", iconfilepath); | |||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| if (b16buf == NULL) { | |||||
| b16buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons16_png, | |||||
| datatoc_blender_icons16_png_size, IB_rect, NULL, "<blender icons>"); | |||||
| } | } | ||||
| if (b16buf) { | if (b16buf) { | ||||
| IMB_premultiply_alpha(b16buf); | IMB_premultiply_alpha(b16buf); | ||||
| } | } | ||||
| if (b32buf == NULL) { | |||||
| b32buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons32_png, | b32buf = IMB_ibImageFromMemory((const uchar *)datatoc_blender_icons32_png, | ||||
| datatoc_blender_icons32_png_size, IB_rect, NULL, "<blender icons>"); | datatoc_blender_icons32_png_size, IB_rect, | ||||
| NULL, "<blender icons 32>"); | |||||
| if (icondir && b32buf) { | |||||
| const char *iconfile32 = "blender_icons.32.png"; | |||||
| ImBuf *f32buf = NULL; | |||||
| BLI_join_dirfile(iconfilepath, sizeof(iconfilepath), icondir, iconfile32); | |||||
| f32buf = IMB_loadiffname(iconfilepath, IB_rect, NULL); | |||||
| if (f32buf) { | |||||
| /* Check dims against memory version, keep if valid, free unwanted version. */ | |||||
| if (b32buf->x != f32buf->x || b32buf->y != f32buf->y) { | |||||
| printf("WARNING: ignoring %s\n" | |||||
| " 32 * 32 icon sheet is %i * %i pixels image, expected %i * %i\n", | |||||
| iconfilepath, f32buf->x, f32buf->y, b32buf->x, b32buf->y); | |||||
| IMB_freeImBuf(f32buf); | |||||
| } | |||||
| else { | |||||
| IMB_freeImBuf(b32buf); | |||||
| b32buf = f32buf; | |||||
| } | |||||
| f32buf = NULL; | |||||
| } | } | ||||
| else { | |||||
| /* File path is there but not loading correctly? Tell user explicitly. */ | |||||
| if (BLI_exists(iconfilepath)) { | |||||
| printf("WARNING: unknown/unsupported 32 * 32 icon file %s\n", iconfilepath); | |||||
| } | |||||
| } | |||||
| } | |||||
| if (b32buf) { | if (b32buf) { | ||||
| IMB_premultiply_alpha(b32buf); | IMB_premultiply_alpha(b32buf); | ||||
| } | } | ||||
| if (b16buf && b32buf) { | if (b16buf && b32buf) { | ||||
| /* Free existing texture if any. */ | /* Free existing texture if any. */ | ||||
| if (icongltex.id) { | if (icongltex.id) { | ||||
| glDeleteTextures(1, &icongltex.id); | glDeleteTextures(1, &icongltex.id); | ||||
| ▲ Show 20 Lines • Show All 1,273 Lines • Show Last 20 Lines | |||||
The PNG file generated by blender_icons_update.py is called blender_icons16.png. It's easiest to keep that without adding the extra dot.