Fix T61287: Object restrict viewport ignored in instanced collection
authorDalai Felinto <dfelinto@gmail.com>
Fri, 8 Feb 2019 15:51:13 +0000 (13:51 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 8 Feb 2019 15:57:12 +0000 (13:57 -0200)
make_duplis_collection() depends on the collection object cache,
which was not freed upon object viewport disable change.

The best way to reproduce the bug was to instance the default
collection, disable the cube, save and re-open the file.
Now even if you set the original cube to be enabled, you wouldn't see
the instanced one until you forced collection cache to be freed (e.g.,
changing a collection disable state.

source/blender/editors/space_outliner/outliner_draw.c
source/blender/makesrna/intern/rna_object.c

index 40722eb7d455b8398886a83210481db9c33063bb..84385afdb9f03fd2591606bb4f6f3d74cb65e5d6 100644 (file)
@@ -288,7 +288,7 @@ static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
        }
 
        if (changed_restrict_view) {
-               BKE_main_collection_sync(bmain);
+               BKE_main_collection_sync_remap(bmain);
                DEG_id_tag_update(&ob->id, LIB_TAG_COPIED_ON_WRITE);
                DEG_relations_tag_update(bmain);
                WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
index 37eb749ca72af278efe4bb21092d5c6ad87cf40a..0526269bdedc94ecfded1a93f7fe73853a2bc9b8 100644 (file)
@@ -266,7 +266,7 @@ static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA
 static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Object *ob = ptr->id.data;
-       BKE_main_collection_sync(bmain);
+       BKE_main_collection_sync_remap(bmain);
        DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
        DEG_relations_tag_update(bmain);
        WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);