[Bf-blender-cvs] [45d27e39e04] soc-2020-outliner: Collection Tags: Use numbers rather than fixed color names

Nathan Craddock noreply at git.blender.org
Thu Jul 16 01:22:27 CEST 2020


Commit: 45d27e39e0456349fd52ee20476b98031239a6a8
Author: Nathan Craddock
Date:   Wed Jul 15 16:58:33 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB45d27e39e0456349fd52ee20476b98031239a6a8

Collection Tags: Use numbers rather than fixed color names

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

M	release/scripts/startup/bl_ui/space_outliner.py
M	source/blender/editors/include/UI_icons.h
M	source/blender/editors/interface/interface_icons.c
M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesrna/intern/rna_collection.c

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

diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 56c28ea6d69..794d9eb73b8 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -238,13 +238,7 @@ class OUTLINER_MT_collection(Menu):
             layout.separator()
 
             layout.label(text="Color Tag")
-            layout.operator("outliner.collection_color_tag_set", text="None", icon="X").color = 'NONE'
-            layout.operator("outliner.collection_color_tag_set", text="Red", icon="COLLECTION_COLOR_RED").color = 'RED'
-            layout.operator("outliner.collection_color_tag_set", text="Orange", icon="COLLECTION_COLOR_ORANGE").color = 'ORANGE'
-            layout.operator("outliner.collection_color_tag_set", text="Yellow", icon="COLLECTION_COLOR_YELLOW").color = 'YELLOW'
-            layout.operator("outliner.collection_color_tag_set", text="Green", icon="COLLECTION_COLOR_GREEN").color = 'GREEN'
-            layout.operator("outliner.collection_color_tag_set", text="Blue", icon="COLLECTION_COLOR_BLUE").color = 'BLUE'
-            layout.operator("outliner.collection_color_tag_set", text="Purple", icon="COLLECTION_COLOR_PURPLE").color = 'PURPLE'
+            layout.operator_enum("outliner.collection_color_tag_set", "color")
 
         layout.separator()
 
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index e5a78407ab8..e514a2013ea 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -980,12 +980,12 @@ DEF_ICON_VECTOR(COLORSET_18_VEC)
 DEF_ICON_VECTOR(COLORSET_19_VEC)
 DEF_ICON_VECTOR(COLORSET_20_VEC)
 
-DEF_ICON_VECTOR(COLLECTION_COLOR_RED)
-DEF_ICON_VECTOR(COLLECTION_COLOR_ORANGE)
-DEF_ICON_VECTOR(COLLECTION_COLOR_YELLOW)
-DEF_ICON_VECTOR(COLLECTION_COLOR_GREEN)
-DEF_ICON_VECTOR(COLLECTION_COLOR_BLUE)
-DEF_ICON_VECTOR(COLLECTION_COLOR_PURPLE)
+DEF_ICON_VECTOR(COLLECTION_COLOR_01)
+DEF_ICON_VECTOR(COLLECTION_COLOR_02)
+DEF_ICON_VECTOR(COLLECTION_COLOR_03)
+DEF_ICON_VECTOR(COLLECTION_COLOR_04)
+DEF_ICON_VECTOR(COLLECTION_COLOR_05)
+DEF_ICON_VECTOR(COLLECTION_COLOR_06)
 
 /* Events  */
 DEF_ICON_COLOR(EVENT_A)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index ea2555ba91c..e9979ffecc9 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -479,18 +479,18 @@ static void vicon_collection_color_draw(
   immUnbindProgram();
 }
 
-#  define DEF_ICON_COLLECTION_COLOR_DRAW(name, color) \
-    static void vicon_collection_color_draw_##name(int x, int y, int w, int h, float alpha) \
+#  define DEF_ICON_COLLECTION_COLOR_DRAW(index, color) \
+    static void vicon_collection_color_draw_##index(int x, int y, int w, int h, float alpha) \
     { \
       vicon_collection_color_draw(color, x, y, w, h, alpha); \
     }
 
-DEF_ICON_COLLECTION_COLOR_DRAW(red, COLLECTION_COLOR_RED);
-DEF_ICON_COLLECTION_COLOR_DRAW(orange, COLLECTION_COLOR_ORANGE);
-DEF_ICON_COLLECTION_COLOR_DRAW(yellow, COLLECTION_COLOR_YELLOW);
-DEF_ICON_COLLECTION_COLOR_DRAW(green, COLLECTION_COLOR_GREEN);
-DEF_ICON_COLLECTION_COLOR_DRAW(blue, COLLECTION_COLOR_BLUE);
-DEF_ICON_COLLECTION_COLOR_DRAW(purple, COLLECTION_COLOR_PURPLE);
+DEF_ICON_COLLECTION_COLOR_DRAW(01, COLLECTION_COLOR_01);
+DEF_ICON_COLLECTION_COLOR_DRAW(02, COLLECTION_COLOR_02);
+DEF_ICON_COLLECTION_COLOR_DRAW(03, COLLECTION_COLOR_03);
+DEF_ICON_COLLECTION_COLOR_DRAW(04, COLLECTION_COLOR_04);
+DEF_ICON_COLLECTION_COLOR_DRAW(05, COLLECTION_COLOR_05);
+DEF_ICON_COLLECTION_COLOR_DRAW(06, COLLECTION_COLOR_06);
 
 #  undef DEF_ICON_COLLECTION_COLOR_DRAW
 
