Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2022-01-11 21:20:23 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-01-11 21:20:27 +0300
commit8cff1ecf9fd5aad79c695de0532cc399b66874a6 (patch)
tree8b32b87a21a0e9c2160f34530fb9dcdff83e038f /source
parent631067e5597dec9cb5641b69a410d03746b7fa05 (diff)
Fix T94804: GPencil Simplify when strokes are Automerged in Draw Mode
The problem was the points were selected in edit mode and then sampled. Now, in draw mode, the points are always unselected to avoid this effect in the auto merge process.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 73a94f066e3..ffe050bf01c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -54,6 +54,7 @@
#include "BKE_deform.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
+#include "BKE_gpencil_curve.h"
#include "BKE_gpencil_geom.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@ -918,6 +919,19 @@ static short gpencil_stroke_addpoint(tGPsdata *p,
return GP_STROKEADD_INVALID;
}
+static void gpencil_stroke_unselect(bGPdata *gpd, bGPDstroke *gps)
+{
+ gps->flag &= ~GP_STROKE_SELECT;
+ BKE_gpencil_stroke_select_index_reset(gps);
+ for (int i = 0; i < gps->totpoints; i++) {
+ gps->points[i].flag &= ~GP_SPOINT_SELECT;
+ }
+ /* Update the selection from the stroke to the curve. */
+ if (gps->editcurve) {
+ BKE_gpencil_editcurve_stroke_sync_selection(gpd, gps, gps->editcurve);
+ }
+}
+
/* make a new stroke from the buffer data */
static void gpencil_stroke_newfrombuffer(tGPsdata *p)
{
@@ -1300,7 +1314,12 @@ static void gpencil_stroke_newfrombuffer(tGPsdata *p)
ctrl2,
GPENCIL_MINIMUM_JOIN_DIST,
&pt_index);
+
if (gps_target != NULL) {
+ /* Unselect all points of source and destination strokes. This is required to avoid
+ * a change in the resolution of the original strokes during the join. */
+ gpencil_stroke_unselect(gpd, gps);
+ gpencil_stroke_unselect(gpd, gps_target);
gps = ED_gpencil_stroke_join_and_trim(p->gpd, p->gpf, gps, gps_target, pt_index);
}
else {