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.
This commit is contained in:
Falk David 2022-03-07 17:47:43 +01:00
parent 15186f4259
commit 21d633f83b
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #98853, Regression: Blender crashes when moving grease pencil object has any invisible layers
Referenced by issue #96216, GPencil: Crash when opening a file that has a gpencil data block with layer transforms
1 changed files with 11 additions and 0 deletions

View File

@ -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;
}