diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-02-05 21:11:00 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-02-05 21:11:00 +0300 |
commit | 77698f601021eb557be38945ed74706a325b1c57 (patch) | |
tree | f6c968732dca8b44c845ad177f03e34d5f480e0b /source/blender/editors/sculpt_paint/paint_ops.c | |
parent | a1ec1b3974e81108f5d017d0a1fdcede7419ee99 (diff) |
Fix T43556 clamp brush size before setting it after division by DPI,
avoids nasty zero size brushes.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_ops.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_ops.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 46d7b47adec..09c30479860 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -106,15 +106,14 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) const int old_size = BKE_brush_size_get(scene, brush); int size = (int)(scalar * old_size); - if (old_size == size) { + if (fabs(old_size - size) < U.pixelsize) { if (scalar > 1) { - size++; + size += U.pixelsize; } else if (scalar < 1) { - size--; + size -= U.pixelsize; } } - CLAMP(size, 1, MAX_BRUSH_PIXEL_RADIUS); // XXX magic number, same as max for RNA BKE_brush_size_set(scene, brush, size); } |