From 5a4872bd4eb7fc79d63dae02f36f65713a79758b Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Sat, 4 Mar 2023 04:08:18 -0800 Subject: [PATCH] Fix #105341 Hard freeze in scene space stroke code Note: the entire paint stroke code needs to be rewritten to work properly in world space. At least it now freezes in one less edge case. --- source/blender/editors/sculpt_paint/paint_stroke.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/editors/sculpt_paint/paint_stroke.cc b/source/blender/editors/sculpt_paint/paint_stroke.cc index c64751965f7..8a2ae42a5ec 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.cc +++ b/source/blender/editors/sculpt_paint/paint_stroke.cc @@ -723,6 +723,12 @@ static float paint_space_stroke_spacing(bContext *C, static float paint_stroke_overlapped_curve(Brush *br, float x, float spacing) { + /* Avoid division by small numbers, can happen + * on some pen setups. See #105341. + */ + + spacing = max_ff(spacing, 0.1f); + const int n = 100 / spacing; const float h = spacing / 50.0f; const float x0 = x - 1;