Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Context not available. | |||||
| static void init_internal_icons(void) | static void init_internal_icons(void) | ||||
| { | { | ||||
| int x, y; | const char *icon_directory = BKE_appdir_folder_id(BLENDER_DATAFILES, "interface_icons"); | ||||
| const char *icon_file_names[] = { | |||||
| # if 0 // temp disabled | # define DEF_ICON(name) #name ".png", | ||||
| if ((btheme != NULL) && btheme->tui.iconfile[0]) { | # define DEF_ICON_BLANK(name) "", | ||||
| char *icondir = BKE_appdir_folder_id(BLENDER_DATAFILES, "icons"); | # define DEF_ICON_COLOR(name) "", | ||||
| char iconfilestr[FILE_MAX]; | # define DEF_ICON_VECTOR(name) | ||||
| # include "UI_icons.h" | |||||
| 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)) { | |||||
| printf( | |||||
| "\n***WARNING***\n" | |||||
| "Icons file '%s' too small.\n" | |||||
| "Using built-in Icons instead\n", | |||||
| iconfilestr); | |||||
| IMB_freeImBuf(bbuf); | |||||
| bbuf = NULL; | |||||
| } | |||||
| } | |||||
| else { | |||||
| printf("%s: 'icons' data path not found, continuing\n", __func__); | |||||
| } | |||||
| } | |||||
| # endif | |||||
| /* Define icons. */ | /* Define icons. */ | ||||
| for (y = 0; y < ICON_GRID_ROWS; y++) { | for (int y = 0; y < ICON_GRID_ROWS; y++) { | ||||
| /* Row W has monochrome icons. */ | for (int x = 0; x < ICON_GRID_COLS; x++) { | ||||
| for (x = 0; x < ICON_GRID_COLS; x++) { | int icon_id = BIFICONID_FIRST + y * ICON_GRID_COLS + x; | ||||
| IconType icontype = icontypes[y * ICON_GRID_COLS + x]; | IconType icontype = icontypes[icon_id]; | ||||
| if (!ELEM(icontype.type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) { | if (!ELEM(icontype.type, ICON_TYPE_COLOR_TEXTURE, ICON_TYPE_MONO_TEXTURE)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (icon_directory && icon_file_names[icon_id][0] != '\0') { | |||||
| char path[FILE_MAX]; | |||||
| BLI_join_dirfile(path, sizeof(path), icon_directory, icon_file_names[icon_id]); | |||||
| ImBuf *ibuf = IMB_loadiffname(path, IB_rect, NULL); | |||||
| if (ibuf) { | |||||
| int size = (ibuf->x < ibuf->y) ? ibuf->x : ibuf->y; | |||||
| def_internal_icon(ibuf, icon_id, 0, 0, size, ICON_TYPE_BUFFER, 0); | |||||
| IMB_freeImBuf(ibuf); | |||||
| continue; | |||||
| } | |||||
| } | |||||
| def_internal_icon(NULL, | def_internal_icon(NULL, | ||||
| BIFICONID_FIRST + y * ICON_GRID_COLS + x, | icon_id, | ||||
| x * (ICON_GRID_W + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, | x * (ICON_GRID_W + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, | ||||
| y * (ICON_GRID_H + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, | y * (ICON_GRID_H + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, | ||||
| ICON_GRID_W, | ICON_GRID_W, | ||||
| Context not available. | |||||