diff options
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_utils.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 226a2bc7a98..776576807b4 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2057,6 +2057,11 @@ static bool gpencil_check_collision( static void gp_copy_points( bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final, int i, int i2) { + /* don't copy same point */ + if (i == i2) { + return; + } + copy_v3_v3(&pt_final->x, &pt->x); pt_final->pressure = pt->pressure; pt_final->strength = pt->strength; @@ -2068,9 +2073,16 @@ static void gp_copy_points( if (gps->dvert != NULL) { MDeformVert *dvert = &gps->dvert[i]; MDeformVert *dvert_final = &gps->dvert[i2]; + MEM_SAFE_FREE(dvert_final->dw); dvert_final->totweight = dvert->totweight; - dvert_final->dw = dvert->dw; + if (dvert->dw == NULL) { + dvert_final->dw = NULL; + dvert_final->totweight = 0; + } + else { + dvert_final->dw = MEM_dupallocN(dvert->dw); + } } } |