diff options
author | Bastien Montagne <bastien@blender.org> | 2021-10-01 13:13:29 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-10-01 13:21:08 +0300 |
commit | 928d644895887fd8864531e21570546c07d9c53f (patch) | |
tree | a3797c95d8c278bc60de226c28133118df822173 /source/blender/blenloader/intern/readfile.c | |
parent | af0b7925db517ebe4637cca90f9dfa8056656b3e (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.c | 5 |
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) { |