Skip to content

Commit

Permalink
Fix T73972: Collection in outliner grayed out when all collection chi…
Browse files Browse the repository at this point in the history
…ldren 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
  • Loading branch information
Manuel Castilla authored and Dalai Felinto committed May 29, 2020
1 parent 7022c73 commit 582d315
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions source/blender/blenkernel/intern/layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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).*/
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 582d315

Please sign in to comment.