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:
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r--source/blender/editors/interface/interface_icons.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index d22ddb5f2b7..7008d22becc 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -41,6 +41,7 @@
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
+#include "DNA_collection_types.h"
#include "DNA_curve_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_gpencil_types.h"
@@ -461,6 +462,33 @@ DEF_ICON_VECTOR_COLORSET_DRAW_NTH(20, 19)
# undef DEF_ICON_VECTOR_COLORSET_DRAW_NTH
+static void vicon_collection_color_draw(
+ short color_tag, int x, int y, int UNUSED(w), int UNUSED(h), float UNUSED(alpha))
+{
+ bTheme *btheme = UI_GetTheme();
+ const ThemeCollectionColor *collection_color = &btheme->collection_color[color_tag];
+
+ UI_icon_draw_ex(
+ x, y, ICON_OUTLINER_COLLECTION, U.inv_dpi_fac, 1.0f, 0.0f, collection_color->color, true);
+}
+
+# define DEF_ICON_COLLECTION_COLOR_DRAW(index, color) \
+ static void vicon_collection_color_draw_##index(int x, int y, int w, int h, float alpha) \
+ { \
+ 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
+
/* Dynamically render icon instead of rendering a plain color to a texture/buffer
* This is not strictly a "vicon", as it needs access to icon->obj to get the color info,
* but it works in a very similar way.
@@ -969,6 +997,15 @@ static void init_internal_icons(void)
def_internal_vicon(ICON_COLORSET_18_VEC, vicon_colorset_draw_18);
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);
}
static void init_iconfile_list(struct ListBase *list)
@@ -2324,6 +2361,17 @@ int UI_mode_icon_get(const int mode)
}
}
+int UI_collection_color_icon_get(const Collection *collection)
+{
+ int icon = ICON_OUTLINER_COLLECTION;
+
+ if (collection->color_tag != COLLECTION_COLOR_NONE) {
+ icon = ICON_COLLECTION_COLOR_01 + collection->color_tag;
+ }
+
+ return icon;
+}
+
/* draws icon with dpi scale factor */
void UI_icon_draw(float x, float y, int icon_id)
{