Fix T58325: Local view Bug
authorDalai Felinto <dfelinto@gmail.com>
Fri, 7 Dec 2018 00:04:12 +0000 (22:04 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Fri, 7 Dec 2018 00:06:05 +0000 (22:06 -0200)
Aka all the thousand of reports duplicated here.
I should have seen this coming, since I had to add a hack in the first
place because things were "not working".

I should have figured out earlier that COW handles base in a really
special way, with its own special object_runtime_backup hack.

source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
source/blender/editors/space_view3d/view3d_view.c

index 98e1bf49c5d696b2c2d426bdaa2f7ece7cdb1613..f8754c530a0511f4174b08087f3114e0bda40045 100644 (file)
@@ -812,6 +812,7 @@ static void deg_update_copy_on_write_animation(const Depsgraph *depsgraph,
 typedef struct ObjectRuntimeBackup {
        Object_Runtime runtime;
        short base_flag;
+       unsigned short base_local_view_bits;
 } ObjectRuntimeBackup;
 
 /* Make a backup of object's evaluation runtime data, additionally
@@ -835,6 +836,7 @@ static void deg_backup_object_runtime(
        }
        /* Make a backup of base flags. */
        object_runtime_backup->base_flag = object->base_flag;
+       object_runtime_backup->base_local_view_bits = object->base_local_view_bits;
 }
 
 static void deg_restore_object_runtime(
@@ -872,6 +874,7 @@ static void deg_restore_object_runtime(
                }
        }
        object->base_flag = object_runtime_backup->base_flag;
+       object->base_local_view_bits = object_runtime_backup->base_local_view_bits;
 }
 
 ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
index 98ae57e9c426614aaee5460d8a162840e06b9ebf..1cced23b24da8dab6b55c6af56729a60876e7bee 100644 (file)
@@ -1188,9 +1188,6 @@ static bool view3d_localview_init(
                                if (TESTBASE(v3d, base)) {
                                        BKE_object_minmax(base->object, min, max, false);
                                        base->local_view_bits |= local_view_bit;
-                                       /* Technically we should leave for Depsgraph to handle this.
-                                          But it is harmless to do it here, and it seems to be necessary. */
-                                       base->object->base_local_view_bits = base->local_view_bits;
                                        ok = true;
                                }
                        }