Fix T61796: Linking a collection with instances inside will place the instanced object in the scene.

Do not force to link indirectly linked collections into current scene,
that is usually not desired. Note that user can always add this link
manually if they want.

All this 'implicit instantiation' post-linking process is rather hairy
to get it correct, hope this time it's not breaking something else...
This commit is contained in:
Bastien Montagne 2019-03-05 14:39:43 +01:00
parent 6d110a03b7
commit 683e64247f
Notes: blender-bot 2023-02-14 03:37:46 +01:00
Referenced by issue #61796, Linking a collection with instances inside will place the instanced object in the scene
1 changed files with 3 additions and 1 deletions

View File

@ -10899,7 +10899,8 @@ static void add_collections_to_scene(
ob->transflag |= OB_DUPLICOLLECTION;
copy_v3_v3(ob->loc, scene->cursor.location);
}
else {
/* We do not want to force instantiation of indirectly linked collections... */
else if ((collection->id.tag & LIB_TAG_INDIRECT) == 0) {
bool do_add_collection = (collection->id.tag & LIB_TAG_DOIT) != 0;
if (!do_add_collection) {
/* We need to check that objects in that collections are already instantiated in a scene.
@ -10911,6 +10912,7 @@ static void add_collections_to_scene(
Object *ob = coll_ob->ob;
if ((ob->id.tag & LIB_TAG_PRE_EXISTING) == 0 &&
(ob->id.tag & LIB_TAG_DOIT) == 0 &&
(ob->id.tag & LIB_TAG_INDIRECT) == 0 &&
(ob->id.lib == lib) &&
(object_in_any_scene(bmain, ob) == 0))
{