From 11ba9eec70175b39e34943c8ffacb54c35cbb897 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Mon, 8 Jun 2020 09:01:07 +0200 Subject: GPencil: Show only first frame if current frame is equals or greater than current frame Previously, the first frame was displayed from frame 0, but now, the first frame is only displayed when the current frame is equal or greater than the keyframe number. The previous system was logical when the grease pencil was not an object, but now it seems more logical to display the keyframe if the current frame is equal to or greater than the keyframe number. Reviewed By: mendio, pepeland Differential Revision: https://developer.blender.org/D7851 --- source/blender/editors/gpencil/gpencil_paint.c | 5 +++++ source/blender/editors/gpencil/gpencil_primitive.c | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 06079c34d12..a9eb94498ad 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2127,7 +2127,12 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps add_frame_mode = GP_GETFRAME_ADD_NEW; } + bool need_tag = p->gpl->actframe == NULL; p->gpf = BKE_gpencil_layer_frame_get(p->gpl, CFRA, add_frame_mode); + /* Only if there wasn't an active frame, need update. */ + if (need_tag) { + DEG_id_tag_update(&p->gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + } if (p->gpf == NULL) { p->status = GP_STATUS_ERROR; diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 875a6265497..82ae99b30be 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -1308,7 +1308,12 @@ static void gpencil_primitive_interaction_end(bContext *C, add_frame_mode = GP_GETFRAME_ADD_NEW; } + bool need_tag = tgpi->gpl->actframe == NULL; gpf = BKE_gpencil_layer_frame_get(tgpi->gpl, tgpi->cframe, add_frame_mode); + /* Only if there wasn't an active frame, need update. */ + if (need_tag) { + DEG_id_tag_update(&tgpi->gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + } /* prepare stroke to get transferred */ gps = tgpi->gpf->strokes.first; -- cgit v1.2.3