[Bf-blender-cvs] [6cd634b94fb] soc-2020-greasepencil-curve: GPencil: Use curve fitting write data for operator

Falk David noreply at git.blender.org
Tue Jun 9 14:32:36 CEST 2020


Commit: 6cd634b94fba8296d0708d848e8f29c4b3afd1ab
Author: Falk David
Date:   Tue Jun 9 14:28:18 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB6cd634b94fba8296d0708d848e8f29c4b3afd1ab

GPencil: Use curve fitting write data for operator

Instead of writing test data to editcurve, use the
BKE_gpencil_stroke_curve_create function to write fitted
curve data to editcurve.

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

M	source/blender/blenkernel/intern/gpencil.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 0e8bc72fc55..e11cd74bb01 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -189,6 +189,7 @@ void BKE_gpencil_free_stroke_editcurve(bGPDstroke *gps)
   MEM_freeN(editcurve->curve_points);
   MEM_freeN(editcurve->point_index_array);
   MEM_freeN(editcurve);
+  gps->editcurve = NULL;
 }
 
 /* free stroke, doesn't unlink from any listbase */
@@ -626,7 +627,8 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_new(int tot_curve_points)
 {
   bGPDcurve *new_gp_curve = (bGPDcurve *)MEM_callocN(sizeof(bGPDcurve), __func__);
   new_gp_curve->tot_curve_points = tot_curve_points;
-  new_gp_curve->curve_points = (BezTriple *)MEM_callocN(sizeof(BezTriple) * tot_curve_points, __func__);
+  new_gp_curve->curve_points = (BezTriple *)MEM_callocN(sizeof(BezTriple) * tot_curve_points,
+                                                        __func__);
   new_gp_curve->point_index_array = (int *)MEM_callocN(sizeof(int) * tot_curve_points, __func__);
 
   return new_gp_curve;
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index 43831f2f80a..a8952f526d3 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -35,6 +35,7 @@
 
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
+#include "BKE_gpencil_curve.h"
 
 #include "BLI_listbase.h"
 #include "BLI_math.h"
@@ -109,7 +110,7 @@ static int gp_write_stroke_curve_data_exec(bContext *C, wmOperator *op)
       if (gps->editcurve != NULL) {
         BKE_gpencil_free_stroke_editcurve(gps);
       }
-      gps->editcurve = create_example_gp_curve(gps);
+      BKE_gpencil_stroke_curve_create(gps);
     }
   }



More information about the Bf-blender-cvs mailing list