[Bf-blender-cvs] [0fcf476f048] soc-2020-outliner: Collection Colors DNA and RNA

Nathan Craddock noreply at git.blender.org
Fri Jun 26 04:47:18 CEST 2020


Commit: 0fcf476f048802e9bd7eff1db1d686a14aa54c31
Author: Nathan Craddock
Date:   Tue Jun 23 11:31:21 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB0fcf476f048802e9bd7eff1db1d686a14aa54c31

Collection Colors DNA and RNA

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

M	source/blender/makesdna/DNA_collection_types.h
M	source/blender/makesrna/intern/rna_collection.c

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

diff --git a/source/blender/makesdna/DNA_collection_types.h b/source/blender/makesdna/DNA_collection_types.h
index 13eb8a762d9..3e583cd0db4 100644
--- a/source/blender/makesdna/DNA_collection_types.h
+++ b/source/blender/makesdna/DNA_collection_types.h
@@ -59,7 +59,9 @@ typedef struct Collection {
   short flag;
   /* Runtime-only, always cleared on file load. */
   short tag;
-  char _pad[4];
+
+  short color;
+  char _pad[2];
 
   /* Runtime. Cache of objects in this collection and all its
    * children. This is created on demand when e.g. some physics
@@ -94,4 +96,15 @@ enum {
   COLLECTION_TAG_RELATION_REBUILD = (1 << 0),
 };
 
+/* 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,
+};
+
 #endif /* __DNA_COLLECTION_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index 9c6c95f2819..49a8cfe1058 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -387,6 +387,29 @@ void RNA_def_collections(BlenderRNA *brna)
   StructRNA *srna;
   PropertyRNA *prop;
 
+  static const EnumPropertyItem collection_color_items[] = {
+      {COLLECTION_COLOR_NONE, "NONE", 0, "None", "Assign no color tag to the collection"},
+      {COLLECTION_COLOR_RED, "RED", 0, "Red", "Assign a red color tag to the collection"},
+      {COLLECTION_COLOR_ORANGE,
+       "ORANGE",
+       0,
+       "Orange",
+       "Assign an orange color tag to the collection"},
+      {COLLECTION_COLOR_YELLOW,
+       "YELLOW",
+       0,
+       "Yellow",
+       "Assign a yellow color tag to the collection"},
+      {COLLECTION_COLOR_GREEN, "GREEN", 0, "Green", "Assign a green color tag to the collection"},
+      {COLLECTION_COLOR_BLUE, "BLUE", 0, "Blue", "Assign a blue color tag to the collection"},
+      {COLLECTION_COLOR_PURPLE,
+       "PURPLE",
+       0,
+       "Purple",
+       "Assign a purple color tag to the collection"},
+      {0, NULL, 0, NULL, NULL},
+  };
+
   srna = RNA_def_struct(brna, "Collection", "ID");
   RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
   RNA_def_struct_ui_icon(srna, ICON_GROUP);
@@ -474,6 +497,12 @@ void RNA_def_collections(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Disable in Renders", "Globally disable in renders");
   RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
 
+  prop = RNA_def_property(srna, "color", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_sdna(prop, NULL, "color");
+  RNA_def_property_enum_items(prop, collection_color_items);
+  RNA_def_property_ui_text(prop, "Collection Color", "Color tag for a collection");
+  RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
+
   RNA_define_lib_overridable(false);
 }



More information about the Bf-blender-cvs mailing list