[Bf-blender-cvs] [47be2d3fd09] soc-2020-greasepencil-curve: GPencil: Fix crash when moving multiple handles

Falk David noreply at git.blender.org
Thu Jul 2 23:02:38 CEST 2020


Commit: 47be2d3fd0989165478ffce2b6a20e53bff723ae
Author: Falk David
Date:   Thu Jul 2 23:02:26 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB47be2d3fd0989165478ffce2b6a20e53bff723ae

GPencil: Fix crash when moving multiple handles

Fix a crash when selecting multiple handles (without the control point)
and then moving them. This was caused by the function
BKE_gpencil_curve_sync_selection which did not sync the
selection correctly. GP_CURVE_SELECT would not be set in gpc->flag if an
individual handle was selected.

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

M	source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 2d76d4b3da3..68b47ec4e9e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -866,13 +866,26 @@ void BKE_gpencil_curve_sync_selection(bGPDcurve *gpc)
   }
 
   gpc->flag &= ~GP_CURVE_SELECT;
+  bool is_selected = false;
   for (int i = 0; i < gpc->tot_curve_points; i++) {
     bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
+    BezTriple *bezt = &gpc_pt->bezt;
+
+    if (BEZT_ISSEL_ANY(bezt)) {
+      gpc_pt->flag |= GP_SPOINT_SELECT;
+    }
+    else {
+      gpc_pt->flag &= ~GP_SPOINT_SELECT;
+    }
+
     if (gpc_pt->flag & GP_SPOINT_SELECT) {
-      gpc->flag |= GP_STROKE_SELECT;
-      break;
+      is_selected = true;
     }
   }
+
+  if (is_selected) {
+    gpc->flag |= GP_CURVE_SELECT;
+  }
 }
 
 /* ************************************************** */



More information about the Bf-blender-cvs mailing list