From 928d644895887fd8864531e21570546c07d9c53f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 1 Oct 2021 12:13:29 +0200 Subject: Append: Fix appended objects potentially auto-instantiated in more than one collection. Related to T87189. --- source/blender/blenloader/intern/readfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3