From 074c695a0d4de88550be71181690639ab6b16dcf Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 13 May 2022 18:05:44 +0200 Subject: Fix T98072: Regression: When appending a Scene, the Collections that are excluded get instanced into Current Scene. This was due to using `BKE_scene_has_object` function, which uses the cache of bases of the viewlayers, which do not have entries for the content of excluded collections... Now use `BKE_collection_has_object_recursive` instead. --- source/blender/blenkernel/intern/blendfile_link_append.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel/intern/blendfile_link_append.c') diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c b/source/blender/blenkernel/intern/blendfile_link_append.c index 555c4690308..f9eea52360e 100644 --- a/source/blender/blenkernel/intern/blendfile_link_append.c +++ b/source/blender/blenkernel/intern/blendfile_link_append.c @@ -400,7 +400,9 @@ typedef struct LooseDataInstantiateContext { static bool object_in_any_scene(Main *bmain, Object *ob) { LISTBASE_FOREACH (Scene *, sce, &bmain->scenes) { - if (BKE_scene_object_find(sce, ob)) { + /* #BKE_scene_has_object checks bases cache of the scenes' viewlayer, not actual content of + * their collections. */ + if (BKE_collection_has_object_recursive(sce->master_collection, ob)) { return true; } } -- cgit v1.2.3