Fix #129907: Grease Pencil brush size gets stuck at 0

Possibly due to c13cde24cc

This commit clamps the `brush->size` value to 1 at lowest for the
Grease Pencil Draw mode. There are situations where when the brush scene
space value is set to a small enough size that the distance calculated
by `project_brush_radius` becomes 0.

When this value is set as the actual brush size, the `wm.radial_control`
operator fails to work properly as the new size is now lower than the
expected minimum value, causing incorrect clamping of the modal value.

Pull Request: https://projects.blender.org/blender/blender/pulls/129937
This commit is contained in:
Sean Kim
2024-11-07 10:29:44 +01:00
committed by Falk David
parent 8e85a16997
commit d6db951d92

View File

@@ -1569,7 +1569,7 @@ static void grease_pencil_brush_cursor_draw(PaintCursorContext *pcontext)
const float3 location = placement.project(float2(pcontext->x, pcontext->y));
pcontext->pixel_radius = project_brush_radius(
&pcontext->vc, brush->unprojected_radius, location);
brush->size = pcontext->pixel_radius;
brush->size = std::max(pcontext->pixel_radius, 1);
}
else {
pcontext->pixel_radius = brush->size;