Fix: IO: Embedded IDs were missing their library after collection import

Embedded IDs were missing their library after collection import which
caused asserts inside `BKE_main_id_indirect_linked_update`.

Pull Request: https://projects.blender.org/blender/blender/pulls/162298
This commit is contained in:
Jesse Yurkovich 2026-08-04 20:02:23 +02:00 • committed by Jesse Yurkovich
parent 44c25a91f5
commit d769b0ee1e
2 changed files with 3 additions and 2 deletions

View file

@ -607,11 +607,13 @@ void BKE_main_merge_as_archive_library(Main &bmain_dst,
/* Need to tag embedded IDs as well. */
bNodeTree *ntree = bke::node_tree_from_id(id);
if (ntree != nullptr) {
ntree->id.lib = &dst_external_library;
ntree->id.flag |= ID_FLAG_LINKED_AND_PACKED;
}
if (GS(id->name) == ID_SCE) {
Collection *master_collection = (id_cast<Scene *>(id))->master_collection;
if (master_collection != nullptr) {
master_collection->id.lib = &dst_external_library;
master_collection->id.flag |= ID_FLAG_LINKED_AND_PACKED;
}
}

View file

@ -193,8 +193,7 @@ class TestCollectionImport(CollectionIOTestBase):
self.assertEqual(len(bpy.data.collections[coll_C].all_objects), 0)
# TODO: Library validation once scenario is supported
# Disabled: Produces asserts during the save_mainfile call
def __disabled_test_link_after_import(self):
def test_link_after_import(self):
# Validate that a remote collection, which has an importer, is able to
# be linked in with all its contents.
self.reset_blender()