[Bf-blender-cvs] [683e64247f0] master: Fix T61796: Linking a collection with instances inside will place the instanced object in the scene.

Bastien Montagne noreply at git.blender.org
Tue Mar 5 14:41:58 CET 2019


Commit: 683e64247f060acbb8b9ba9178e7555dc57aa10b
Author: Bastien Montagne
Date:   Tue Mar 5 14:39:43 2019 +0100
Branches: master
https://developer.blender.org/rB683e64247f060acbb8b9ba9178e7555dc57aa10b

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...

===================================================================

M	source/blender/blenloader/intern/readfile.c

===================================================================

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 572946cac48..82ef725ef37 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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))
 					{



More information about the Bf-blender-cvs mailing list