fix [#32381] Sculpt: crash when using radius sensitivity
authorCampbell Barton <ideasman42@gmail.com>
Fri, 14 Sep 2012 23:34:00 +0000 (23:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 14 Sep 2012 23:34:00 +0000 (23:34 +0000)
source/blender/editors/sculpt_paint/paint_stroke.c

index b53edeadb5123d7740de8fab5f21a32a67f21fa5..7657f78596a6b5d60ae27a02789405f0c3d74ab3 100644 (file)
@@ -254,7 +254,10 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
                                pressure = event_tablet_data(event, NULL);
                        
                        if (pressure > FLT_EPSILON) {
-                               scale = (BKE_brush_size_get(scene, stroke->brush) * pressure * stroke->brush->spacing / 50.0f) / length;
+                               /* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel
+                                * causing very high step sizes, hanging blender [#32381] */
+                               const float size_clamp = maxf(1.0f, BKE_brush_size_get(scene, stroke->brush) * pressure);
+                               scale = (size_clamp * stroke->brush->spacing / 50.0f) / length;
                                if (scale > FLT_EPSILON) {
                                        mul_v2_fl(vec, scale);