[Bf-blender-cvs] [21d633f83b3] master: GPencil: Temporary fix to avoid crashes on startup

Falk David noreply at git.blender.org
Mon Mar 7 17:48:51 CET 2022


Commit: 21d633f83b3ab09342ad32c4c3d896d3a8308404
Author: Falk David
Date:   Mon Mar 7 17:47:43 2022 +0100
Branches: master
https://developer.blender.org/rB21d633f83b3ab09342ad32c4c3d896d3a8308404

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.

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

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 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<Scene *>(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;
   }



More information about the Bf-blender-cvs mailing list