From 16f625ee654065f3102630c81bb0aca9df1465c2 Mon Sep 17 00:00:00 2001 From: Nathan Craddock Date: Tue, 15 Sep 2020 12:34:57 -0600 Subject: Outliner: Draw colored collection icons This replaces the collection icon with the filled collection icon. If the collection is color tagged, then the icon draws in the tagged color. Manifest Task: https://developer.blender.org/T77777 Differential Revision: https://developer.blender.org/D8622 --- .../blender/editors/space_outliner/outliner_draw.c | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 3de786ddd4d..32b29e712bc 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2464,7 +2464,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : NULL; } - data.icon = ICON_GROUP; + data.icon = ICON_OUTLINER_COLLECTION; break; } case TSE_GP_LAYER: { @@ -2769,8 +2769,30 @@ static void tselem_draw_icon(uiBlock *block, return; } + if (outliner_is_collection_tree_element(te)) { + Collection *collection = outliner_collection_from_tree_element(te); + + /* 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); + } + } /* 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; -- cgit v1.2.3