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-23 06:04:47 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-09-23 06:06:48 +0300
commit5a28090977d66d8e52d269fb5bb938d953191dde (patch)
tree5aee7a35a0d945c38437753c5c12b64821f0e892
parent358a8e00bd07c658a8a3d7a3fd6224953f50e09a (diff)
Fix outliner collection icon in light theme
Ensure the theme colors are used for the collection icon when there are no color tags present, otherwise it draws completely black.
-rw-r--r--source/blender/editors/include/UI_icons.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c43
2 files changed, 20 insertions, 25 deletions
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index e976aac27a2..09ab72efaaf 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -320,7 +320,7 @@ DEF_ICON_OBJECT(OUTLINER_OB_GROUP_INSTANCE)
DEF_ICON_OBJECT(OUTLINER_OB_GREASEPENCIL)
DEF_ICON_OBJECT(OUTLINER_OB_LIGHTPROBE)
DEF_ICON_OBJECT(OUTLINER_OB_IMAGE)
-DEF_ICON(OUTLINER_COLLECTION)
+DEF_ICON_COLLECTION(OUTLINER_COLLECTION)
DEF_ICON(RESTRICT_COLOR_OFF)
DEF_ICON(RESTRICT_COLOR_ON)
DEF_ICON(HIDE_ON)
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index ff84c3c9d88..9e805e2052f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2769,43 +2769,38 @@ static void tselem_draw_icon(uiBlock *block,
const bool is_clickable)
{
TreeElementIcon data = tree_element_get_icon(tselem, te);
-
if (data.icon == 0) {
return;
}
- if (outliner_is_collection_tree_element(te)) {
- Collection *collection = outliner_collection_from_tree_element(te);
+ const bool is_collection = outliner_is_collection_tree_element(te);
+ /* Collection colors and icons covered by restrict buttons. */
+ if (!is_clickable || x >= xmax || is_collection) {
/* placement of icons, copied from interface_widgets.c */
float aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT;
x += 2.0f * aspect;
y += 2.0f * aspect;
- if (collection->color_tag != COLLECTION_COLOR_NONE) {
- bTheme *btheme = UI_GetTheme();
- UI_icon_draw_ex(x,
- y,
- data.icon,
- U.inv_dpi_fac,
- alpha,
- 0.0f,
- btheme->collection_color[collection->color_tag].color,
- true);
- }
- else {
- UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, NULL, true);
+
+ if (is_collection) {
+ Collection *collection = outliner_collection_from_tree_element(te);
+ if (collection->color_tag != COLLECTION_COLOR_NONE) {
+ bTheme *btheme = UI_GetTheme();
+ UI_icon_draw_ex(x,
+ y,
+ data.icon,
+ U.inv_dpi_fac,
+ alpha,
+ 0.0f,
+ btheme->collection_color[collection->color_tag].color,
+ true);
+ return;
+ }
}
- }
- /* Icon is covered by restrict buttons */
- else if (!is_clickable || x >= xmax) {
+
/* Reduce alpha to match icon buttons */
alpha *= 0.8f;
- /* placement of icons, copied from interface_widgets.c */
- float aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT;
- x += 2.0f * aspect;
- y += 2.0f * aspect;
-
/* restrict column clip... it has been coded by simply overdrawing,
* doesn't work for buttons */
uchar color[4];