Fix T73972: Collection in outliner grayed out when all collection children are disabled

There is no reason to have the children enable/disable state to
influence the parent collection. Specially considering that the parent
collection itself can have objects that would be visible.

Reviewed by: dfelinto, brecht

Differential Revision: http://developer.blender.org/D7864
This commit is contained in:
Manuel Castilla 2020-05-29 11:28:20 +02:00 committed by Dalai Felinto
parent 7022c73249
commit 582d3153a1
Notes: blender-bot 2023-02-14 09:34:18 +01:00
Referenced by issue #73972, Collection in outliner grayed out when all child collections are disabled
1 changed files with 17 additions and 25 deletions

View File

@ -694,14 +694,14 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection
* in at least one layer collection. That list is also synchronized here, and
* stores state like selection. */
static short layer_collection_sync(ViewLayer *view_layer,
const ListBase *lb_scene,
ListBase *lb_layer,
ListBase *new_object_bases,
short parent_exclude,
short parent_restrict,
short parent_layer_restrict,
unsigned short parent_local_collections_bits)
static void layer_collection_sync(ViewLayer *view_layer,
const ListBase *lb_scene,
ListBase *lb_layer,
ListBase *new_object_bases,
short parent_exclude,
short parent_restrict,
short parent_layer_restrict,
unsigned short parent_local_collections_bits)
{
/* TODO: support recovery after removal of intermediate collections, reordering, ..
* For local edits we can make editing operating do the appropriate thing, but for
@ -732,7 +732,6 @@ static short layer_collection_sync(ViewLayer *view_layer,
/* Add layer collections for any new scene collections, and ensure order is the same. */
ListBase new_lb_layer = {NULL, NULL};
short runtime_flag = 0;
LISTBASE_FOREACH (const CollectionChild *, child, lb_scene) {
Collection *collection = child->collection;
@ -763,23 +762,20 @@ static short layer_collection_sync(ViewLayer *view_layer,
}
/* Sync child collections. */
short child_runtime_flag = layer_collection_sync(view_layer,
&collection->children,
&lc->layer_collections,
new_object_bases,
lc->flag,
child_restrict,
child_layer_restrict,
local_collections_bits);
layer_collection_sync(view_layer,
&collection->children,
&lc->layer_collections,
new_object_bases,
lc->flag,
child_restrict,
child_layer_restrict,
local_collections_bits);
/* Layer collection exclude is not inherited. */
lc->runtime_flag = 0;
if (lc->flag & LAYER_COLLECTION_EXCLUDE) {
lc->runtime_flag = 0;
continue;
}
else {
lc->runtime_flag = child_runtime_flag;
}
/* We separate restrict viewport and visible view layer because a layer collection can be
* hidden in the view layer yet (locally) visible in a viewport (if it is not restricted).*/
@ -846,15 +842,11 @@ static short layer_collection_sync(ViewLayer *view_layer,
lc->runtime_flag |= LAYER_COLLECTION_HAS_OBJECTS;
}
runtime_flag |= lc->runtime_flag;
}
/* Replace layer collection list with new one. */
*lb_layer = new_lb_layer;
BLI_assert(BLI_listbase_count(lb_scene) == BLI_listbase_count(lb_layer));
return runtime_flag;
}
/**