From 21d633f83b3ab09342ad32c4c3d896d3a8308404 Mon Sep 17 00:00:00 2001 From: Falk David Date: Mon, 7 Mar 2022 17:47:43 +0100 Subject: GPencil: Temporary fix to avoid crashes on startup This quick fix will populate the runtime orig pointers to avoid crashes when a grease pencil object uses layer transforms, parenting or modifiers. This will have to be revisited and fixed with a better solution. --- .../blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source') 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 6346bab1fe8..b1635ce6e09 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 @@ -41,6 +41,7 @@ #include "DNA_ID.h" #include "DNA_anim_types.h" #include "DNA_armature_types.h" +#include "DNA_gpencil_types.h" #include "DNA_mesh_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" @@ -733,6 +734,16 @@ void update_id_after_copy(const Depsgraph *depsgraph, scene_setup_view_layers_after_remap(depsgraph, id_node, reinterpret_cast(id_cow)); break; } + /* FIXME: This is a temporary fix to update the runtime pointers properly, see T96216. Should + * be removed at some point. */ + case ID_GD: { + bGPdata *gpd_cow = (bGPdata *)id_cow; + bGPDlayer *gpl = (bGPDlayer *)(gpd_cow->layers.first); + if (gpl != NULL && gpl->runtime.gpl_orig == NULL) { + BKE_gpencil_data_update_orig_pointers((bGPdata *)id_orig, gpd_cow); + } + break; + } default: break; } -- cgit v1.2.3