Fix T57177: redo select random operator selects hidden objects.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 3 Jan 2019 14:17:01 +0000 (15:17 +0100)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Thu, 3 Jan 2019 14:19:32 +0000 (15:19 +0100)
source/blender/blenkernel/intern/collection.c
source/blender/blenkernel/intern/layer.c
source/blender/blenloader/intern/readfile.c

index a3782de..bd7757a 100644 (file)
@@ -776,8 +776,9 @@ bool BKE_collection_is_in_scene(Collection *collection)
 
 void BKE_collections_after_lib_link(Main *bmain)
 {
-       /* Update view layer collections to match any changes in linked
-        * collections after file load. */
+       /* Need to update layer collections because objects might have changed
+        * in linked files, and because undo push does not include updated base
+        * flags since those are refreshed after the operator completes. */
        BKE_main_collection_sync(bmain);
 }
 
index 572dba4..2883338 100644 (file)
@@ -727,6 +727,7 @@ static short layer_collection_sync(
                        }
 
                        if (base->flag & BASE_HIDDEN) {
+                               base->flag &= ~BASE_VISIBLE;
                                view_layer->runtime_flag |= VIEW_LAYER_HAS_HIDE;
                                lc->runtime_flag |= LAYER_COLLECTION_HAS_HIDDEN_OBJECTS;
                        }
index 98d041a..dd3ce16 100644 (file)
@@ -9067,9 +9067,10 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
                /* Do not apply in undo case! */
                lib_verify_nodetree(bfd->main, true);  /* Needed to ensure we have typeinfo in nodes... */
                BKE_main_override_static_update(bfd->main);
-               BKE_collections_after_lib_link(bfd->main);
        }
 
+       BKE_collections_after_lib_link(bfd->main);
+
        lib_verify_nodetree(bfd->main, true);
        fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */