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