Fix T85947: Missing check of master collection for objects being instanced.

`object_in_any_collection` used during linking/appending to check
whether an object is already instanced by at least one collection, was
not taking into account embedded master collections from scenes.
This commit is contained in:
Bastien Montagne 2021-02-24 14:14:46 +01:00
parent 0c0553ace7
commit 8f6fd07b54
Notes: blender-bot 2023-02-14 01:11:05 +01:00
Referenced by issue #85958, Potential candidates for corrective releases
Referenced by issue #85947, objects from appended scenes are added to current scene as well (if they are directly under the Scene Collection in the source file)
1 changed files with 7 additions and 0 deletions

View File

@ -4600,6 +4600,13 @@ static bool object_in_any_collection(Main *bmain, Object *ob)
}
}
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (scene->master_collection != NULL &&
BKE_collection_has_object(scene->master_collection, ob)) {
return true;
}
}
return false;
}