[Bf-blender-cvs] [abf079b64e3] soc-2020-outliner: Revert "Collection Colors: Change indices"

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


Commit: abf079b64e3ede5a5fe73da46d36ca30e8d1e281
Author: Nathan Craddock
Date:   Fri Jul 3 15:43:44 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rBabf079b64e3ede5a5fe73da46d36ca30e8d1e281

Revert "Collection Colors: Change indices"

This reverts commit 05ddacc3424457470c20563123648d868030254f.

Collections were defaulted to colored and I wasn't sure if it was best
to handle the off by one indexing in a few cases or do versioning.

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

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 2aed2b6c63e..ea2555ba91c 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];
+  const ThemeCollectionColor *collection_color = &btheme->collection_color[color - 1];
   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 09e585d640f..b077ad3d300 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].color);
+        rgba_uchar_to_float(color, btheme->collection_color[collection->color - 1].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].color);
+        immUniformColor4ubv(btheme->collection_color[color - 1].color);
       }
       else {
         immUniformColor4ubv(col);
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index 9bd4f795032..3e583cd0db4 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_RED,
-  COLLECTION_COLOR_ORANGE,
-  COLLECTION_COLOR_YELLOW,
-  COLLECTION_COLOR_GREEN,
-  COLLECTION_COLOR_BLUE,
-  COLLECTION_COLOR_PURPLE,
-  COLLECTION_COLOR_NONE = -1,
+  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,
 };
 
 #endif /* __DNA_COLLECTION_TYPES_H__ */



More information about the Bf-blender-cvs mailing list