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/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.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/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c index 8eaed56dc58..d80224e6639 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilshrinkwrap.c @@ -105,15 +105,15 @@ static void deformStroke(GpencilModifierData *md, /* Apply deformed coordinates. */ pt = gps->points; + bGPDstroke gps_old = *gps; + gps_old.points = (bGPDspoint *)MEM_dupallocN(gps->points); for (i = 0; i < gps->totpoints; i++, pt++) { copy_v3_v3(&pt->x, vert_coords[i]); /* Smooth stroke. */ - if (mmd->smooth_factor > 0.0f) { - for (int r = 0; r < mmd->smooth_step; r++) { - BKE_gpencil_stroke_smooth_point(gps, i, mmd->smooth_factor, true); - } - } + BKE_gpencil_stroke_smooth_point( + &gps_old, i, mmd->smooth_factor, mmd->smooth_step, true, false, gps); } + MEM_freeN(gps_old.points); MEM_freeN(vert_coords); |