[Bf-blender-cvs] [0ed4865fd03] master: Sculpt: Fix T102337: Null pointer error circle (tube) brush test code

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


Commit: 0ed4865fd030ea169ab700843b06b747b06382be
Author: Joseph Eagar
Date:   Mon Nov 28 13:07:50 2022 -0800
Branches: master
https://developer.blender.org/rB0ed4865fd030ea169ab700843b06b747b06382be

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

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc
index e7dd7a92d3f..e1dac167a32 100644
--- a/source/blender/editors/sculpt_paint/sculpt.cc
+++ b/source/blender/editors/sculpt_paint/sculpt.cc
@@ -1832,14 +1832,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