[Bf-blender-cvs] [f5a22d4bbdd] soc-2020-outliner: Collection Colors: Color collection icons

Nathan Craddock noreply at git.blender.org
Sun Jul 5 00:51:18 CEST 2020


Commit: f5a22d4bbdd833ecc31f6d22d7faafda616cafda
Author: Nathan Craddock
Date:   Sat Jul 4 11:37:40 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBf5a22d4bbdd833ecc31f6d22d7faafda616cafda

Collection Colors: Color collection icons

Color the collection icons rather than drawing behind.

===================================================================

M	source/blender/editors/space_outliner/outliner_draw.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list