[Bf-blender-cvs] [68a3c874ce6] soc-2020-greasepencil-curve: GPencil: Set flag to fit curve to cyclic stroke

Falk David noreply at git.blender.org
Mon Jul 6 17:23:11 CEST 2020


Commit: 68a3c874ce61cb33d302c3861608cb6090b73ff1
Author: Falk David
Date:   Mon Jul 6 17:19:59 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB68a3c874ce61cb33d302c3861608cb6090b73ff1

GPencil: Set flag to fit curve to cyclic stroke

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 949b741d67c..4bd3c326a09 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -481,6 +481,11 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, float error_th
     copy_v3_v3(to, &pt->x);
   }
 
+  uint calc_flag = CURVE_FIT_CALC_HIGH_QUALIY;
+  if (gps->totpoints > 2 && gps->flag & GP_STROKE_CYCLIC) {
+    calc_flag |= CURVE_FIT_CALC_CYCLIC;
+  }
+
   float *r_cubic_array = NULL;
   unsigned int r_cubic_array_len = 0;
   unsigned int *r_cubic_orig_index = NULL;
@@ -490,7 +495,7 @@ bGPDcurve *BKE_gpencil_stroke_editcurve_generate(bGPDstroke *gps, float error_th
                                        gps->totpoints,
                                        POINT_DIM,
                                        error_threshold,
-                                       CURVE_FIT_CALC_HIGH_QUALIY,
+                                       calc_flag,
                                        NULL,
                                        0,
                                        &r_cubic_array,



More information about the Bf-blender-cvs mailing list