Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-10-01 13:13:29 +0300
committerBastien Montagne <bastien@blender.org>2021-10-01 13:21:08 +0300
commit928d644895887fd8864531e21570546c07d9c53f (patch)
treea3797c95d8c278bc60de226c28133118df822173 /source/blender/blenloader/intern/readfile.c
parentaf0b7925db517ebe4637cca90f9dfa8056656b3e (diff)
Append: Fix appended objects potentially auto-instantiated in more than one collection.
Related to T87189.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index cdae043d01c..c7c5a8b8a0d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4506,7 +4506,10 @@ static void add_loose_objects_to_scene(Main *mainvar,
/* Give all objects which are LIB_TAG_INDIRECT a base,
* or for a collection when *lib has been set. */
LISTBASE_FOREACH (Object *, ob, &mainvar->objects) {
- bool do_it = (ob->id.tag & LIB_TAG_DOIT) != 0;
+ /* NOTE: Even if this is a directly linked object and is tagged for instantiation, it might
+ * have already been instantiated through one of its owner collections, in which case we do not
+ * want to re-instantiate it in the active collection here. */
+ bool do_it = (ob->id.tag & LIB_TAG_DOIT) != 0 && !BKE_scene_object_find(scene, ob);
if (do_it ||
((ob->id.tag & LIB_TAG_INDIRECT) != 0 && (ob->id.tag & LIB_TAG_PRE_EXISTING) == 0)) {
if (do_append) {