Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2018-09-09 15:08:18 +0300
committerAntonioya <blendergit@gmail.com>2018-09-09 15:08:18 +0300
commit84d85f963fc140f42501670527d579e683ab4fb1 (patch)
treef9bc30d5c38a9eec37e32202144e2bb8060ebc33 /source/blender/blenkernel/intern/gpencil.c
parentd7d4baa50f98990ae1af3cb2541a0934a0460318 (diff)
GP: Fix strange pressure values when drawing
This strange values produced an "explosion" of the stoke and it was very annoying.
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index b5230afa0bb..45163de559e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1350,7 +1350,7 @@ bool BKE_gpencil_smooth_stroke_thickness(bGPDstroke *gps, int point_index, float
bGPDspoint *ptb = &gps->points[point_index];
/* Do nothing if not enough points */
- if (gps->totpoints <= 2) {
+ if ((gps->totpoints <= 2) || (point_index < 1)) {
return false;
}
@@ -1369,6 +1369,7 @@ bool BKE_gpencil_smooth_stroke_thickness(bGPDstroke *gps, int point_index, float
* at the distance of point b
*/
float fac = line_point_factor_v3(&ptb->x, &pta->x, &ptc->x);
+ CLAMP(fac, 0.0f, 1.0f);
float optimal = interpf(ptc->pressure, pta->pressure, fac);
/* Based on influence factor, blend between original and optimal */