From 77698f601021eb557be38945ed74706a325b1c57 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 5 Feb 2015 19:11:00 +0100 Subject: Fix T43556 clamp brush size before setting it after division by DPI, avoids nasty zero size brushes. --- source/blender/editors/sculpt_paint/paint_ops.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/sculpt_paint/paint_ops.c') 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); } -- cgit v1.2.3