From 1dda60792cc303ec81785d6a79926eed9a4da3d3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Sep 2020 10:24:14 +1000 Subject: Cleanup: use 'UI_icon_*' prefix for icons API - UI_collection_color_icon_get -> UI_icon_color_from_collection - UI_idcode_icon_get -> UI_icon_from_idcode - UI_library_icon_get -> UI_icon_from_library - UI_mode_icon_get -> UI_icon_from_object_mode - UI_rnaptr_icon_get -> UI_icon_from_rnaptr - UI_alert_image -> UI_icon_alert_imbuf_get - UI_preview_render_size -> UI_icon_preview_to_render_size - UI_id_icon_render -> UI_icon_render_id --- .../blender/editors/include/UI_interface_icons.h | 16 ++++++++-------- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_icons.c | 22 +++++++++++----------- .../editors/interface/interface_templates.c | 8 ++++---- source/blender/editors/interface/interface_utils.c | 2 +- source/blender/editors/object/object_collection.c | 2 +- source/blender/editors/object/object_edit.c | 4 ++-- source/blender/editors/space_file/filelist.c | 2 +- .../blender/editors/space_outliner/outliner_draw.c | 4 ++-- source/blender/makesrna/intern/rna_ui_api.c | 2 +- source/blender/python/intern/bpy_app.c | 2 +- source/blender/windowmanager/intern/wm_operators.c | 6 +++--- 12 files changed, 36 insertions(+), 36 deletions(-) (limited to 'source') diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 9c0539d5c2f..307873e09f0 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -61,7 +61,7 @@ typedef enum eAlertIcon { ALERT_ICON_MAX, } eAlertIcon; -struct ImBuf *UI_alert_image(eAlertIcon icon); +struct ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon); /* * Resizable Icons for Blender @@ -73,12 +73,12 @@ int UI_icon_get_width(int icon_id); int UI_icon_get_height(int icon_id); bool UI_icon_get_theme_color(int icon_id, unsigned char color[4]); -void UI_id_icon_render(const struct bContext *C, +void UI_icon_render_id(const struct bContext *C, struct Scene *scene, struct ID *id, const bool big, const bool use_job); -int UI_preview_render_size(enum eIconSizes size); +int UI_icon_preview_to_render_size(enum eIconSizes size); void UI_icon_draw(float x, float y, int icon_id); void UI_icon_draw_alpha(float x, float y, int icon_id, float alpha); @@ -104,11 +104,11 @@ int UI_iconfile_get_index(const char *filename); struct PreviewImage *UI_icon_to_preview(int icon_id); -int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big); -int UI_idcode_icon_get(const int idcode); -int UI_library_icon_get(const struct ID *id); -int UI_mode_icon_get(const int mode); -int UI_collection_color_icon_get(const struct Collection *collection); +int UI_icon_from_rnaptr(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big); +int UI_icon_from_idcode(const int idcode); +int UI_icon_from_library(const struct ID *id); +int UI_icon_from_object_mode(const int mode); +int UI_icon_color_from_collection(const struct Collection *collection); #ifdef __cplusplus } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 11c7f68ae55..e1e16636253 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -4734,7 +4734,7 @@ uiBut *uiDefButImage( uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height) { - struct ImBuf *ibuf = UI_alert_image(icon); + struct ImBuf *ibuf = UI_icon_alert_imbuf_get(icon); if (icon == ALERT_ICON_BLENDER) { return uiDefButImage(block, ibuf, x, y, width, height, NULL); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 951321b93e6..6cd005b59e5 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1250,7 +1250,7 @@ void UI_icons_init() /* Render size for preview images and icons */ -int UI_preview_render_size(enum eIconSizes size) +int UI_icon_preview_to_render_size(enum eIconSizes size) { switch (size) { case ICON_SIZE_ICON: @@ -1266,7 +1266,7 @@ int UI_preview_render_size(enum eIconSizes size) */ static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size) { - const uint render_size = UI_preview_render_size(size); + const uint render_size = UI_icon_preview_to_render_size(size); if (!prv_img) { if (G.debug & G_DEBUG) { @@ -1946,7 +1946,7 @@ static void ui_id_preview_image_render_size( } } -void UI_id_icon_render(const bContext *C, Scene *scene, ID *id, const bool big, const bool use_job) +void UI_icon_render_id(const bContext *C, Scene *scene, ID *id, const bool big, const bool use_job) { PreviewImage *pi = BKE_previewimg_id_ensure(id); @@ -2165,13 +2165,13 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big) case ID_LA: /* fall through */ iconid = BKE_icon_id_ensure(id); /* checks if not exists, or changed */ - UI_id_icon_render(C, NULL, id, big, true); + UI_icon_render_id(C, NULL, id, big, true); break; case ID_SCR: iconid = ui_id_screen_get_icon(C, id); break; case ID_GR: - iconid = UI_collection_color_icon_get((Collection *)id); + iconid = UI_icon_color_from_collection((Collection *)id); break; default: break; @@ -2180,7 +2180,7 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big) return iconid; } -int UI_library_icon_get(const ID *id) +int UI_icon_from_library(const ID *id) { if (ID_IS_LINKED(id)) { if (id->tag & LIB_TAG_MISSING) { @@ -2198,7 +2198,7 @@ int UI_library_icon_get(const ID *id) return ICON_NONE; } -int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big) +int UI_icon_from_rnaptr(bContext *C, PointerRNA *ptr, int rnaicon, const bool big) { ID *id = NULL; @@ -2255,7 +2255,7 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big return rnaicon; } -int UI_idcode_icon_get(const int idcode) +int UI_icon_from_idcode(const int idcode) { switch (idcode) { case ID_AC: @@ -2334,7 +2334,7 @@ int UI_idcode_icon_get(const int idcode) } } -int UI_mode_icon_get(const int mode) +int UI_icon_from_object_mode(const int mode) { switch (mode) { case OB_MODE_OBJECT: @@ -2364,7 +2364,7 @@ int UI_mode_icon_get(const int mode) } } -int UI_collection_color_icon_get(const Collection *collection) +int UI_icon_color_from_collection(const Collection *collection) { int icon = ICON_OUTLINER_COLLECTION; @@ -2415,7 +2415,7 @@ void UI_icon_draw_ex(float x, /* ********** Alert Icons ********** */ -ImBuf *UI_alert_image(eAlertIcon icon) +ImBuf *UI_icon_alert_imbuf_get(eAlertIcon icon) { #ifdef WITH_HEADLESS return NULL; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index a1c7ba711cd..30b98717505 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -374,7 +374,7 @@ static bool id_search_add(const bContext *C, TemplateID *template_ui, uiSearchIt int name_prefix_offset; BKE_id_full_name_ui_prefix_get(name_ui, id, use_lib_prefix, UI_SEP_CHAR, &name_prefix_offset); if (!use_lib_prefix) { - iconid = UI_library_icon_get(id); + iconid = UI_icon_from_library(id); } if (!UI_search_item_add(items, @@ -6252,7 +6252,7 @@ void uiTemplateList(uiLayout *layout, sub = uiLayoutRow(overlap, false); - icon = UI_rnaptr_icon_get(C, itemptr, rnaicon, false); + icon = UI_icon_from_rnaptr(C, itemptr, rnaicon, false); if (icon == ICON_DOT) { icon = ICON_NONE; } @@ -6308,7 +6308,7 @@ void uiTemplateList(uiLayout *layout, PointerRNA *itemptr = &items_ptr[activei].item; const int org_i = items_ptr[activei].org_idx; - icon = UI_rnaptr_icon_get(C, itemptr, rnaicon, false); + icon = UI_icon_from_rnaptr(C, itemptr, rnaicon, false); if (icon == ICON_DOT) { icon = ICON_NONE; } @@ -6392,7 +6392,7 @@ void uiTemplateList(uiLayout *layout, sub = uiLayoutRow(overlap, false); - icon = UI_rnaptr_icon_get(C, itemptr, rnaicon, false); + icon = UI_icon_from_rnaptr(C, itemptr, rnaicon, false); draw_item(ui_list, C, sub, diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 7b72e380f5e..30538cc7050 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -486,7 +486,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C, * name prefix for showing the library status. */ int name_prefix_offset = cis->name_prefix_offset; if (!has_id_icon && cis->is_id && !requires_exact_data_name) { - cis->iconid = UI_library_icon_get(cis->data); + cis->iconid = UI_icon_from_library(cis->data); /* No need to re-allocate, string should be shorter than before (lib status prefix is * removed). */ BKE_id_full_name_ui_prefix_get(name_buf, cis->data, false, UI_SEP_CHAR, &name_prefix_offset); diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c index 5f14cdcd299..ea203468e74 100644 --- a/source/blender/editors/object/object_collection.c +++ b/source/blender/editors/object/object_collection.c @@ -96,7 +96,7 @@ static const EnumPropertyItem *collection_object_active_itemf(bContext *C, collection = NULL; while ((collection = BKE_collection_object_find(bmain, scene, collection, ob))) { item_tmp.identifier = item_tmp.name = collection->id.name + 2; - item_tmp.icon = UI_collection_color_icon_get(collection); + item_tmp.icon = UI_icon_color_from_collection(collection); item_tmp.value = i; RNA_enum_item_add(&item, &totitem, &item_tmp); i++; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7a17cdc30e4..9c05dbb7b1c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1853,7 +1853,7 @@ static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void * Scene *scene = CTX_data_scene(C); const int icon = (menu->collection == scene->master_collection) ? ICON_SCENE_DATA : - UI_collection_color_icon_get(menu->collection); + UI_icon_color_from_collection(menu->collection); uiItemIntO(layout, name, icon, menu->ot->idname, "collection_index", menu->index); for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL; @@ -1864,7 +1864,7 @@ static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void * static void move_to_collection_menus_items(uiLayout *layout, MoveToCollectionData *menu) { - const int icon = UI_collection_color_icon_get(menu->collection); + const int icon = UI_icon_color_from_collection(menu->collection); if (BLI_listbase_is_empty(&menu->submenus)) { uiItemIntO(layout, diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 5f0e6c8361e..48ee87662ea 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1104,7 +1104,7 @@ static int filelist_geticon_ex(FileDirEntry *file, return ICON_FILE_ARCHIVE; } if (typeflag & FILE_TYPE_BLENDERLIB) { - const int ret = UI_idcode_icon_get(file->blentype); + const int ret = UI_icon_from_idcode(file->blentype); if (ret != ICON_NONE) { return ret; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 0ab98a6ab66..fb6d3a74e76 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1928,7 +1928,7 @@ static void outliner_draw_mode_column_toggle(uiBlock *block, const char *tip; if (draw_active_icon && ob->mode == tvc->obact->mode) { - icon = UI_mode_icon_get(active_mode); + icon = UI_icon_from_object_mode(active_mode); tip = TIP_("Remove from the current mode"); } else { @@ -3252,7 +3252,7 @@ static void outliner_draw_tree_element(bContext *C, if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) || ((tselem->type == TSE_RNA_STRUCT) && RNA_struct_is_ID(te->rnaptr.type))) { - const BIFIconID lib_icon = UI_library_icon_get(tselem->id); + const BIFIconID lib_icon = UI_icon_from_library(tselem->id); if (lib_icon != ICON_NONE) { UI_icon_draw_alpha( (float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, lib_icon, alpha_fac); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index 76d76b0a913..47d9e3e146a 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -557,7 +557,7 @@ static uiLayout *rna_uiLayoutColumnWithHeading( static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon) { - return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false); + return UI_icon_from_rnaptr(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false); } static const char *rna_ui_get_enum_name(bContext *C, diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index f0de05f95b3..c532f3d68fd 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -383,7 +383,7 @@ PyDoc_STRVAR(bpy_app_preview_render_size_doc, "Reference size for icon/preview renders (read-only)"); static PyObject *bpy_app_preview_render_size_get(PyObject *UNUSED(self), void *closure) { - return PyLong_FromLong((long)UI_preview_render_size(POINTER_AS_INT(closure))); + return PyLong_FromLong((long)UI_icon_preview_to_render_size(POINTER_AS_INT(closure))); } static PyObject *bpy_app_autoexec_fail_message_get(PyObject *UNUSED(self), void *UNUSED(closure)) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 0f3409af3d3..2b01c8fe90e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3347,8 +3347,8 @@ static void previews_id_ensure(bContext *C, Scene *scene, ID *id) /* Only preview non-library datablocks, lib ones do not pertain to this .blend file! * Same goes for ID with no user. */ if (!ID_IS_LINKED(id) && (id->us != 0)) { - UI_id_icon_render(C, scene, id, false, false); - UI_id_icon_render(C, scene, id, true, false); + UI_icon_render_id(C, scene, id, false, false); + UI_icon_render_id(C, scene, id, true, false); } } @@ -3994,7 +3994,7 @@ static const EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), /* Show collection color tag icons in menus. */ if (GS(id->name) == ID_GR) { - item_tmp.icon = UI_collection_color_icon_get((Collection *)id); + item_tmp.icon = UI_icon_color_from_collection((Collection *)id); } RNA_enum_item_add(&item, &totitem, &item_tmp); -- cgit v1.2.3