diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2020-09-15 21:13:03 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2020-09-15 21:47:09 +0300 |
commit | 452a1c7b38383fd3f51532c429912677864e4a33 (patch) | |
tree | 37481ed6eca5cc6840dee0686b24b75ba1842cbc /source/blender/makesrna/intern/rna_collection.c | |
parent | f137022f9919f4dd315ec6b325a08e1bf5aec6fb (diff) |
Collections: Add color tagging
This adds color tagging to collections. There are 8 color
options which are themable in the user preferences, with an additional
option for no color tag by default.
This adds a new filled collection icon and 8 colored variants of the
icon that can be themed in the user preferences.
In this commit the only interface to setting the color tags is through
Python, and there is nowhere in the interface where the collections are
shown colored. Setting and viewing the color tags from the outliner will
follow.
Manifest Task: https://developer.blender.org/T77777
Differential Revision: https://developer.blender.org/D8622
Diffstat (limited to 'source/blender/makesrna/intern/rna_collection.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_collection.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 9c6c95f2819..b0250897d6d 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -30,6 +30,19 @@ #include "WM_types.h" +const EnumPropertyItem rna_enum_collection_color_items[] = { + {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", ""}, + {COLLECTION_COLOR_07, "COLOR_07", ICON_COLLECTION_COLOR_07, "Color 07", ""}, + {COLLECTION_COLOR_08, "COLOR_08", ICON_COLLECTION_COLOR_08, "Color 08", ""}, + {0, NULL, 0, NULL, NULL}, +}; + #ifdef RNA_RUNTIME # include "DNA_object_types.h" @@ -474,6 +487,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_tag", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "color_tag"); + RNA_def_property_enum_items(prop, rna_enum_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); } |