From b11093306bdcc9c9428b344a003b4dacc710417f Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Tue, 7 Oct 2025 02:07:28 +0200 Subject: [PATCH] UI: SVG Icons for Collection Colors A test of using multi-color SVG icons in place of the current "vector" (custom drawn) style we are using now. These use separate colors for the box body versus outline, shadow, handhold. Colored by the theme colors. Pull Request: https://projects.blender.org/blender/blender/pulls/126307 --- .../icons_svg/collection_color_01.svg | 1 + .../icons_svg/collection_color_02.svg | 1 + .../icons_svg/collection_color_03.svg | 1 + .../icons_svg/collection_color_04.svg | 1 + .../icons_svg/collection_color_05.svg | 1 + .../icons_svg/collection_color_06.svg | 1 + .../icons_svg/collection_color_07.svg | 1 + .../icons_svg/collection_color_08.svg | 1 + .../icons_svg/outliner_collection.svg | 2 +- .../blender/editors/datafiles/CMakeLists.txt | 8 +++ source/blender/editors/include/UI_icons.hh | 19 ++++--- .../editors/interface/interface_icons.cc | 54 +++---------------- .../editors/space_outliner/outliner_draw.cc | 2 +- 13 files changed, 35 insertions(+), 58 deletions(-) create mode 100644 release/datafiles/icons_svg/collection_color_01.svg create mode 100644 release/datafiles/icons_svg/collection_color_02.svg create mode 100644 release/datafiles/icons_svg/collection_color_03.svg create mode 100644 release/datafiles/icons_svg/collection_color_04.svg create mode 100644 release/datafiles/icons_svg/collection_color_05.svg create mode 100644 release/datafiles/icons_svg/collection_color_06.svg create mode 100644 release/datafiles/icons_svg/collection_color_07.svg create mode 100644 release/datafiles/icons_svg/collection_color_08.svg diff --git a/release/datafiles/icons_svg/collection_color_01.svg b/release/datafiles/icons_svg/collection_color_01.svg new file mode 100644 index 00000000000..29fb2da7a4f --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_01.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_02.svg b/release/datafiles/icons_svg/collection_color_02.svg new file mode 100644 index 00000000000..b8e5fd7acee --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_02.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_03.svg b/release/datafiles/icons_svg/collection_color_03.svg new file mode 100644 index 00000000000..37b11088331 --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_03.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_04.svg b/release/datafiles/icons_svg/collection_color_04.svg new file mode 100644 index 00000000000..25717c2f8e2 --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_04.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_05.svg b/release/datafiles/icons_svg/collection_color_05.svg new file mode 100644 index 00000000000..ab985dc43bf --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_05.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_06.svg b/release/datafiles/icons_svg/collection_color_06.svg new file mode 100644 index 00000000000..f47c2e6fa21 --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_06.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_07.svg b/release/datafiles/icons_svg/collection_color_07.svg new file mode 100644 index 00000000000..2324581d906 --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_07.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/collection_color_08.svg b/release/datafiles/icons_svg/collection_color_08.svg new file mode 100644 index 00000000000..5b6774cd107 --- /dev/null +++ b/release/datafiles/icons_svg/collection_color_08.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/release/datafiles/icons_svg/outliner_collection.svg b/release/datafiles/icons_svg/outliner_collection.svg index e7ed737fed7..35a323ba722 100644 --- a/release/datafiles/icons_svg/outliner_collection.svg +++ b/release/datafiles/icons_svg/outliner_collection.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt index 7bb0d149290..2093ffad8e6 100644 --- a/source/blender/editors/datafiles/CMakeLists.txt +++ b/source/blender/editors/datafiles/CMakeLists.txt @@ -245,6 +245,14 @@ if(WITH_BLENDER) clipuv_dehlt clipuv_hlt collapsemenu + collection_color_01 + collection_color_02 + collection_color_03 + collection_color_04 + collection_color_05 + collection_color_06 + collection_color_07 + collection_color_08 collection_new color color_blue diff --git a/source/blender/editors/include/UI_icons.hh b/source/blender/editors/include/UI_icons.hh index 15632774a69..a4d617f3715 100644 --- a/source/blender/editors/include/UI_icons.hh +++ b/source/blender/editors/include/UI_icons.hh @@ -308,7 +308,15 @@ DEF_ICON(DECORATE_OVERRIDE) DEF_ICON(DECORATE) /* OUTLINER */ -DEF_ICON_COLLECTION(OUTLINER_COLLECTION) +DEF_ICON_COLOR(OUTLINER_COLLECTION) +DEF_ICON_COLOR(COLLECTION_COLOR_01) +DEF_ICON_COLOR(COLLECTION_COLOR_02) +DEF_ICON_COLOR(COLLECTION_COLOR_03) +DEF_ICON_COLOR(COLLECTION_COLOR_04) +DEF_ICON_COLOR(COLLECTION_COLOR_05) +DEF_ICON_COLOR(COLLECTION_COLOR_06) +DEF_ICON_COLOR(COLLECTION_COLOR_07) +DEF_ICON_COLOR(COLLECTION_COLOR_08) DEF_ICON_OBJECT_DATA(CURVES_DATA) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_ARMATURE) DEF_ICON_OBJECT_DATA(OUTLINER_DATA_CAMERA) @@ -926,15 +934,6 @@ DEF_ICON_VECTOR(COLORSET_18_VEC) DEF_ICON_VECTOR(COLORSET_19_VEC) DEF_ICON_VECTOR(COLORSET_20_VEC) -DEF_ICON_VECTOR(COLLECTION_COLOR_01) -DEF_ICON_VECTOR(COLLECTION_COLOR_02) -DEF_ICON_VECTOR(COLLECTION_COLOR_03) -DEF_ICON_VECTOR(COLLECTION_COLOR_04) -DEF_ICON_VECTOR(COLLECTION_COLOR_05) -DEF_ICON_VECTOR(COLLECTION_COLOR_06) -DEF_ICON_VECTOR(COLLECTION_COLOR_07) -DEF_ICON_VECTOR(COLLECTION_COLOR_08) - DEF_ICON_VECTOR(STRIP_COLOR_01) DEF_ICON_VECTOR(STRIP_COLOR_02) DEF_ICON_VECTOR(STRIP_COLOR_03) diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index aa31f902396..a25d66161d6 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -477,43 +477,6 @@ DEF_ICON_VECTOR_COLORSET_DRAW_NTH(20, 19) # undef DEF_ICON_VECTOR_COLORSET_DRAW_NTH -static void vicon_collection_color_draw( - short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/) -{ - bTheme *btheme = UI_GetTheme(); - const ThemeCollectionColor *collection_color = &btheme->collection_color[color_tag]; - - const float aspect = float(ICON_DEFAULT_WIDTH) / w; - - UI_icon_draw_ex(x, - y, - ICON_OUTLINER_COLLECTION, - aspect, - 1.0f, - 0.0f, - collection_color->color, - btheme->tui.icon_border_intensity > 0.0f, - UI_NO_ICON_OVERLAY_TEXT); -} - -# define DEF_ICON_COLLECTION_COLOR_DRAW(index, color) \ - static void vicon_collection_color_draw_##index( \ - float x, float y, float w, float h, float alpha, const uchar * /*mono_rgba[4]*/) \ - { \ - vicon_collection_color_draw(color, x, y, w, h, alpha); \ - } - -DEF_ICON_COLLECTION_COLOR_DRAW(01, COLLECTION_COLOR_01); -DEF_ICON_COLLECTION_COLOR_DRAW(02, COLLECTION_COLOR_02); -DEF_ICON_COLLECTION_COLOR_DRAW(03, COLLECTION_COLOR_03); -DEF_ICON_COLLECTION_COLOR_DRAW(04, COLLECTION_COLOR_04); -DEF_ICON_COLLECTION_COLOR_DRAW(05, COLLECTION_COLOR_05); -DEF_ICON_COLLECTION_COLOR_DRAW(06, COLLECTION_COLOR_06); -DEF_ICON_COLLECTION_COLOR_DRAW(07, COLLECTION_COLOR_07); -DEF_ICON_COLLECTION_COLOR_DRAW(08, COLLECTION_COLOR_08); - -# undef DEF_ICON_COLLECTION_COLOR_DRAW - static void vicon_strip_color_draw( short color_tag, float x, float y, float w, float /*h*/, float /*alpha*/) { @@ -996,15 +959,6 @@ static void init_internal_icons() def_internal_vicon(ICON_COLORSET_19_VEC, vicon_colorset_draw_19); def_internal_vicon(ICON_COLORSET_20_VEC, vicon_colorset_draw_20); - def_internal_vicon(ICON_COLLECTION_COLOR_01, vicon_collection_color_draw_01); - def_internal_vicon(ICON_COLLECTION_COLOR_02, vicon_collection_color_draw_02); - def_internal_vicon(ICON_COLLECTION_COLOR_03, vicon_collection_color_draw_03); - def_internal_vicon(ICON_COLLECTION_COLOR_04, vicon_collection_color_draw_04); - def_internal_vicon(ICON_COLLECTION_COLOR_05, vicon_collection_color_draw_05); - def_internal_vicon(ICON_COLLECTION_COLOR_06, vicon_collection_color_draw_06); - def_internal_vicon(ICON_COLLECTION_COLOR_07, vicon_collection_color_draw_07); - def_internal_vicon(ICON_COLLECTION_COLOR_08, vicon_collection_color_draw_08); - def_internal_vicon(ICON_STRIP_COLOR_01, vicon_strip_color_draw_01); def_internal_vicon(ICON_STRIP_COLOR_02, vicon_strip_color_draw_02); def_internal_vicon(ICON_STRIP_COLOR_03, vicon_strip_color_draw_03); @@ -1538,6 +1492,14 @@ static void svg_replace_color_attributes(std::string &svg, {"blender_info", nullptr, TH_INFO}, {"blender_scene", nullptr, TH_ICON_SCENE}, {"blender_collection", nullptr, TH_ICON_COLLECTION}, + {"blender_collection_color_01", btheme->collection_color[0].color}, + {"blender_collection_color_02", btheme->collection_color[1].color}, + {"blender_collection_color_03", btheme->collection_color[2].color}, + {"blender_collection_color_04", btheme->collection_color[3].color}, + {"blender_collection_color_05", btheme->collection_color[4].color}, + {"blender_collection_color_06", btheme->collection_color[5].color}, + {"blender_collection_color_07", btheme->collection_color[6].color}, + {"blender_collection_color_08", btheme->collection_color[7].color}, {"blender_object", nullptr, TH_ICON_OBJECT}, {"blender_object_data", nullptr, TH_ICON_OBJECT_DATA}, {"blender_modifier", nullptr, TH_ICON_MODIFIER}, diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index 5dec761cdd3..63c19da64c1 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -2986,7 +2986,7 @@ static bool tselem_draw_icon(uiBlock *block, if (collection->color_tag != COLLECTION_COLOR_NONE) { UI_icon_draw_ex(x, y, - data.icon, + ICON_COLLECTION_COLOR_01 + collection->color_tag, UI_INV_SCALE_FAC, alpha, 0.0f,