Commit: 0c44b7e177f394fe93d236aeb4b9ba7b14b2191c
Author: Dalai Felinto
Date:   Tue Mar 19 22:39:42 2019 -0300
Branches: master
https://developer.blender.org/rB0c44b7e177f394fe93d236aeb4b9ba7b14b2191c

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

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

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

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

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;
                        }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to