diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2016-05-08 04:38:54 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2016-05-08 15:53:51 +0300 |
commit | 9dbe7bbe9a943ffd18fa670c4f68b4f90a6fc773 (patch) | |
tree | d2b62543842dbe02f796cedaa0e6d78f62126b81 /source/blender/editors/gpencil | |
parent | dc78e47b770b33645f3cda1a4750422cd5105d6b (diff) |
D1886: GPencil - Add smooth iterations parameter to get better quality
After some test, a new iteration parameter has been added in order to
apply repetitive smoothing to the stroke. By default 1 iteration is applied,
but can used any number between 1 and 3.
The repetition uses different levels of intensity from 100% of the defined smooth
factor for the first loop, 50% for the second and 25% for the third. We use in each
loop a smaller value in order to avoid deform too much the stroke.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 06829cc92be..fba2f30e715 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -716,11 +716,18 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) } } - /* smooth stroke - only if there's something to do */ - /* NOTE: No pressure smoothing, or else we get annoying thickness changes while drawing... */ + /* smooth stroke after subdiv - only if there's something to do + * for each iteration, the factor is reduced to get a better smoothing without changing too much + * the original stroke + */ if (gpl->draw_smoothfac > 0.0f) { - for (i = 0; i < gps->totpoints; i++) { - gp_smooth_stroke(gps, i, gpl->draw_smoothfac, false); + float reduce = 0.0f; + for (int r = 0; r < gpl->draw_smoothlvl; ++r) { + for (i = 0; i < gps->totpoints; i++) { + /* NOTE: No pressure smoothing, or else we get annoying thickness changes while drawing... */ + gp_smooth_stroke(gps, i, gpl->draw_smoothfac - reduce, false); + } + reduce += 0.25f; // reduce the factor } } |