Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Craddock <nzcraddock@gmail.com>2020-09-15 21:22:03 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-09-15 21:47:09 +0300
commit4c3813fb32567805ef6eac708e3602c2d367cc58 (patch)
tree2f828ef9050350bbc4fe8e6de87d38abc70c778e /source/blender/editors/object
parent452a1c7b38383fd3f51532c429912677864e4a33 (diff)
UI: Show color tagged collection icons in menus
Draw color tagged collection icons in the link to collection, add collection instance, collection instance search, and remove collection menus. Manifest Task: https://developer.blender.org/T77777 Differential Revision: https://developer.blender.org/D8622
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_collection.c4
-rw-r--r--source/blender/editors/object/object_edit.c17
2 files changed, 15 insertions, 6 deletions
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);
}
}