@@ -1046,12 +1046,12 @@ static void init_internal_icons(void)
   def_internal_vicon(ICON_COLORSET_19_VEC, vicon_colorset_draw_19);
   def_internal_vicon(ICON_COLORSET_20_VEC, vicon_colorset_draw_20);
 
-  def_internal_vicon(ICON_COLLECTION_COLOR_RED, vicon_collection_color_draw_red);
-  def_internal_vicon(ICON_COLLECTION_COLOR_ORANGE, vicon_collection_color_draw_orange);
-  def_internal_vicon(ICON_COLLECTION_COLOR_YELLOW, vicon_collection_color_draw_yellow);
-  def_internal_vicon(ICON_COLLECTION_COLOR_GREEN, vicon_collection_color_draw_green);
-  def_internal_vicon(ICON_COLLECTION_COLOR_BLUE, vicon_collection_color_draw_blue);
-  def_internal_vicon(ICON_COLLECTION_COLOR_PURPLE, vicon_collection_color_draw_purple);
+  def_internal_vicon(ICON_COLLECTION_COLOR_01, vicon_collection_color_draw_01);
+  def_internal_vicon(ICON_COLLECTION_COLOR_02, vicon_collection_color_draw_02);
+  def_internal_vicon(ICON_COLLECTION_COLOR_03, vicon_collection_color_draw_03);
+  def_internal_vicon(ICON_COLLECTION_COLOR_04, vicon_collection_color_draw_04);
+  def_internal_vicon(ICON_COLLECTION_COLOR_05, vicon_collection_color_draw_05);
+  def_internal_vicon(ICON_COLLECTION_COLOR_06, vicon_collection_color_draw_06);
 }
 #  endif /* WITH_HEADLESS */
 
diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index 3e583cd0db4..28185fc3d86 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -99,12 +99,12 @@ 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_01 = 1,
+  COLLECTION_COLOR_02 = 2,
+  COLLECTION_COLOR_03 = 3,
+  COLLECTION_COLOR_04 = 4,
+  COLLECTION_COLOR_05 = 5,
+  COLLECTION_COLOR_06 = 6,
 };
 
 #endif /* __DNA_COLLECTION_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 8d2869c5a19..c10a24d95b2 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -31,37 +31,13 @@
 #include "WM_types.h"
 
 const EnumPropertyItem rna_enum_collection_color_items[] = {
-    {COLLECTION_COLOR_NONE, "NONE", ICON_NONE, "None", "Assign no color tag to the collection"},
-    {COLLECTION_COLOR_RED,
-     "RED",
-     ICON_COLLECTION_COLOR_RED,
-     "Red",
-     "Assign a red color tag to the collection"},
-    {COLLECTION_COLOR_ORANGE,
-     "ORANGE",
-     ICON_COLLECTION_COLOR_ORANGE,
-     "Orange",
-     "Assign an orange color tag to the collection"},
-    {COLLECTION_COLOR_YELLOW,
-     "YELLOW",
-     ICON_COLLECTION_COLOR_YELLOW,
-     "Yellow",
-     "Assign a yellow color tag to the collection"},
-    {COLLECTION_COLOR_GREEN,
-     "GREEN",
-     ICON_COLLECTION_COLOR_GREEN,
-     "Green",
-     "Assign a green color tag to the collection"},
-    {COLLECTION_COLOR_BLUE,
-     "BLUE",
-     ICON_COLLECTION_COLOR_GREEN,
-     "Blue",
-     "Assign a blue color tag to the collection"},
-    {COLLECTION_COLOR_PURPLE,
-     "PURPLE",
-     ICON_COLLECTION_COLOR_PURPLE,
-     "Purple",
-     "Assign a purple color tag to the collection"},
+    {COLLECTION_COLOR_NONE, "NONE", ICON_X, "None", "Assign no color tag to the collection"},
+    {COLLECTION_COLOR_01, "COLOR_01", ICON_COLLECTION_COLOR_01, "Color 01", ""},
+    {COLLECTION_COLOR_02, "COLOR_02", ICON_COLLECTION_COLOR_02, "Color 02", ""},
+    {COLLECTION_COLOR_03, "COLOR_03", ICON_COLLECTION_COLOR_03, "Color 03", ""},
+    {COLLECTION_COLOR_04, "COLOR_04", ICON_COLLECTION_COLOR_04, "Color 04", ""},
+    {COLLECTION_COLOR_05, "COLOR_05", ICON_COLLECTION_COLOR_05, "Color 05", ""},
+    {COLLECTION_COLOR_06, "COLOR_06", ICON_COLLECTION_COLOR_06, "Color 06", ""},
     {0, NULL, 0, NULL, NULL},
 };



More information about the Bf-blender-cvs mailing list