Bugfix, own testing

When pressure was zero, a sculpt brush was still being executed
with step amount divided by zero, and thus entering eternal loop.

Maybe tablet-specific this but I wonder how this never got reported...
This commit is contained in:
Ton Roosendaal 2011-01-11 12:36:49 +00:00
parent 4134e4f3ae
commit d1b14e7878
2 changed files with 11 additions and 6 deletions

@ -769,7 +769,9 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
float pressure; float pressure;
pressure = event_tablet_data(event, NULL); pressure = event_tablet_data(event, NULL);
if(pressure > FLT_EPSILON) {
scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length; scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
if(scale > FLT_EPSILON) {
mul_v2_fl(vec, scale); mul_v2_fl(vec, scale);
steps = (int)(1.0f / scale); steps = (int)(1.0f / scale);
@ -780,6 +782,8 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
} }
} }
} }
}
}
return cnt; return cnt;
} }

@ -306,6 +306,7 @@ static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
{ {
test->radius_squared= ss->cache->radius_squared; test->radius_squared= ss->cache->radius_squared;
copy_v3_v3(test->location, ss->cache->location); copy_v3_v3(test->location, ss->cache->location);
test->dist= 0.0f; /* just for initialize */
} }
static int sculpt_brush_test(SculptBrushTest *test, float co[3]) static int sculpt_brush_test(SculptBrushTest *test, float co[3])