diff options
author | Henrik Dick <hen-di@web.de> | 2022-03-25 13:51:45 +0300 |
---|---|---|
committer | Henrik Dick <hen-di@web.de> | 2022-03-25 13:51:45 +0300 |
commit | d4e1458db3a0e0eaf80219dc8e6d10cb27620793 (patch) | |
tree | 0c1284faaa1f437c0eab156c8b76167bc0dd7b00 /source/blender/editors/gpencil/gpencil_fill.c | |
parent | 0c33e84020deca84c987dffa1302651f59c27158 (diff) |
GPencil: Improve smooth operation
This patch makes the grease pencil smooth operation symmetric.
It also increases the performance a lot if strong smoothing is
required. Additionally there is an option for the position smooth
operation to keep the shape closer to the original for more iterations.
Since the result differs from the previous algorithm, versioning is used
to change the iterations and factor to match the old result.
Differential Revision: http://developer.blender.org/D14325
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_fill.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_fill.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 45a2247c65e..8fc300412d9 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1638,14 +1638,9 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) } } - /* smooth stroke */ - float reduce = 0.0f; - float smoothfac = 1.0f; - for (int r = 0; r < 1; r++) { - for (int i = 0; i < gps->totpoints; i++) { - BKE_gpencil_stroke_smooth_point(gps, i, smoothfac - reduce, false); - } - reduce += 0.25f; /* reduce the factor */ + /* Smooth stroke. No copy of the stroke since there only a minor improvement here. */ + for (int i = 0; i < gps->totpoints; i++) { + BKE_gpencil_stroke_smooth_point(gps, i, 1.0f, 2, false, true, gps); } /* if axis locked, reproject to plane locked */ |