diff options
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 3 | ||||
-rw-r--r-- | source/blender/editors/object/object_collection.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 17 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 6 |
4 files changed, 24 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 7008d22becc..951321b93e6 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -2170,6 +2170,9 @@ int ui_id_icon_get(const bContext *C, ID *id, const bool big) case ID_SCR: iconid = ui_id_screen_get_icon(C, id); break; + case ID_GR: + iconid = UI_collection_color_icon_get((Collection *)id); + break; default: break; } diff --git a/source/blender/editors/object/object_collection.c b/source/blender/editors/object/object_collection.c index 24f6d8c79f9..5f14cdcd299 100644 --- a/source/blender/editors/object/object_collection.c +++ b/source/blender/editors/object/object_collection.c @@ -50,6 +50,8 @@ #include "RNA_define.h" #include "RNA_enum_types.h" +#include "UI_interface_icons.h" + #include "object_intern.h" /********************* 3d view operators ***********************/ @@ -94,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 = ICON_ARMATURE_DATA; */ + item_tmp.icon = UI_collection_color_icon_get(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 6dcb7e2a1b0..7a17cdc30e4 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -100,6 +100,8 @@ #include "RNA_define.h" #include "RNA_enum_types.h" +#include "UI_interface_icons.h" + #include "CLG_log.h" /* for menu/popup icons etc etc*/ @@ -1832,7 +1834,7 @@ static void move_to_collection_menus_free(MoveToCollectionData **menu) *menu = NULL; } -static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout, void *menu_v) +static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void *menu_v) { MoveToCollectionData *menu = menu_v; const char *name = BKE_collection_ui_name_get(menu->collection); @@ -1848,7 +1850,11 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout uiItemS(layout); - uiItemIntO(layout, name, ICON_SCENE_DATA, menu->ot->idname, "collection_index", menu->index); + Scene *scene = CTX_data_scene(C); + const int icon = (menu->collection == scene->master_collection) ? + ICON_SCENE_DATA : + UI_collection_color_icon_get(menu->collection); + uiItemIntO(layout, name, icon, menu->ot->idname, "collection_index", menu->index); for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL; submenu = submenu->next) { @@ -1858,17 +1864,18 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout static void move_to_collection_menus_items(uiLayout *layout, MoveToCollectionData *menu) { + const int icon = UI_collection_color_icon_get(menu->collection); + if (BLI_listbase_is_empty(&menu->submenus)) { uiItemIntO(layout, menu->collection->id.name + 2, - ICON_NONE, + icon, menu->ot->idname, "collection_index", menu->index); } else { - uiItemMenuF( - layout, menu->collection->id.name + 2, ICON_NONE, move_to_collection_menu_create, menu); + uiItemMenuF(layout, menu->collection->id.name + 2, icon, move_to_collection_menu_create, menu); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index ffe2ffac3a2..0f3409af3d3 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3991,6 +3991,12 @@ static const EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), if (local == false || !ID_IS_LINKED(id)) { item_tmp.identifier = item_tmp.name = id->name + 2; item_tmp.value = i++; + + /* Show collection color tag icons in menus. */ + if (GS(id->name) == ID_GR) { + item_tmp.icon = UI_collection_color_icon_get((Collection *)id); + } + RNA_enum_item_add(&item, &totitem, &item_tmp); } } |