Fix T93757: Do not force-instantiate indrectly linked objects in linking case.

This commit is contained in:
Bastien Montagne 2021-12-21 10:05:39 +01:00
parent bb4de77b82
commit 68f1b2c671
Notes: blender-bot 2023-02-13 16:53:39 +01:00
Referenced by issue #93757, When linking a blend file into another one selecting a collection, it also imports objects from other collections
1 changed files with 13 additions and 0 deletions

View File

@ -743,6 +743,8 @@ static void loose_data_instantiate_object_process(LooseDataInstantiateContext *i
* if you want it do it at the editor level. */
const bool object_set_active = false;
const bool is_linking = (lapp_context->params->flag & FILE_LINK) != 0;
/* NOTE: For objects we only view_layer-instantiate duplicated objects that are not yet used
* anywhere. */
LinkNode *itemlink;
@ -753,6 +755,17 @@ static void loose_data_instantiate_object_process(LooseDataInstantiateContext *i
continue;
}
/* In linking case, never instantiate stray objects that are not directly linked.
*
* While this is not ideal (in theory no object should remain un-owned), in case of indirectly
* linked objects, the other solution would be to add them to a local collection, which would
* make them directly linked. Think for now keeping them indirectly linked is more important.
* Ref. T93757.
*/
if (is_linking && (item->tag & LINK_APPEND_TAG_INDIRECT) != 0) {
continue;
}
Object *ob = (Object *)id;
if (object_in_any_collection(bmain, ob)) {