Fix T101370: GPencil Grab Sculpt crash after bake transform animation

The problem was the duplicated strokes had wrong pointers 
to the original stroke.
This commit is contained in:
Antonio Vazquez 2022-09-26 11:09:49 +02:00 committed by Philipp Oeser
parent 803d9f9748
commit b266eedb24
Notes: blender-bot 2023-02-13 14:24:30 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #101370, GPencil: Crash when sculpting after "bake object transform to grease pencil"
1 changed files with 3 additions and 0 deletions

View File

@ -298,6 +298,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op
BLI_addtail(&gpl_dst->frames, gpf_dst);
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_dst->strokes) {
gps->runtime.gps_orig = NULL;
/* Create material of the stroke. */
Material *ma_src = BKE_object_material_get(elem->ob, gps->mat_nr + 1);
bool found = false;
@ -320,6 +321,8 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op
/* Update point location to new object space. */
for (int j = 0; j < gps->totpoints; j++) {
bGPDspoint *pt = &gps->points[j];
pt->runtime.idx_orig = 0;
pt->runtime.pt_orig = NULL;
mul_m4_v3(ob_eval->obmat, &pt->x);
mul_m4_v3(invmat, &pt->x);
}