[Bf-blender-cvs] [c69a771851d] master: GPencil: Simplify smooth average factor calculation

Antonio Vazquez noreply at git.blender.org
Fri Sep 27 16:43:46 CEST 2019


Commit: c69a771851d8c0504927e4e2b61c608338ae522f
Author: Antonio Vazquez
Date:   Fri Sep 27 16:43:31 2019 +0200
Branches: master
https://developer.blender.org/rBc69a771851d8c0504927e4e2b61c608338ae522f

GPencil: Simplify smooth average factor calculation

As always uses 4 points, don't need to do calculations for that and also it was wrong with 3 points.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index bf87408d38f..d8f1663a6c1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -650,7 +650,7 @@ static void gp_smooth_segment(bGPdata *gpd, const float inf, int from_idx, int t
   }
 
   tGPspoint *points = (tGPspoint *)gpd->runtime.sbuffer;
-  const float steps = (num_points < 4) ? 3.0f : 4.0f;
+  const float average_fac = 0.25f;
 
   for (int i = from_idx; i < to_idx + 1; i++) {
 
@@ -660,7 +660,6 @@ static void gp_smooth_segment(bGPdata *gpd, const float inf, int from_idx, int t
     tGPspoint *ptd = &points[i];
 
     float sco[2] = {0.0f};
-    const float average_fac = 1.0f / steps;
 
     /* Compute smoothed coordinate by taking the ones nearby */
     if (pta) {



More information about the Bf-blender-cvs mailing list