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-15 21:34:57 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-09-15 21:47:10 +0300
commit16f625ee654065f3102630c81bb0aca9df1465c2 (patch)
tree4dcf6591c66b80a61f36638413d02617ba1009fd /source/blender
parent33d7b36cecd4a6dab2bd5798071f58545ae0cabe (diff)
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
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c26
1 files changed, 24 insertions, 2 deletions
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;