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:
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
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue