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
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2022-06-29 17:03:55 +0300
committerThomas Dinges <blender@dingto.org>2022-06-29 17:18:52 +0300
commit92d1fab5cf3e63b0522a43e5b605ca9927e58856 (patch)
treef0232f81b668924f3dd01d9fbd343cadd1db092d
parent3db00bdcbc568afea541aa9bc46a791f532ea50d (diff)
Fix T99248: GPencil Sculpt Grab/Push don't work with one point
There were two problems: 1) The checking of the collision was not working with one point only. 2) For one point, the masking was checked always and if the masking was not activated, the stroke was skipped.
-rw-r--r--source/blender/editors/gpencil/gpencil_sculpt_paint.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 3cdf364e4b2..62ea65b0782 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -1157,6 +1157,7 @@ static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op)
gso->is_painting = false;
gso->first = true;
+ gso->mval_prev[0] = -1.0f;
gso->gpd = ED_gpencil_data_get_active(C);
gso->cfra = INT_MAX; /* NOTE: So that first stroke will get handled in init_stroke() */
@@ -1425,6 +1426,7 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
char tool = gso->brush->gpencil_sculpt_tool;
const int radius = (brush->flag & GP_BRUSH_USE_PRESSURE) ? gso->brush->size * gso->pressure :
gso->brush->size;
+ const bool is_masking = GPENCIL_ANY_SCULPT_MASK(gso->mask);
bGPDstroke *gps_active = (gps->runtime.gps_orig) ? gps->runtime.gps_orig : gps;
bGPDspoint *pt_active = NULL;
@@ -1442,7 +1444,7 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
if (gps->totpoints == 1) {
bGPDspoint pt_temp;
pt = &gps->points[0];
- if (GPENCIL_ANY_SCULPT_MASK(gso->mask) && (pt->flag & GP_SPOINT_SELECT) != 0) {
+ if ((is_masking && (pt->flag & GP_SPOINT_SELECT) != 0) || (!is_masking)) {
gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp);
gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
@@ -1590,7 +1592,8 @@ static bool gpencil_sculpt_brush_do_frame(bContext *C,
}
/* Check if the stroke collide with brush. */
- if (!ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat)) {
+ if ((gps->totpoints > 1) &&
+ (!ED_gpencil_stroke_check_collision(gsc, gps, gso->mval, radius, bound_mat))) {
continue;
}
@@ -1828,7 +1831,7 @@ static void gpencil_sculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *
}
/* Store coordinates as reference, if operator just started running */
- if (gso->first) {
+ if (gso->mval_prev[0] == -1.0f) {
gso->mval_prev[0] = gso->mval[0];
gso->mval_prev[1] = gso->mval[1];
gso->pressure_prev = gso->pressure;