Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2019-05-31 19:17:16 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-05-31 20:02:26 +0300
commitd0258abdd7db5aee66da78008df897d8f444b987 (patch)
tree31677457c0365f554fd99211d5d9c145199d4402 /source/blender/makesrna/intern/rna_layer.c
parent3f23299403d4f20fa5c8ef799bde940d0c291228 (diff)
Fix Outliner: New collections are hidden
Users could change the master collection flags, but they should not. That would not effectively affect the master collection objects (depsgraph flag evaluation ignores master collection flags). However we use the layer collection flags of the parent collection when creating a new child collection. We *could* solve this differently by creating a new RNA type for the master collection (and layer collection) and hook this with rna refine. But this patch seems to work well enough and it is simpler. Reviewers: brecht Differential Revision: https://developer.blender.org/D4981
Diffstat (limited to 'source/blender/makesrna/intern/rna_layer.c')
-rw-r--r--source/blender/makesrna/intern/rna_layer.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 55009aa660d..a8682632e0c 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -212,6 +212,43 @@ int rna_LayerCollection_name_length(PointerRNA *ptr)
return strlen(id->name + 2);
}
+static void rna_LayerCollection_flag_set(PointerRNA *ptr, const bool value, const int flag)
+{
+ LayerCollection *layer_collection = (LayerCollection *)ptr->data;
+ Collection *collection = layer_collection->collection;
+
+ if (collection->flag & COLLECTION_IS_MASTER) {
+ return;
+ }
+
+ if (value) {
+ layer_collection->flag |= flag;
+ }
+ else {
+ layer_collection->flag &= ~flag;
+ }
+}
+
+static void rna_LayerCollection_exclude_set(PointerRNA *ptr, bool value)
+{
+ rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_EXCLUDE);
+}
+
+static void rna_LayerCollection_holdout_set(PointerRNA *ptr, bool value)
+{
+ rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_HOLDOUT);
+}
+
+static void rna_LayerCollection_indirect_only_set(PointerRNA *ptr, bool value)
+{
+ rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_INDIRECT_ONLY);
+}
+
+static void rna_LayerCollection_hide_viewport_set(PointerRNA *ptr, bool value)
+{
+ rna_LayerCollection_flag_set(ptr, value, LAYER_COLLECTION_HIDE);
+}
+
static void rna_LayerCollection_exclude_update_recursive(ListBase *lb, const bool exclude)
{
for (LayerCollection *lc = lb->first; lc; lc = lc->next) {
@@ -299,6 +336,7 @@ static void rna_def_layer_collection(BlenderRNA *brna)
/* Restriction flags. */
prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_exclude_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop, "Exclude from View Layer", "Exclude from view layer");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -307,6 +345,7 @@ static void rna_def_layer_collection(BlenderRNA *brna)
prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_holdout_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_HOLDOUT_OFF, 1);
RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
@@ -314,6 +353,7 @@ static void rna_def_layer_collection(BlenderRNA *brna)
prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_indirect_only_set");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_icon(prop, ICON_INDIRECT_ONLY_OFF, 1);
RNA_def_property_ui_text(
@@ -325,6 +365,7 @@ static void rna_def_layer_collection(BlenderRNA *brna)
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HIDE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_LayerCollection_hide_viewport_set");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
RNA_def_property_ui_text(prop, "Hide in Viewport", "Temporarily hide in viewport");