[Bf-blender-cvs] [cd0f918c1bf] soc-2020-outliner: Collections: Use collection icon for collection color squares

Nathan Craddock noreply at git.blender.org
Fri Aug 14 06:06:35 CEST 2020


Commit: cd0f918c1bffd5240c8eca9f455db54ce5b2c597
Author: Nathan Craddock
Date:   Thu Aug 13 22:05:53 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBcd0f918c1bffd5240c8eca9f455db54ce5b2c597

Collections: Use collection icon for collection color squares

Rather than using a fixed square, draw the filled collection icon. This
looks cleaner, and has the benefit of implying that collection colors
only apply to collections, not to objects or other types.

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

M	source/blender/editors/interface/interface_icons.c

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

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index e269dd025a1..63c62c02065 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -462,22 +462,13 @@ DEF_ICON_VECTOR_COLORSET_DRAW_NTH(20, 19)
 #  undef DEF_ICON_VECTOR_COLORSET_DRAW_NTH
 
 static void vicon_collection_color_draw(
-    short color, int x, int y, int w, int h, float UNUSED(alpha))
+    short color, int x, int y, int UNUSED(w), int UNUSED(), float UNUSED(alpha))
 {
   bTheme *btheme = UI_GetTheme();
   const ThemeCollectionColor *collection_color = &btheme->collection_color[color - 1];
-  const int c = x + w;
-
-  uint pos = GPU_vertformat_attr_add(
-      immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
-  immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
-  /* XXX: Include alpha into this... */
-  /* normal */
-  immUniformColor3ubv(collection_color->color);
-  immRecti(pos, x, y, c, y + h);
-
-  immUnbindProgram();
+  UI_icon_draw_ex(
+      x, y, ICON_OUTLINER_COLLECTION, U.inv_dpi_fac, 1.0f, 0.0f, collection_color->color, true);
 }
 
 #  define DEF_ICON_COLLECTION_COLOR_DRAW(index, color) \



More information about the Bf-blender-cvs mailing list