[Bf-blender-cvs] [05ddacc3424] soc-2020-outliner: Collection Colors: Change indices

Nathan Craddock noreply at git.blender.org
Sat Jul 4 04:57:32 CEST 2020


Commit: 05ddacc3424457470c20563123648d868030254f
Author: Nathan Craddock
Date:   Fri Jul 3 15:30:24 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB05ddacc3424457470c20563123648d868030254f

Collection Colors: Change indices

Use -1 for no color to utilize better themes indexing.

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

M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesdna/DNA_collection_types.h

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

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index ea2555ba91c..2aed2b6c63e 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -464,7 +464,7 @@ static void vicon_collection_color_draw(
     short color, int x, int y, int w, int h, float UNUSED(alpha))
 {
   bTheme *btheme = UI_GetTheme();
-  const ThemeCollectionColor *collection_color = &btheme->collection_color[color - 1];
+  const ThemeCollectionColor *collection_color = &btheme->collection_color[color];
   const int c = x + w;
 
   uint pos = GPU_vertformat_attr_add(
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index b077ad3d300..09e585d640f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -3212,7 +3212,7 @@ static void outliner_draw_tree_element(bContext *C,
       if (collection->color != COLLECTION_COLOR_NONE) {
         bTheme *btheme = UI_GetTheme();
         float color[4];
-        rgba_uchar_to_float(color, btheme->collection_color[collection->color - 1].color);
+        rgba_uchar_to_float(color, btheme->collection_color[collection->color].color);
 
         UI_draw_roundbox_corner_set(UI_CNR_ALL);
         UI_draw_roundbox_aa(true,
@@ -3493,7 +3493,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
 
     if (draw_hierarchy_line) {
       if (color != COLLECTION_COLOR_NONE) {
-        immUniformColor4ubv(btheme->collection_color[color - 1].color);
+        immUniformColor4ubv(btheme->collection_color[color].color);
       }
       else {
         immUniformColor4ubv(col);
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index 3e583cd0db4..9bd4f795032 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -98,13 +98,13 @@ enum {
 
 /* Collection->color */
 enum {
-  COLLECTION_COLOR_NONE = 0,
-  COLLECTION_COLOR_RED = 1,
-  COLLECTION_COLOR_ORANGE = 2,
-  COLLECTION_COLOR_YELLOW = 3,
-  COLLECTION_COLOR_GREEN = 4,
-  COLLECTION_COLOR_BLUE = 5,
-  COLLECTION_COLOR_PURPLE = 6,
+  COLLECTION_COLOR_RED,
+  COLLECTION_COLOR_ORANGE,
+  COLLECTION_COLOR_YELLOW,
+  COLLECTION_COLOR_GREEN,
+  COLLECTION_COLOR_BLUE,
+  COLLECTION_COLOR_PURPLE,
+  COLLECTION_COLOR_NONE = -1,
 };
 
 #endif /* __DNA_COLLECTION_TYPES_H__ */



More information about the Bf-blender-cvs mailing list