[Bf-blender-cvs] [cc31b034175] soc-2020-greasepencil-curve: GPencil: deselect all on curve edit mode exit

Falk David noreply at git.blender.org
Wed Jun 17 23:02:18 CEST 2020


Commit: cc31b03417548e12f07641dd49a08d8ec778dc50
Author: Falk David
Date:   Wed Jun 17 23:01:14 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBcc31b03417548e12f07641dd49a08d8ec778dc50

GPencil: deselect all on curve edit mode exit

This is a temporary change. Selection syncing is planned for later

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

M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index d476612bf31..8515ab8cf2e 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -186,6 +186,7 @@ static void rna_GPencil_curve_edit_update(Main *bmain, Scene *scene, PointerRNA
   ToolSettings *ts = scene->toolsettings;
   bGPdata *gpd = (bGPdata *)ptr->owner_id;
 
+  /* curve edit mode is turned on */
   if (GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd)) {
     /* If the current select mode is segment and the Bezier mode is on, change
      * to Point because segment is not supported. */
@@ -195,6 +196,23 @@ static void rna_GPencil_curve_edit_update(Main *bmain, Scene *scene, PointerRNA
     /* For all selected strokes, update edit curve */
     BKE_gpencil_selected_strokes_editcurve_update(gpd);
   }
+  /* curve edit mode is turned off */
+  else {
+    /* deselect all strokes for now */
+    LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+      if (gpl->actframe != NULL) {
+        bGPDframe *gpf = gpl->actframe;
+        LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+          bGPDspoint *pt;
+          int i;
+          for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+            pt->flag &= ~GP_SPOINT_SELECT;
+          }
+          gps->flag &= ~GP_STROKE_SELECT;
+        }
+      }
+    }
+  }
 
   /* Standard update. */
   rna_GPencil_update(bmain, scene, ptr);



More information about the Bf-blender-cvs mailing list