From c43018cdc01ea481ad05059fc259cc0c7c4a92ea Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Thu, 26 Sep 2019 18:04:21 +0200 Subject: Fix T69814: Grease Pencil Onion Skin Loop doesn't work as expected The first element of the loop was not calculated for all onion modes. For select mode the first selected is used, for other modes the first frame in the layer is used. --- source/blender/draw/engines/gpencil/gpencil_draw_utils.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source/blender') diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 743a2fb546c..ce5d8cbf732 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -1355,19 +1355,19 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache, int idx; float fac = 1.0f; int step = 0; - int mode = 0; bool colflag = false; - bGPDframe *gpf_loop = NULL; + const int mode = gpd->onion_mode; + bGPDframe *gpf_loop = ((gpd->onion_flag & GP_ONION_LOOP) && (mode != GP_ONION_MODE_SELECTED)) ? + gpl->frames.first : + NULL; int last = gpf->framenum; colflag = (bool)gpd->onion_flag & GP_ONION_GHOST_PREVCOL; const short onion_keytype = gpd->onion_keytype; - /* ------------------------------- * 1) Draw Previous Frames First * ------------------------------- */ step = gpd->gstep; - mode = gpd->onion_mode; if (gpd->onion_flag & GP_ONION_GHOST_PREVCOL) { copy_v3_v3(color, gpd->gcolor_prev); @@ -1416,7 +1416,7 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache, } /* if loop option, save the frame to use later */ - if ((mode != GP_ONION_MODE_ABSOLUTE) && (gpd->onion_flag & GP_ONION_LOOP)) { + if ((mode == GP_ONION_MODE_SELECTED) && (gpd->onion_flag & GP_ONION_LOOP)) { gpf_loop = gf; } @@ -1427,7 +1427,6 @@ static void gpencil_draw_onionskins(GpencilBatchCache *cache, * 2) Now draw next frames * ------------------------------- */ step = gpd->gstep_next; - mode = gpd->onion_mode; if (gpd->onion_flag & GP_ONION_GHOST_NEXTCOL) { copy_v3_v3(color, gpd->gcolor_next); -- cgit v1.2.3