diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-03-20 04:39:42 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-03-20 13:45:24 +0300 |
commit | 0c44b7e177f394fe93d236aeb4b9ba7b14b2191c (patch) | |
tree | fc9042e596357ae8f65ffc351a8df92f364da217 /source/blender/blenloader | |
parent | 3e790e760763df8a46f3d49b8abc2f013928a893 (diff) |
Fix T61670: Copy -> Paste - Pasted elements are not selected
The first part of this patch is just a way to improve performance a bit
by not calling BKE_scene_object_base_flag_sync_from_base() twice.
The second is the proper fix for the reported issue.
That said, the report can be re-opened since there is still discussion
about whether or not to bring the collections with the objects.
Reviewers: mont29
Subscribers: brecht, campbellbarton
Differential Revision: https://developer.blender.org/D4558
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 221125fefbe..12f8efb172a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -10844,16 +10844,13 @@ static void add_loose_objects_to_scene( base->local_view_bits |= v3d->local_view_uuid; } - BKE_scene_object_base_flag_sync_from_base(base); - if (flag & FILE_AUTOSELECT) { - if (base->flag & BASE_SELECTABLE) { - base->flag |= BASE_SELECTED; - BKE_scene_object_base_flag_sync_from_base(base); - } + base->flag |= BASE_SELECTED; /* Do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level. */ } + BKE_scene_object_base_flag_sync_from_base(base); + ob->id.tag &= ~LIB_TAG_INDIRECT; ob->id.tag |= LIB_TAG_EXTERN; } @@ -10933,6 +10930,17 @@ static void add_collections_to_scene( /* Add collection as child of active collection. */ BKE_collection_child_add(bmain, active_collection, collection); + if (flag & FILE_AUTOSELECT) { + for (CollectionObject *coll_ob = collection->gobject.first; coll_ob != NULL; coll_ob = coll_ob->next) { + Object *ob = coll_ob->ob; + Base *base = BKE_view_layer_base_find(view_layer, ob); + if (base) { + base->flag |= BASE_SELECTED; + BKE_scene_object_base_flag_sync_from_base(base); + } + } + } + collection->id.tag &= ~LIB_TAG_INDIRECT; collection->id.tag |= LIB_TAG_EXTERN; } |