Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Context not available. | |||||
| } | } | ||||
| #endif /* WITH_HEADLESS */ | #endif /* WITH_HEADLESS */ | ||||
| //#if 0 | |||||
| int UI_load_addonsIcon(const char *filePath) | |||||
| { | |||||
| //struct direntry *dir; | |||||
| static int i = 0; | |||||
| int index; | |||||
| //const char *icondir; | |||||
| //icondir = BLI_get_folder(BLENDER_DATAFILES, "icons"); | |||||
| if (filePath == NULL) | |||||
| return -1; | |||||
| if (BLI_testextensie(filePath, ".png")) { | |||||
| /* loading all icons on file start is overkill & slows startup | |||||
| * its possible they change size after blender load anyway. */ | |||||
| //char iconfilestr[FILE_MAX + 16]; /* allow 256 chars for file+dir */ | |||||
| ImBuf *bbuf; | |||||
| /* check to see if the image is the right size, continue if not */ | |||||
| /* copying strings here should go ok, assuming that we never get back | |||||
| * a complete path to file longer than 256 chars */ | |||||
| //BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, filename); | |||||
| bbuf = IMB_loadiffname(filePath, IB_rect, NULL); | |||||
| if (bbuf) { | |||||
| index = BIFICONID_LAST + i++; | |||||
| def_internal_icon(bbuf, index, 0, 0, 64, ICON_TYPE_BUFFER); | |||||
| //di->data.buffer.image->rect = bbuf->rect; | |||||
| } | |||||
| /* bad size or failed to load */ | |||||
| if ((bbuf->x != 64) || (bbuf->y != 64)) { | |||||
| printf("icon '%s' is wrong size %dx%d\n", filePath, bbuf->x, bbuf->y); | |||||
| return -1; | |||||
| } | |||||
| /* found a potential icon file, so make an entry for it in the cache list */ | |||||
| IMB_freeImBuf(bbuf); | |||||
| } | |||||
| return index; | |||||
| } | |||||
| //#endif | |||||
| static void init_iconfile_list(struct ListBase *list) | static void init_iconfile_list(struct ListBase *list) | ||||
| { | { | ||||
| IconFile *ifile; | IconFile *ifile; | ||||
| Context not available. | |||||