[Bf-blender-cvs] [0dc8adbbabd] greasepencil-object: Cleanup smooth code and add one step more
Antonio Vazquez
noreply at git.blender.org
Thu Mar 8 16:02:13 CET 2018
Commit: 0dc8adbbabde44715296b319170acf43b2cb7ff3
Author: Antonio Vazquez
Date: Thu Mar 8 16:01:58 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB0dc8adbbabde44715296b319170acf43b2cb7ff3
Cleanup smooth code and add one step more
It's better add a loop instead to repeat function call. This is cleaner and we can add more steps if required.
===================================================================
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 e3427484fae..0a4659e9e94 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -510,7 +510,7 @@ static void gp_smooth_buffer(tGPsdata *p, float inf, int idx)
if ((num_points < 3) || (idx < 3) || (inf == 0.0f)) {
return;
}
-
+
tGPspoint *points = (tGPspoint *)gpd->sbuffer;
float steps = 4.0f;
if (idx < 4) {
@@ -715,8 +715,9 @@ static short gp_stroke_addpoint(
/* smooth while drawing previous points with a reduction factor for previous */
if (brush->active_smooth > 0.0f) {
- gp_smooth_buffer(p, brush->active_smooth * 0.5f, gpd->sbuffer_size - 1);
- gp_smooth_buffer(p, brush->active_smooth, gpd->sbuffer_size);
+ for (int s = 0; s < 3; s++) {
+ gp_smooth_buffer(p, brush->active_smooth * ((3.0f - s) / 3.0f), gpd->sbuffer_size - s);
+ }
}
/* check if another operation can still occur */
More information about the Bf-blender-cvs
mailing list