[Bf-blender-cvs] [44d85895256] temp-gpencil-bezier-v2: GPencil: Fix stroke selection

Falk David noreply at git.blender.org
Fri Feb 19 18:16:41 CET 2021


Commit: 44d85895256f926252002091fd03d6985b193c49
Author: Falk David
Date:   Fri Feb 19 17:50:13 2021 +0100
Branches: temp-gpencil-bezier-v2
https://developer.blender.org/rB44d85895256f926252002091fd03d6985b193c49

GPencil: Fix stroke selection

We want to keep the stroke and curve selection seperate. Only when a
conversion happens do we want to sync the selection.

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/editors/gpencil/gpencil_edit_curve.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 1aec1ad296d..6dffa84f12c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1164,7 +1164,6 @@ void BKE_gpencil_curve_sync_selection(bGPDstroke *gps)
     return;
   }
 
-  gps->flag &= ~GP_STROKE_SELECT;
   gpc->flag &= ~GP_CURVE_SELECT;
 
   bool is_selected = false;
@@ -1186,7 +1185,6 @@ void BKE_gpencil_curve_sync_selection(bGPDstroke *gps)
 
   if (is_selected) {
     gpc->flag |= GP_CURVE_SELECT;
-    gps->flag |= GP_STROKE_SELECT;
   }
 }
 
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 8b12e1b5fca..f9b02d4990d 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -716,9 +716,7 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
   }
 
   const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_eval);
-  const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd_eval);
-  const bool do_modifiers = (bool)((!is_multiedit) && (!is_curve_edit) &&
-                                   (ob->greasepencil_modifiers.first != NULL) &&
+  const bool do_modifiers = (bool)((!is_multiedit) && (ob->greasepencil_modifiers.first != NULL) &&
                                    (!GPENCIL_SIMPLIFY_MODIF(scene)));
   if ((!do_modifiers) && (!do_parent) && (!do_transform)) {
     return;
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index ec666d8f70f..6c72937f40e 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -146,31 +146,29 @@ static int gpencil_stroke_make_curve_exec(bContext *C, wmOperator *op)
 
   bool changed = false;
   GP_EDITABLE_STROKES_BEGIN (gps_iter, C, gpl, gps) {
-    if (!GPENCIL_STROKE_IS_CURVE(gps)) {
-      if (gps->flag & GP_STROKE_SELECT) {
-        BKE_gpencil_stroke_editcurve_update(gps, threshold, corner_angle, false);
-        if (gps->editcurve != NULL) {
-          bGPDcurve *gpc = gps->editcurve;
-          gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
-          BKE_gpencil_stroke_geometry_update(gpd, gps);
-
-          /* Select all curve points. */
-          for (uint32_t i = 0; i < gpc->tot_curve_points; i++) {
-            bGPDcurve_point *pt = &gpc->curve_points[i];
-            pt->flag &= ~GP_CURVE_POINT_SELECT;
-            BEZT_SEL_ALL(&pt->bezt);
-          }
-          gpc->flag &= ~GP_CURVE_SELECT;
-
-          /* Deselect stroke points. */
-          for (uint32_t i = 0; i < gps->totpoints; i++) {
-            bGPDspoint *pt = &gps->points[i];
-            pt->flag &= ~GP_SPOINT_SELECT;
-          }
-          gps->flag &= ~GP_STROKE_SELECT;
+    if (!GPENCIL_STROKE_IS_CURVE(gps) && (gps->flag & GP_STROKE_SELECT)) {
+      BKE_gpencil_stroke_editcurve_update(gps, threshold, corner_angle, false);
+      if (gps->editcurve != NULL) {
+        bGPDcurve *gpc = gps->editcurve;
+        gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
+        BKE_gpencil_stroke_geometry_update(gpd, gps);
+
+        /* Select all curve points. */
+        for (uint32_t i = 0; i < gpc->tot_curve_points; i++) {
+          bGPDcurve_point *pt = &gpc->curve_points[i];
+          pt->flag &= ~GP_CURVE_POINT_SELECT;
+          BEZT_SEL_ALL(&pt->bezt);
+        }
+        gpc->flag &= ~GP_CURVE_SELECT;
 
-          changed = true;
+        /* Deselect stroke points. */
+        for (uint32_t i = 0; i < gps->totpoints; i++) {
+          bGPDspoint *pt = &gps->points[i];
+          pt->flag &= ~GP_SPOINT_SELECT;
         }
+        gps->flag &= ~GP_STROKE_SELECT;
+
+        changed = true;
       }
     }
   }



More information about the Bf-blender-cvs mailing list