[Bf-blender-cvs] [0e0977f3e68] master: GPencil: Fix sculpt mask ignoring one point strokes

Henrik Dick noreply at git.blender.org
Tue Mar 29 16:24:17 CEST 2022


Commit: 0e0977f3e68b2ac1fd021b5dc6ca10e5b9a25da1
Author: Henrik Dick
Date:   Tue Mar 29 16:22:52 2022 +0200
Branches: master
https://developer.blender.org/rB0e0977f3e68b2ac1fd021b5dc6ca10e5b9a25da1

GPencil: Fix sculpt mask ignoring one point strokes

The check for the selected status was missing in the case
where the stroke one has one point.

Differential Revision: http://developer.blender.org/D14490

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
index 1e7159392e2..7de579993c1 100644
--- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c
+++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c
@@ -1442,20 +1442,22 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
   if (gps->totpoints == 1) {
     bGPDspoint pt_temp;
     pt = &gps->points[0];
-    gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp);
-    gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
-
-    pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
-    /* Do bound-box check first. */
-    if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) {
-      /* only check if point is inside */
-      int mval_i[2];
-      round_v2i_v2fl(mval_i, gso->mval);
-      if (len_v2v2_int(mval_i, pc1) <= radius) {
-        /* apply operation to this point */
-        if (pt_active != NULL) {
-          rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, 0);
-          changed = apply(gso, gps_active, rot_eval, 0, radius, pc1);
+    if (GPENCIL_ANY_SCULPT_MASK(gso->mask) && (pt->flag & GP_SPOINT_SELECT) != 0) {
+      gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp);
+      gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]);
+
+      pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
+      /* Do bound-box check first. */
+      if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) {
+        /* only check if point is inside */
+        int mval_i[2];
+        round_v2i_v2fl(mval_i, gso->mval);
+        if (len_v2v2_int(mval_i, pc1) <= radius) {
+          /* apply operation to this point */
+          if (pt_active != NULL) {
+            rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, 0);
+            changed = apply(gso, gps_active, rot_eval, 0, radius, pc1);
+          }
         }
       }
     }



More information about the Bf-blender-cvs mailing list