Commit: 7cc8d31f4ccca64b3d98038a9260165d1170c234
Author: Antonio Vazquez
Date:   Wed Mar 7 11:06:05 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7cc8d31f4ccca64b3d98038a9260165d1170c234

Remove unused affect_pressure parameter in smooth

This parameter was defined but internally was never used. The reason to disable 
this was that after testing, smooth the pressure got weird autistics results.

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

M       source/blender/blenkernel/BKE_gpencil.h
M       source/blender/blenkernel/intern/gpencil.c
M       source/blender/editors/gpencil/gpencil_brush.c
M       source/blender/editors/gpencil/gpencil_fill.c
M       source/blender/editors/gpencil/gpencil_paint.c
M       source/blender/modifiers/intern/MOD_gpencilsmooth.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h 
b/source/blender/blenkernel/BKE_gpencil.h
index 8c9f9f9c338..a3dee3aa646 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -220,7 +220,7 @@ void BKE_gpencil_simplify_fixed(struct bGPDlayer *gpl, 
struct bGPDstroke *gps);
 
 void BKE_gpencil_transform(struct bGPdata *gpd, float mat[4][4]);
 
-bool BKE_gp_smooth_stroke(struct bGPDstroke *gps, int i, float inf, bool 
affect_pressure);
+bool BKE_gp_smooth_stroke(struct bGPDstroke *gps, int i, float inf);
 bool BKE_gp_smooth_stroke_strength(struct bGPDstroke *gps, int i, float inf);
 bool BKE_gp_smooth_stroke_thickness(struct bGPDstroke *gps, int i, float inf);
 bool BKE_gp_smooth_stroke_uv(struct bGPDstroke *gps, int i, float inf);
diff --git a/source/blender/blenkernel/intern/gpencil.c 
b/source/blender/blenkernel/intern/gpencil.c
index 8c39eb93821..664176209e2 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2514,9 +2514,8 @@ bool BKE_gpencil_vgroup_remove_point_weight(bGPDspoint 
*pt, int index)
  * \param gps              Stroke to smooth
  * \param i                Point index
  * \param inf              Amount of smoothing to apply
- * \param affect_pressure  Apply smoothing to pressure values too?
  */
-bool BKE_gp_smooth_stroke(bGPDstroke *gps, int i, float inf, bool 
affect_pressure)
+bool BKE_gp_smooth_stroke(bGPDstroke *gps, int i, float inf)
 {
        bGPDspoint *pt = &gps->points[i];
        float pressure = 0.0f;
@@ -2545,10 +2544,6 @@ bool BKE_gp_smooth_stroke(bGPDstroke *gps, int i, float 
inf, bool affect_pressur
                /* add the point itself */
                madd_v3_v3fl(sco, &pt->x, average_fac);
 
-               if (affect_pressure) {
-                       pressure += pt->pressure * average_fac;
-               }
-
                /* n-steps before/after current point */
                // XXX: review how the endpoints are treated by this algorithm
                // XXX: falloff measures should also introduce some weighting 
variations, so that further-out points get less weight
@@ -2567,27 +2562,12 @@ bool BKE_gp_smooth_stroke(bGPDstroke *gps, int i, float 
inf, bool affect_pressur
                        madd_v3_v3fl(sco, &pt1->x, average_fac);
                        madd_v3_v3fl(sco, &pt2->x, average_fac);
 
-#if 0
-                       /* XXX: Disabled because get weird result */
-                       /* do pressure too? */
-                       if (affect_pressure) {
-                               pressure += pt1->pressure * average_fac;
-                               pressure += pt2->pressure * average_fac;
-                       }
-#endif
                }
        }
 
        /* Based on influence factor, blend between original and optimal 
smoothed coordinate */
        interp_v3_v3v3(&pt->x, &pt->x, sco, inf);
 
-#if 0
-       /* XXX: Disabled because get weird result */
-       if (affect_pressure) {
-               pt->pressure = pressure;
-       }
-#endif
-
        return true;
 }
 
diff --git a/source/blender/editors/gpencil/gpencil_brush.c 
b/source/blender/editors/gpencil/gpencil_brush.c
index a365446f45d..b8b8a636865 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -279,7 +279,6 @@ static bool gp_brush_smooth_apply(
 {
        GP_EditBrush_Data *brush = gso->brush;
        float inf = gp_brush_influence_calc(gso, radius, co);
-       bool affect_pressure = (brush->flag & 
GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE) != 0;
        /* need one flag enabled by default */
        if ((gso->settings->flag & (GP_BRUSHEDIT_FLAG_APPLY_POSITION |
                                    GP_BRUSHEDIT_FLAG_APPLY_STRENGTH |
@@ -291,7 +290,7 @@ static bool gp_brush_smooth_apply(
 
        /* perform smoothing */
        if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_POSITION) {
-               BKE_gp_smooth_stroke(gps, pt_index, inf, affect_pressure);
+               BKE_gp_smooth_stroke(gps, pt_index, inf);
        }
        if (gso->settings->flag & GP_BRUSHEDIT_FLAG_APPLY_STRENGTH) {
                BKE_gp_smooth_stroke_strength(gps, pt_index, inf);
diff --git a/source/blender/editors/gpencil/gpencil_fill.c 
b/source/blender/editors/gpencil/gpencil_fill.c
index e1c0b7d7c45..eb0838dad00 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -861,7 +861,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
        float smoothfac = 1.0f;
        for (int r = 0; r < 1; r++) {
                for (int i = 0; i < gps->totpoints; i++) {
-                       BKE_gp_smooth_stroke(gps, i, smoothfac - reduce, false);
+                       BKE_gp_smooth_stroke(gps, i, smoothfac - reduce);
                }
                reduce += 0.25f;  // reduce the factor
        }
diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 00a061fd7eb..b4591924cfa 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1042,7 +1042,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
                        float reduce = 0.0f;
                        for (int r = 0; r < brush->draw_smoothlvl; r++) {
                                for (i = 0; i < gps->totpoints; i++) {
-                                       BKE_gp_smooth_stroke(gps, i, 
brush->draw_smoothfac - reduce, false);
+                                       BKE_gp_smooth_stroke(gps, i, 
brush->draw_smoothfac - reduce);
                                        BKE_gp_smooth_stroke_strength(gps, i, 
brush->draw_smoothfac);
                                }
                                reduce += 0.25f;  // reduce the factor
diff --git a/source/blender/modifiers/intern/MOD_gpencilsmooth.c 
b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
index 6ec6bbf303f..48cd9026cbe 100644
--- a/source/blender/modifiers/intern/MOD_gpencilsmooth.c
+++ b/source/blender/modifiers/intern/MOD_gpencilsmooth.c
@@ -90,7 +90,7 @@ static void deformStroke(ModifierData *md, const 
EvaluationContext *UNUSED(eval_
                                val = mmd->factor * weight;
                                /* perform smoothing */
                                if (mmd->flag & GP_SMOOTH_MOD_LOCATION) {
-                                       BKE_gp_smooth_stroke(gps, i, val, 
false);
+                                       BKE_gp_smooth_stroke(gps, i, val);
                                }
                                if (mmd->flag & GP_SMOOTH_MOD_STRENGTH) {
                                        BKE_gp_smooth_stroke_strength(gps, i, 
val);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to