[Bf-blender-cvs] [8cff1ecf9fd] master: Fix T94804: GPencil Simplify when strokes are Automerged in Draw Mode

Antonio Vazquez noreply at git.blender.org
Tue Jan 11 19:20:31 CET 2022


Commit: 8cff1ecf9fd5aad79c695de0532cc399b66874a6
Author: Antonio Vazquez
Date:   Tue Jan 11 19:20:23 2022 +0100
Branches: master
https://developer.blender.org/rB8cff1ecf9fd5aad79c695de0532cc399b66874a6

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.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

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 {



More information about the Bf-blender-cvs mailing list