Sculpt: Fix T102337: Null pointer error circle (tube) brush test code

This commit is contained in:
Joseph Eagar 2022-11-28 13:07:50 -08:00
parent b1cc2a48f2
commit 48143ab001
Notes: blender-bot 2023-02-14 10:35:28 +01:00
Referenced by issue #102336, Regression: Enabling Dynamic Topology Causes Crash on Plane Mesh
Referenced by issue #102337, Regression: Dragging move gizmo causes crash in sculpt mode
1 changed files with 14 additions and 1 deletions

View File

@ -1824,14 +1824,27 @@ SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape(SculptSession *ss,
SculptBrushTest *test,
char falloff_shape)
{
if (!ss->cache && !ss->filter_cache) {
falloff_shape = PAINT_FALLOFF_SHAPE_SPHERE;
}
SCULPT_brush_test_init(ss, test);
SculptBrushTestFn sculpt_brush_test_sq_fn;
if (falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) {
sculpt_brush_test_sq_fn = SCULPT_brush_test_sphere_sq;
}
else {
float view_normal[3];
if (ss->cache) {
copy_v3_v3(view_normal, ss->cache->view_normal);
}
else {
copy_v3_v3(view_normal, ss->filter_cache->view_normal);
}
/* PAINT_FALLOFF_SHAPE_TUBE */
plane_from_point_normal_v3(test->plane_view, test->location, ss->cache->view_normal);
plane_from_point_normal_v3(test->plane_view, test->location, view_normal);
sculpt_brush_test_sq_fn = SCULPT_brush_test_circle_sq;
}
return sculpt_brush_test_sq_fn;