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.
This commit is contained in:
Bastien Montagne 2022-05-13 18:05:44 +02:00
parent ca2fb9bae9
commit 074c695a0d
Notes: blender-bot 2023-02-14 08:39:23 +01:00
Referenced by issue #98072, Regression: When appending a Scene, the Collections that are turned off get instanced into Current Scene
1 changed files with 3 additions and 1 deletions

View File

@ -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;
}
}