Fix (unreported) liboverride of an object hiding its dependencies.
When we override a whole collection, we want to add non-instantiated objects to a hidden sub-collection at the end of the process. However, this makes no sense when instantiating an object, if other dependencies objects get also overridden on the process, we should just add them to the same collection owning the root object.
This commit is contained in:
parent
666485f38c
commit
3f78569c3e
|
@ -597,32 +597,30 @@ static void lib_override_library_create_post_process(
|
|||
case ID_GR: {
|
||||
default_instantiating_collection = BKE_collection_add(
|
||||
bmain, (Collection *)id_root, "OVERRIDE_HIDDEN");
|
||||
/* Hide the collection from viewport and render. */
|
||||
default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
|
||||
COLLECTION_RESTRICT_RENDER;
|
||||
break;
|
||||
}
|
||||
case ID_OB: {
|
||||
/* Add the new container collection to one of the collections instantiating the
|
||||
/* Add the other objects to one of the collections instantiating the
|
||||
* root object, or scene's master collection if none found. */
|
||||
Object *ob_root = (Object *)id_root;
|
||||
LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
|
||||
if (BKE_collection_has_object(collection, ob_root) &&
|
||||
BKE_view_layer_has_collection(view_layer, collection) &&
|
||||
!ID_IS_LINKED(collection) && !ID_IS_OVERRIDE_LIBRARY(collection)) {
|
||||
default_instantiating_collection = BKE_collection_add(
|
||||
bmain, collection, "OVERRIDE_HIDDEN");
|
||||
default_instantiating_collection = collection;
|
||||
}
|
||||
}
|
||||
if (default_instantiating_collection == NULL) {
|
||||
default_instantiating_collection = BKE_collection_add(
|
||||
bmain, scene->master_collection, "OVERRIDE_HIDDEN");
|
||||
default_instantiating_collection = scene->master_collection;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert(0);
|
||||
}
|
||||
/* Hide the collection from viewport and render. */
|
||||
default_instantiating_collection->flag |= COLLECTION_RESTRICT_VIEWPORT |
|
||||
COLLECTION_RESTRICT_RENDER;
|
||||
}
|
||||
|
||||
BKE_collection_object_add(bmain, default_instantiating_collection, ob_new);
|
||||
|
|
Loading…
Reference in New Issue