[Bf-blender-cvs] [c01215f2dcc] temp-gpencil-bezier-stroke-type: GPencil: Add flag to refit function

Falk David noreply at git.blender.org
Tue Apr 13 16:30:10 CEST 2021


Commit: c01215f2dcc20a66b85875eb92c9033cf8d54fc3
Author: Falk David
Date:   Tue Apr 13 16:14:56 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rBc01215f2dcc20a66b85875eb92c9033cf8d54fc3

GPencil: Add flag to refit function

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

M	source/blender/blenkernel/BKE_gpencil_curve.h
M	source/blender/blenkernel/intern/gpencil_curve.c
M	source/blender/blenkernel/intern/gpencil_geom.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil_curve.h b/source/blender/blenkernel/BKE_gpencil_curve.h
index 1b43fdfdb3c..373c0590736 100644
--- a/source/blender/blenkernel/BKE_gpencil_curve.h
+++ b/source/blender/blenkernel/BKE_gpencil_curve.h
@@ -59,7 +59,7 @@ void BKE_gpencil_stroke_editcurve_regenerate_single(struct bGPDstroke *gps,
 void BKE_gpencil_stroke_editcurve_update(struct bGPDstroke *gps,
                                          const float threshold,
                                          const float corner_angle,
-                                         const bool do_partial_update);
+                                         const enum eGPStrokeGeoUpdateFlag flag);
 void BKE_gpencil_editcurve_stroke_sync_selection(struct bGPdata *gpd,
                                                  struct bGPDstroke *gps,
                                                  struct bGPDcurve *gpc);
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 11502a21449..8d4db4e596e 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -1117,7 +1117,7 @@ void BKE_gpencil_stroke_editcurve_regenerate_single(bGPDstroke *gps,
 void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps,
                                          const float threshold,
                                          const float corner_angle,
-                                         const bool do_partial_update)
+                                         const eGPStrokeGeoUpdateFlag flag)
 {
   if (gps == NULL || gps->totpoints < 0) {
     return;
@@ -1132,7 +1132,7 @@ void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps,
   }
 
   /* Do a partial update by only updating the curve segments that contain tagged points. */
-  if (do_partial_update && gps->editcurve != NULL) {
+  if ((flag & GP_GEO_UPDATE_CURVE_PARTIAL_REFIT) && gps->editcurve != NULL) {
     prev_flag = gps->editcurve->flag;
     /* Find the segments that need an update, then update them. */
     const int tot_num_segments = (gps->flag & GP_STROKE_CYCLIC) ?
@@ -1178,7 +1178,7 @@ void BKE_gpencil_stroke_editcurve_update(bGPDstroke *gps,
   /* Free the poly weights (if not null). Should no longer be used. */
   BKE_gpencil_free_stroke_weights(gps);
 
-  if (do_partial_update) {
+  if ((flag & GP_GEO_UPDATE_CURVE_PARTIAL_REFIT)) {
     BKE_gpencil_editcurve_recalculate_handles(gps);
   }
 }
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index d43a73fed4f..4bfbb3c61c3 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -1285,6 +1285,7 @@ void BKE_gpencil_stroke_uv_update(bGPDstroke *gps)
  * Recalc all internal geometry data for the stroke
  * \param gpd: Grease pencil data-block
  * \param gps: Grease pencil stroke
+ * \param flag: eGPStrokeGeoUpdateFlag flag (use GP_GEO_UPDATE_DEFAULT=0 for the default)
  */
 void BKE_gpencil_stroke_geometry_update(bGPdata *gpd,
                                         bGPDstroke *gps,
@@ -1300,7 +1301,7 @@ void BKE_gpencil_stroke_geometry_update(bGPdata *gpd,
       /* TODO: Make do-partial-update variable */
       const float threshold = gpd->curve_edit_threshold;
       const float corner_angle = gpd->curve_edit_corner_angle;
-      BKE_gpencil_stroke_editcurve_update(gps, threshold, corner_angle, false);
+      BKE_gpencil_stroke_editcurve_update(gps, threshold, corner_angle, flag);
     }
 
     /* If curve geometry was updated, stroke points need recalculation. */



More information about the Bf-blender-cvs mailing list