From 3d9d132ccd4511308fbeb2d1ac323ed028a4cd9f Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 20 Mar 2020 20:01:35 +0100 Subject: GPencil: Fix unreported slow transform with proportional edition Now a hash is used to avoid double update of the same stroke. The old method was not correct with proportional edition. --- source/blender/editors/transform/transform_generics.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index cb7071e0f49..7a787b77a62 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -47,6 +47,7 @@ #include "DNA_view3d_types.h" #include "BLI_blenlib.h" +#include "BLI_ghash.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_utildefines.h" @@ -1149,17 +1150,19 @@ static void recalcData_sequencer(TransInfo *t) static void recalcData_gpencil_strokes(TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); - bGPDstroke *gps_prev = NULL; + GHash *strokes = BLI_ghash_ptr_new(__func__); TransData *td = tc->data; for (int i = 0; i < tc->data_len; i++, td++) { bGPDstroke *gps = td->extra; - if ((gps != NULL) && (gps != gps_prev)) { + + if ((gps != NULL) && (!BLI_ghash_haskey(strokes, gps))) { + BLI_ghash_insert(strokes, gps, gps); /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(gps); - gps_prev = gps; } } + BLI_ghash_free(strokes, NULL, NULL); } static void recalcData_sculpt(TransInfo *t) -- cgit v1.2.3