[Bf-blender-cvs] [17f122b913c] soc-2020-greasepencil-curve: GPencil: Test write operator only writes to selected strokes

Falk David noreply at git.blender.org
Wed Jun 3 17:22:57 CEST 2020


Commit: 17f122b913cd48cfdda71c4780b5bcba1ba0f201
Author: Falk David
Date:   Wed Jun 3 17:20:36 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB17f122b913cd48cfdda71c4780b5bcba1ba0f201

GPencil: Test write operator only writes to selected strokes

Now the operator will only write to selected strokes and also free previously allocated data.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index 32b8041aa69..11d5ddf9970 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -88,7 +88,12 @@ static int gp_write_stroke_curve_data_exec(bContext *C, wmOperator *op)
   }
 
   LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
-    gps->editcurve = create_example_gp_curve();
+    if (gps->flag & GP_STROKE_SELECT) {
+      if (gps->editcurve != NULL) {
+        BKE_gpencil_free_stroke_editcurve(gps);
+      }
+      gps->editcurve = create_example_gp_curve();
+    }
   }
 
   /* notifiers */
@@ -105,7 +110,8 @@ void GPENCIL_OT_write_sample_stroke_curve_data(wmOperatorType *ot)
   /* identifiers */
   ot->name = "Write sample stroke curve data";
   ot->idname = "GPENCIL_OT_write_stroke_curve_data";
-  ot->description = "Test operator to write to the curve data in a grease pencil stroke.";
+  ot->description =
+      "Test operator to write sample curve data to the selected grease pencil strokes.";
 
   /* api callbacks */
   ot->exec = gp_write_stroke_curve_data_exec;



More information about the Bf-blender-cvs mailing list