[Bf-blender-cvs] [5a28090977d] master: Fix outliner collection icon in light theme

Nathan Craddock noreply at git.blender.org
Wed Sep 23 05:25:23 CEST 2020


Commit: 5a28090977d66d8e52d269fb5bb938d953191dde
Author: Nathan Craddock
Date:   Tue Sep 22 21:04:47 2020 -0600
Branches: master
https://developer.blender.org/rB5a28090977d66d8e52d269fb5bb938d953191dde

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.

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

M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/space_outliner/outliner_draw.c

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

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];



More information about the Bf-blender-cvs mailing list