Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_icons.c
| Show First 20 Lines • Show All 751 Lines • ▼ Show 20 Lines | #endif /* removed */ | ||||
| BLI_addtail(list, ifile); | BLI_addtail(list, ifile); | ||||
| index++; | index++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| BLI_filelist_free(dir, totfile, NULL); | BLI_filelist_free(dir, totfile); | ||||
| dir = NULL; | dir = NULL; | ||||
| } | } | ||||
| static void free_iconfile_list(struct ListBase *list) | static void free_iconfile_list(struct ListBase *list) | ||||
| { | { | ||||
| IconFile *ifile = NULL, *next_ifile = NULL; | IconFile *ifile = NULL, *next_ifile = NULL; | ||||
| for (ifile = list->first; ifile; ifile = next_ifile) { | for (ifile = list->first; ifile; ifile = next_ifile) { | ||||
| ▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | #ifndef WITH_HEADLESS | ||||
| init_internal_icons(); | init_internal_icons(); | ||||
| init_brush_icons(); | init_brush_icons(); | ||||
| init_matcap_icons(); | init_matcap_icons(); | ||||
| #endif | #endif | ||||
| } | } | ||||
| /* Render size for preview images and icons | /* Render size for preview images and icons | ||||
| */ | */ | ||||
| static int preview_render_size(enum eIconSizes size) | int UI_preview_render_size(enum eIconSizes size) | ||||
| { | { | ||||
| switch (size) { | switch (size) { | ||||
| case ICON_SIZE_ICON: | case ICON_SIZE_ICON: | ||||
| return ICON_RENDER_DEFAULT_HEIGHT; | return ICON_RENDER_DEFAULT_HEIGHT; | ||||
| case ICON_SIZE_PREVIEW: | case ICON_SIZE_PREVIEW: | ||||
| return PREVIEW_RENDER_DEFAULT_HEIGHT; | return PREVIEW_RENDER_DEFAULT_HEIGHT; | ||||
| default: | default: | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| /* Create rect for the icon | /* Create rect for the icon | ||||
| */ | */ | ||||
| static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) | static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) | ||||
| { | { | ||||
| unsigned int render_size = preview_render_size(size); | unsigned int render_size = UI_preview_render_size(size); | ||||
| if (!prv_img) { | if (!prv_img) { | ||||
| if (G.debug & G_DEBUG) | if (G.debug & G_DEBUG) | ||||
| printf("%s, error: requested preview image does not exist", __func__); | printf("%s, error: requested preview image does not exist", __func__); | ||||
| } | } | ||||
| else if (!prv_img->rect[size]) { | else if (!prv_img->rect[size]) { | ||||
| prv_img->w[size] = render_size; | prv_img->w[size] = render_size; | ||||
| prv_img->h[size] = render_size; | prv_img->h[size] = render_size; | ||||
| ▲ Show 20 Lines • Show All 466 Lines • ▼ Show 20 Lines | if (id) { | ||||
| int icon = ui_id_icon_get(C, id, big); | int icon = ui_id_icon_get(C, id, big); | ||||
| return icon ? icon : rnaicon; | return icon ? icon : rnaicon; | ||||
| } | } | ||||
| return rnaicon; | return rnaicon; | ||||
| } | } | ||||
| int UI_idcode_icon_get(const int idcode) | |||||
| { | |||||
| switch (idcode) { | |||||
| case ID_AC: | |||||
| return ICON_ANIM_DATA; | |||||
| case ID_AR: | |||||
| return ICON_ARMATURE_DATA; | |||||
| case ID_BR: | |||||
| return ICON_BRUSH_DATA; | |||||
| case ID_CA: | |||||
| return ICON_CAMERA_DATA; | |||||
| case ID_CU: | |||||
| return ICON_CURVE_DATA; | |||||
| case ID_GD: | |||||
| return ICON_GREASEPENCIL; | |||||
| case ID_GR: | |||||
| return ICON_GROUP; | |||||
| case ID_IM: | |||||
| return ICON_IMAGE_DATA; | |||||
| case ID_LA: | |||||
| return ICON_LAMP_DATA; | |||||
| case ID_LS: | |||||
| return ICON_LINE_DATA; | |||||
| case ID_LT: | |||||
| return ICON_LATTICE_DATA; | |||||
| case ID_MA: | |||||
| return ICON_MATERIAL_DATA; | |||||
| case ID_MB: | |||||
| return ICON_META_DATA; | |||||
| case ID_MC: | |||||
| return ICON_CLIP; | |||||
| case ID_ME: | |||||
| return ICON_MESH_DATA; | |||||
| case ID_MSK: | |||||
| return ICON_MOD_MASK; /* TODO! this would need its own icon! */ | |||||
| case ID_NT: | |||||
| return ICON_NODETREE; | |||||
| case ID_OB: | |||||
| return ICON_OBJECT_DATA; | |||||
| case ID_PAL: | |||||
| return ICON_COLOR; /* TODO! this would need its own icon! */ | |||||
| case ID_PC: | |||||
| return ICON_CURVE_BEZCURVE; /* TODO! this would need its own icon! */ | |||||
| case ID_SCE: | |||||
| return ICON_SCENE_DATA; | |||||
| case ID_SPK: | |||||
| return ICON_SPEAKER; | |||||
| case ID_SO: | |||||
| return ICON_SOUND; | |||||
| case ID_TE: | |||||
| return ICON_TEXTURE_DATA; | |||||
| case ID_TXT: | |||||
| return ICON_TEXT; | |||||
| case ID_VF: | |||||
| return ICON_FONT_DATA; | |||||
| case ID_WO: | |||||
| return ICON_WORLD_DATA; | |||||
| default: | |||||
| return ICON_NONE; | |||||
| } | |||||
| } | |||||
| static void icon_draw_at_size( | static void icon_draw_at_size( | ||||
| float x, float y, int icon_id, float aspect, float alpha, | float x, float y, int icon_id, float aspect, float alpha, | ||||
| enum eIconSizes size, const bool nocreate) | enum eIconSizes size, const bool nocreate) | ||||
| { | { | ||||
| int draw_size = get_draw_size(size); | int draw_size = get_draw_size(size); | ||||
| icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, false); | icon_draw_size(x, y, icon_id, aspect, alpha, NULL, size, draw_size, nocreate, false); | ||||
| } | } | ||||
| Show All 37 Lines | |||||