From b8e409ba98a996553afcdcb6272f6d68241c47cb Mon Sep 17 00:00:00 2001 From: Antonioya Date: Fri, 1 Feb 2019 17:14:28 +0100 Subject: GP: Cleanup retiming to do in same loop --- source/blender/editors/gpencil/gpencil_edit.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_edit.c') diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e68c636e2ce..81ba907b2f6 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1828,6 +1828,8 @@ static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDst /* copy points (last before) */ int e1 = 0; int e2 = 0; + float delta = 0.0f; + for (int i = 0; i < totpoints; i++) { pt_final = &join_stroke->points[i]; if (i < gps_last->totpoints) { @@ -1843,8 +1845,11 @@ static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDst copy_v3_v3(&pt_final->x, &pt->x); pt_final->pressure = pt->pressure; pt_final->strength = pt->strength; - pt_final->time = pt->time; + pt_final->time = delta; pt_final->flag = pt->flag; + + /* retiming with fixed time interval (we cannot determine real time) */ + delta += 0.01f; } /* Copy over vertex weight data (if available) */ @@ -1878,19 +1883,6 @@ static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDst } } - /* retiming with fixed time interval */ - { - float delta = 0.0f; - int j; - - join_stroke->inittime = (double)delta; - pt = join_stroke->points; - for (j = 0; j < join_stroke->totpoints; j++, pt++) { - pt->time = delta; - delta += 0.01f; - } - } - /* add new stroke at head */ BLI_addhead(&gpf->strokes, join_stroke); -- cgit v1.2.3