[Bf-blender-cvs] [e3a3782d7fa] master: Outliner visibility unification: Prevent master collection visibility to change

Dalai Felinto noreply at git.blender.org
Wed Feb 6 17:16:54 CET 2019


Commit: e3a3782d7faf4ce9ecdf91b3920aa554afaf77c1
Author: Dalai Felinto
Date:   Wed Feb 6 16:12:25 2019 +0000
Branches: master
https://developer.blender.org/rBe3a3782d7faf4ce9ecdf91b3920aa554afaf77c1

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.

===================================================================

M	source/blender/blenkernel/intern/layer.c
M	source/blender/editors/space_outliner/outliner_collections.c

===================================================================

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);
 		}



More information about the Bf-blender-cvs mailing list