diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-01 23:50:37 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-01 23:50:37 +0400 |
commit | d7e835684687770bafe3584b6a2485d692deeb15 (patch) | |
tree | b6e899a3e2de055d6087759a4794aaaf6135d845 /source/blender/blenkernel/intern/brush.c | |
parent | 9fe63e82c38b9f4ea28929ab7bc144f6d4089d31 (diff) |
Fix 2D painting gave squares rather than a disk for the "Max" curve falloff shape.
Diffstat (limited to 'source/blender/blenkernel/intern/brush.c')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index f69b11135c5..621c41c3df7 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -845,7 +845,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, bool use_float, xy[1] = y + yoff; if (fill == BRUSH_IMBUF_MASK) { - alpha_f = alpha * BKE_brush_curve_strength(brush, len_v2(xy), radius); + alpha_f = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dst[0] = crgb[0]; dst[1] = crgb[1]; @@ -1067,15 +1067,17 @@ void BKE_brush_randomize_texture_coordinates(UnifiedPaintSettings *ups, bool mas /* Uses the brush curve control to find a strength value between 0 and 1 */ float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len) { + float strength; + if (p >= len) return 0; else p = p / len; curvemapping_initialize(br->curve); - p = curvemapping_evaluateF(br->curve, 0, p); + strength = curvemapping_evaluateF(br->curve, 0, p); + + CLAMP(strength, 0.0f, 1.0f); - if (p < 0.0f) p = 0.0f; - else if (p > 1.0f) p = 1.0f; - return p; + return strength; } /* same as above but can return negative values if the curve enables * used for sculpt only */ |