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:
authorSzymon Ulatowski <szulat>2020-04-09 20:33:57 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-04-09 22:46:22 +0300
commitf3433fcd3bf87c9405fb05c96fde036eb658e8aa (patch)
tree48dc84c573a7ca00c1c408312ce5e87b060aacb3 /source/blender/editors/space_outliner
parent07bb7206c202fdea3645b01887e9eeba3d2e6ae3 (diff)
Collections: preserve exclude flag of child collections when unexcluding
Excluding a collection also changes the exclude setting on all child collections so that it is possible to selectively enable some children without the parent being enabled. This change makes it so that if you unexclude the parent, the exclude setting of children are restored again instead of being permanently lost. Original patch by Szymon with modifications by Brecht. Differential Revision: https://developer.blender.org/D7016
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 5a0ed954909..4b6241d45ee 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -845,20 +845,6 @@ static bool collections_indirect_only_clear_poll(bContext *C)
return collections_view_layer_poll(C, true, LAYER_COLLECTION_INDIRECT_ONLY);
}
-static void layer_collection_flag_recursive_set(LayerCollection *lc, int flag)
-{
- LISTBASE_FOREACH (LayerCollection *, nlc, &lc->layer_collections) {
- if (lc->flag & flag) {
- nlc->flag |= flag;
- }
- else {
- nlc->flag &= ~flag;
- }
-
- layer_collection_flag_recursive_set(nlc, flag);
- }
-}
-
static int collection_view_layer_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
@@ -883,15 +869,7 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
LayerCollection *lc = BLI_gsetIterator_getKey(&collections_to_edit_iter);
-
- if (clear) {
- lc->flag &= ~flag;
- }
- else {
- lc->flag |= flag;
- }
-
- layer_collection_flag_recursive_set(lc, flag);
+ BKE_layer_collection_set_flag(lc, flag, !clear);
}
BLI_gset_free(data.collections_to_edit, NULL);
@@ -1468,8 +1446,7 @@ static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op))
/* Unhide all the collections. */
LayerCollection *lc_master = view_layer->layer_collections.first;
LISTBASE_FOREACH (LayerCollection *, lc_iter, &lc_master->layer_collections) {
- lc_iter->flag &= ~LAYER_COLLECTION_HIDE;
- layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_HIDE);
+ BKE_layer_collection_set_flag(lc_iter, LAYER_COLLECTION_HIDE, false);
}
/* Unhide all objects. */