[Bf-blender-cvs] [1dda60792cc] master: Cleanup: use 'UI_icon_*' prefix for icons API

Campbell Barton noreply at git.blender.org
Fri Sep 18 02:28:21 CEST 2020


Commit: 1dda60792cc303ec81785d6a79926eed9a4da3d3
Author: Campbell Barton
Date:   Fri Sep 18 10:24:14 2020 +1000
Branches: master
https://developer.blender.org/rB1dda60792cc303ec81785d6a79926eed9a4da3d3

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

===================================================================

M	source/blender/editors/include/UI_interface_icons.h
M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/interface/interface_utils.c
M	source/blender/editors/object/object_collection.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/space_file/filelist.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesrna/intern/rna_ui_api.c
M	source/blender/python/intern/bpy_app.c
M	source/blender/windowmanager/intern/wm_operators.c

===================================================================

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))

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list