diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_layer.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_layer.c | 41 |
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"); |