[Bf-blender-cvs] [f32f83a] GPencil_Editing_Stage3: GP Sculpt: Clamp size/strength changes made using the scrollwheel

Joshua Leung noreply at git.blender.org
Tue Sep 15 16:48:43 CEST 2015


Commit: f32f83a6192486e5ae975d46d38e05956dd69c34
Author: Joshua Leung
Date:   Wed Sep 16 02:45:33 2015 +1200
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rBf32f83a6192486e5ae975d46d38e05956dd69c34

GP Sculpt: Clamp size/strength changes made using the scrollwheel

It would be possible to get weird out of bounds sizes/strength values,
and then wonder why the brush wasn't working at all.

===================================================================

M	source/blender/editors/gpencil/gpencil_brush.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 4502c95..9dcb483 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -1340,10 +1340,12 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
 				if (event->shift) {
 					/* increase strength */
 					gso->brush->strength += 0.05f;
+					CLAMP_MAX(gso->brush->strength, 1.0f);
 				}
 				else {
 					/* increase brush size */
 					gso->brush->size += 3;
+					CLAMP_MAX(gso->brush->size, 300);
 				}
 					
 				redraw_region = true;
@@ -1354,10 +1356,12 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
 				if (event->shift) {
 					/* decrease strength */
 					gso->brush->strength -= 0.05f;
+					CLAMP_MIN(gso->brush->strength, 0.0f);
 				}
 				else {
 					/* decrease brush size */
 					gso->brush->size -= 3;
+					CLAMP_MIN(gso->brush->size, 1);
 				}
 					
 				redraw_region = true;




More information about the Bf-blender-cvs mailing list