[Bf-blender-cvs] [88f80c3b73e] greasepencil-object: GPencil: ensure update cache is not copied to eval data

Yann Lanthony noreply at git.blender.org
Mon Feb 7 18:35:09 CET 2022


Commit: 88f80c3b73ee38c7f5b8944741e0f5d7300f22c1
Author: Yann Lanthony
Date:   Tue Feb 1 15:26:50 2022 +0100
Branches: greasepencil-object
https://developer.blender.org/rB88f80c3b73ee38c7f5b8944741e0f5d7300f22c1

GPencil: ensure update cache is not copied to eval data

When falling back to a copy-on-write, clear the runtime
update cache before copying the id to eval.

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

M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

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

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 4a648242138..ba4855fa713 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -60,7 +60,6 @@
 #include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
-#include "DNA_gpencil_types.h"
 #include "DNA_particle_types.h"
 #include "DNA_rigidbody_types.h"
 #include "DNA_scene_types.h"
@@ -764,12 +763,6 @@ void update_id_after_copy(const Depsgraph *depsgraph,
         }
         BKE_pose_pchan_index_rebuild(object_cow->pose);
       }
-      /* TODO: Make sure this is needed and understand why sometimes there is a populated
-       * update_cache pointer on the eval object */
-      if (object_cow->type == OB_GPENCIL) {
-        bGPdata *gpd_eval = (bGPdata *)object_cow->data;
-        gpd_eval->runtime.update_cache = NULL;
-      }
       update_particles_after_copy(depsgraph, object_orig, object_cow);
       update_modifiers_orig_pointers(object_orig, object_cow);
       update_proxy_pointers_after_copy(depsgraph, object_orig, object_cow);
@@ -938,10 +931,11 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph, const IDNode
         BKE_gpencil_update_on_write((bGPdata *)id_orig, (bGPdata *)id_cow);
       }
       else {
+        /* Free gpd update cache and set it to null so that it's not copied to the eval data. */
+        BKE_gpencil_free_update_cache((bGPdata *)id_orig);
         deg_free_copy_on_write_datablock(id_cow);
         deg_expand_copy_on_write_datablock(depsgraph, id_node);
         BKE_gpencil_data_update_orig_pointers((bGPdata *)id_orig, (bGPdata *)id_cow);
-        BKE_gpencil_free_update_cache((bGPdata *)id_orig);
       }
       break;
     }



More information about the Bf-blender-cvs mailing list