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.
This commit is contained in:
parent
631067e559
commit
8cff1ecf9f
Notes:
blender-bot
2023-02-14 00:10:08 +01:00
Referenced by issue #94804, Stroke vertices that are selected in Edit Mode become Sample Simplified when their strokes are Automerged in Draw Mode
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue