Commit: 8b584b3c16aa4c8a2e640a154489804b0c273daf
Author: Antonio Vazquez
Date: Tue Sep 24 19:25:37 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB8b584b3c16aa4c8a2e640a154489804b0c273daf
GPencil: Truncate last stroke buffer points with very low pressure
This reduces the drag line when move very fast the pen.
===================================================================
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 0dc01dc27c6..ab357289791 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1001,6 +1001,22 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
(!is_depth);
int i, totelem;
+ /* For very low pressure at the end, truncate stroke. */
+ if (p->paintmode == GP_PAINTMODE_DRAW) {
+ int last_i = gpd->runtime.sbuffer_used - 1;
+ while (last_i > 0) {
+ ptc = (tGPspoint *)gpd->runtime.sbuffer + last_i;
+ if (ptc->pressure > 0.005f) {
+ break;
+ }
+ else {
+ gpd->runtime.sbuffer_used = last_i - 1;
+ CLAMP_MIN(gpd->runtime.sbuffer_used, 1);
+ }
+
+ last_i--;
+ }
+ }
/* Since strokes are so fine,
* when using their depth we need a margin otherwise they might get missed.
*/
int depth_margin = (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? 4 : 0;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs