diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2020-11-14 06:52:06 +0300 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2020-11-14 06:52:06 +0300 |
commit | 83d0810a9ff00c22208a4d94bfb9ba5c448c8861 (patch) | |
tree | fce2d9e669f22039b5655660892f55cad7e917ee /source/blender/makesrna/intern/rna_collection.c | |
parent | 2abbcaa02170b791364ccb4b1fc355a4932af8c8 (diff) | |
parent | 9b54c81414801446940fdc32d8fa1ab267d55c90 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/makesrna/intern/rna_collection.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_collection.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c index 90414613fdd..20a455f5312 100644 --- a/source/blender/makesrna/intern/rna_collection.c +++ b/source/blender/makesrna/intern/rna_collection.c @@ -344,6 +344,31 @@ static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *pt WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene); } +static int rna_Collection_color_tag_get(struct PointerRNA *ptr) +{ + Collection *collection = (Collection *)ptr->data; + + return collection->color_tag; +} + +static void rna_Collection_color_tag_set(struct PointerRNA *ptr, int value) +{ + Collection *collection = (Collection *)ptr->data; + + if (collection->flag & COLLECTION_IS_MASTER) { + return; + } + + collection->color_tag = value; +} + +static void rna_Collection_color_tag_update(Main *UNUSED(bmain), + Scene *scene, + PointerRNA *UNUSED(ptr)) +{ + WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, scene); +} + #else /* collection.objects */ @@ -407,7 +432,7 @@ void RNA_def_collections(BlenderRNA *brna) 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); + RNA_def_struct_ui_icon(srna, ICON_OUTLINER_COLLECTION); /* This is done on save/load in readfile.c, * removed if no objects are in the collection and not in a scene. */ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); @@ -494,9 +519,11 @@ void RNA_def_collections(BlenderRNA *brna) prop = RNA_def_property(srna, "color_tag", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "color_tag"); + RNA_def_property_enum_funcs( + prop, "rna_Collection_color_tag_get", "rna_Collection_color_tag_set", NULL); 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_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_color_tag_update"); RNA_define_lib_overridable(false); } |