diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-02-06 19:12:25 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-02-06 19:13:40 +0300 |
commit | e3a3782d7faf4ce9ecdf91b3920aa554afaf77c1 (patch) | |
tree | cd68aebbd8720076d6e5414ecbf9a0ad84715676 /source | |
parent | fb15dfbddf0ab65cae01e0620abdd7bb046a7aba (diff) |
Outliner visibility unification: Prevent master collection visibility to change
Also satinizing the checks for master collection. The outliner tree
iterators already take care of not including the master collection
there.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.c | 23 |
2 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 20fc0461ab6..6d4c2072ce2 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1014,16 +1014,17 @@ static bool layer_collection_collection_flag_unset_recursive(LayerCollection *lc bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend) { bool depsgraph_need_update = false; + LayerCollection *lc_master = view_layer->layer_collections.first; + if (!extend) { /* Hide all collections . */ - for (LayerCollection *lc_iter = view_layer->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { layer_collection_flag_set_recursive(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW); } } /* Make all the direct parents visible. */ LayerCollection *lc_parent = lc; - LayerCollection *lc_master = view_layer->layer_collections.first; for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { if (BKE_layer_collection_has_layer_collection(lc_iter, lc)) { lc_parent = lc_iter; diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index 1bfdd809b4b..1a1f40a05e8 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -241,7 +241,7 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c return TRAVERSE_SKIP_CHILDS; } - if (collection == BKE_collection_master(data->scene)) { + if (collection->flag & COLLECTION_IS_MASTER) { /* skip - showing warning/error message might be misleading * when deleting multiple collections, so just do nothing */ } @@ -707,16 +707,14 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op) GSET_ITER(collections_to_edit_iter, data.collections_to_edit) { LayerCollection *lc = BLI_gsetIterator_getKey(&collections_to_edit_iter); - if (!(lc->collection->flag & COLLECTION_IS_MASTER)) { - if (clear) { - lc->flag &= ~flag; - } - else { - lc->flag |= flag; - } - - layer_collection_flag_recursive_set(lc, flag); + if (clear) { + lc->flag &= ~flag; + } + else { + lc->flag |= flag; } + + layer_collection_flag_recursive_set(lc, flag); } BLI_gset_free(data.collections_to_edit, NULL); @@ -831,9 +829,10 @@ static int collection_isolate_exec(bContext *C, wmOperator *op) struct CollectionEditData data = {.scene = scene, .soops = soops,}; data.collections_to_edit = BLI_gset_ptr_new(__func__); - /* Hide all collections before the isolate function - needed in order to support. */ + /* Hide all collections before the isolate function - needed in order to support multiple selected collections. */ if (!extend) { - for (LayerCollection *lc_iter = view_layer->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { + LayerCollection *lc_master = view_layer->layer_collections.first; + for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) { lc_iter->flag |= LAYER_COLLECTION_RESTRICT_VIEW; layer_collection_flag_recursive_set(lc_iter, LAYER_COLLECTION_RESTRICT_VIEW); } |