From 84bd9e284e06d886c24701bcd2b78b3d24617cb3 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Wed, 18 Sep 2019 17:37:38 +0200 Subject: GPencil: Fix unreported error using Grab sculpt in empty frame When the grab brush was used in an empty frame, a new frame was created, but as the depsgraph was no tagged, the evaluated data was wrong and the Grab hash failed. --- source/blender/editors/gpencil/gpencil_brush.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/gpencil') diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 2a2e7c21df4..4a65bbff454 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1463,7 +1463,7 @@ static bool gpsculpt_brush_poll(bContext *C) /* Init Sculpt Stroke ---------------------------------- */ -static void gpsculpt_brush_init_stroke(tGP_BrushEditData *gso) +static void gpsculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso) { bGPdata *gpd = gso->gpd; @@ -1487,9 +1487,11 @@ static void gpsculpt_brush_init_stroke(tGP_BrushEditData *gso) * - This is useful when animating as it saves that "uh-oh" moment when you realize you've * spent too much time editing the wrong frame. */ - // XXX: should this be allowed when framelock is enabled? if (gpf->framenum != cfra) { BKE_gpencil_frame_addcopy(gpl, cfra); + /* Need tag to recalculate evaluated data to avoid crashes. */ + DEG_id_tag_update(&gso->gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); } } } @@ -2079,7 +2081,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve ARegion *ar = CTX_wm_region(C); /* ensure that we'll have a new frame to draw on */ - gpsculpt_brush_init_stroke(gso); + gpsculpt_brush_init_stroke(C, gso); /* apply first dab... */ gso->is_painting = true; @@ -2194,7 +2196,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even gso->is_painting = true; gso->first = true; - gpsculpt_brush_init_stroke(gso); + gpsculpt_brush_init_stroke(C, gso); gpsculpt_brush_apply_event(C, op, event); break; -- cgit v1.2.3