diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2020-07-04 20:37:40 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2020-07-04 20:37:40 +0300 |
commit | f5a22d4bbdd833ecc31f6d22d7faafda616cafda (patch) | |
tree | 2a4318e0daffbeb3725b2906750ab926133dd4f2 /source/blender/editors/space_outliner/outliner_draw.c | |
parent | 680b2a4901e16165adc67d44342370443870cc36 (diff) |
Collection Colors: Color collection icons
Color the collection icons rather than drawing behind.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index af9263048ab..4378afcca54 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2783,8 +2783,33 @@ static void tselem_draw_icon(uiBlock *block, return; } + if (outliner_is_collection_tree_element(te)) { + Collection *collection = outliner_collection_from_tree_element(te); + + /* 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; + if (collection->color != 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 - 1].color, + true); + } + else { + UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, NULL, true); + } + } /* Icon is covered by restrict buttons */ - if (!is_clickable || x >= xmax) { + else if (!is_clickable || x >= xmax) { /* Reduce alpha to match icon buttons */ alpha *= 0.8f; |