diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-17 20:07:13 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-17 20:07:13 +0300 |
commit | 887d052e56a515145f4dd7433e49c91c5d149169 (patch) | |
tree | 366bd91d1e7dc8b38d2137b08e403e74ea59c016 /source/blender/blenloader/intern/readfile.c | |
parent | 94507a7fa7ee61fefa2001337062c1aa4fb6379a (diff) |
Fix T62570: Append Particles System not working properly.
T62570 and T61796 show that we need two slightly different behaviors in
post-linking collection process:
* For linking, we never want to instantiate indirectly-linked
collections or objects.
* For appending however, since all collections and objects will become
local and hence need instantiation, we want to 'link to scene' all
collections first, better than instantiating the objects in the master
collection opf current scene.
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index e9bd8821d30..9a886f494cf 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10865,6 +10865,8 @@ static void add_collections_to_scene( Main *mainvar, Main *bmain, Scene *scene, ViewLayer *view_layer, const View3D *v3d, Library *lib, const short flag) { + const bool do_append = (flag & FILE_LINK) == 0; + Collection *active_collection = scene->master_collection; if (flag & FILE_ACTIVE_COLLECTION) { LayerCollection *lc = BKE_layer_collection_get_active(view_layer); @@ -10902,8 +10904,11 @@ static void add_collections_to_scene( ob->transflag |= OB_DUPLICOLLECTION; copy_v3_v3(ob->loc, scene->cursor.location); } - /* We do not want to force instantiation of indirectly linked collections... */ - else if ((collection->id.tag & LIB_TAG_INDIRECT) == 0) { + /* We do not want to force instantiation of indirectly linked collections... + * Except when we are appending (since in that case, we'll end up instantiating all objects, + * it's better to do it via their own collections if possible). + * Reports showing that desired difference in behaviors between link and append: T62570, T61796. */ + else if (do_append || (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. @@ -10915,7 +10920,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 && + (do_append || (ob->id.tag & LIB_TAG_INDIRECT) == 0) && (ob->id.lib == lib) && (object_in_any_scene(bmain, ob) == 0)) { |