[Bf-blender-cvs] [48143ab0015] blender-v3.4-release: Sculpt: Fix T102337: Null pointer error circle (tube) brush test code

Joseph Eagar noreply at git.blender.org
Mon Nov 28 22:12:39 CET 2022


Commit: 48143ab00156f94687dcdddd74701e13a07ebd8a
Author: Joseph Eagar
Date:   Mon Nov 28 13:07:50 2022 -0800
Branches: blender-v3.4-release
https://developer.blender.org/rB48143ab00156f94687dcdddd74701e13a07ebd8a

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

===================================================================

M	source/blender/editors/sculpt_paint/sculpt.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 6a38ef8bc8c..aad86ffc2b1 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -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;



More information about the Bf-blender-cvs mailing list