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-02-06 19:52:40 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-02-06 20:06:16 +0300
commit766741b0aa8c7325bddb0e68c5af7b8610720879 (patch)
tree97c333beffa966020dd4d48e1474d8102ce7dfb7 /source/blender/blenkernel
parente3a3782d7faf4ce9ecdf91b3920aa554afaf77c1 (diff)
Outliner visibility: Respect original viewport enable/disable state
Note: We still change it to the collection we are directly isolating/making visible and its parents (in the case of isolating). But no longer its children. Feedback and discussion on D4011. The motivation is that if we don't keep those locked the disable state becomes useless.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/layer.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 6d4c2072ce2..441f74e5d5f 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -1009,6 +1009,9 @@ static bool layer_collection_collection_flag_unset_recursive(LayerCollection *lc
* Make sure to show all the direct parents and all children of the layer collection as well.
* When extending we simply show the collections and its direct family.
*
+ * If the collection or any of its parents is disabled, make it enabled.
+ * Don't change the children disable state though.
+ *
* Return whether depsgraph needs update.
*/
bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend)
@@ -1016,6 +1019,11 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl
bool depsgraph_need_update = false;
LayerCollection *lc_master = view_layer->layer_collections.first;
+ if (lc->collection->flag & COLLECTION_RESTRICT_VIEW) {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_need_update = true;
+ }
+
if (!extend) {
/* Hide all collections . */
for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
@@ -1033,8 +1041,11 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl
}
while (lc_parent != lc) {
- depsgraph_need_update |= (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) != 0;
- lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEW) {
+ lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_need_update = true;
+ }
+
lc_parent->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; lc_iter = lc_iter->next) {
@@ -1045,9 +1056,8 @@ bool BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerColl
}
}
- /* Make all the children visible. */
+ /* Make all the children visible, but respect their disable state. */
layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
- depsgraph_need_update |= layer_collection_collection_flag_unset_recursive(lc, COLLECTION_RESTRICT_VIEW);
BKE_layer_collection_activate(view_layer, lc);
@@ -1081,16 +1091,21 @@ static void layer_collection_bases_hide_recursive(ViewLayer *view_layer, LayerCo
/**
* Hide/show all the elements of a collection.
- * Enable a disable collection if needs be.
+ * Don't change the collection children enable/disable state, but it may change it for the collection itself.
*
* Return true if depsgraph needs update.
*/
bool BKE_layer_collection_set_visible(ViewLayer *view_layer, LayerCollection *lc, const bool visible, const bool hierarchy)
{
bool depsgraph_changed = false;
+
+ if (visible && ((lc->collection->flag & COLLECTION_RESTRICT_VIEW) != 0)) {
+ lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
+ depsgraph_changed = true;
+ }
+
if (hierarchy) {
if (visible) {
- depsgraph_changed |= layer_collection_collection_flag_unset_recursive(lc, COLLECTION_RESTRICT_VIEW);
layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_RESTRICT_VIEW);
layer_collection_bases_show_recursive(view_layer, lc);
}
@@ -1101,9 +1116,7 @@ bool BKE_layer_collection_set_visible(ViewLayer *view_layer, LayerCollection *lc
}
else {
if (visible) {
- depsgraph_changed |= (lc->collection->flag & COLLECTION_RESTRICT_VIEW) != 0;
lc->flag &= ~LAYER_COLLECTION_RESTRICT_VIEW;
- lc->collection->flag &= ~COLLECTION_RESTRICT_VIEW;
}
else {
lc->flag |= LAYER_COLLECTION_RESTRICT_VIEW;