[Bf-blender-cvs] [970d7ed860f] blender-v2.81-release: Fix T70790: Crash in sculpt mode switching from two meshes after reload saved file

Pablo Dobarro noreply at git.blender.org
Fri Oct 18 16:39:22 CEST 2019


Commit: 970d7ed860f1df7ad316830f7fef6babb5c66d7e
Author: Pablo Dobarro
Date:   Fri Oct 18 16:33:14 2019 +0200
Branches: blender-v2.81-release
https://developer.blender.org/rB970d7ed860f1df7ad316830f7fef6babb5c66d7e

Fix T70790: Crash in sculpt mode switching from two meshes after reload saved file

This fixes the crash, but it does not fix the core issue. The PBVH should
always be available when an object is in sculpt mode and tools should
not need to check for that.

Reviewed By: jbakker

Maniphest Tasks: T70790

Differential Revision: https://developer.blender.org/D6063

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

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 025bb707a81..06fa03ccbc6 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -6369,9 +6369,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
 /* Returns true if any of the smoothing modes are active (currently
  * one of smooth brush, autosmooth, mask smooth, or shift-key
  * smooth) */
-static bool sculpt_needs_conectivity_info(const Brush *brush, SculptSession *ss, int stroke_mode)
+static bool sculpt_needs_connectivity_info(const Brush *brush, SculptSession *ss, int stroke_mode)
 {
-  if (ss && sculpt_automasking_enabled(ss, brush)) {
+  if (ss && ss->pbvh && sculpt_automasking_enabled(ss, brush)) {
     return true;
   }
   return ((stroke_mode == BRUSH_STROKE_SMOOTH) || (ss && ss->cache && ss->cache->alt_smooth) ||
@@ -6385,7 +6385,7 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob, const B
   SculptSession *ss = ob->sculpt;
   View3D *v3d = CTX_wm_view3d(C);
 
-  bool need_pmap = sculpt_needs_conectivity_info(brush, ss, 0);
+  bool need_pmap = sculpt_needs_connectivity_info(brush, ss, 0);
   if (ss->shapekey_active || ss->deform_modifiers_active ||
       (!BKE_sculptsession_use_pbvh_draw(ob, v3d) && need_pmap)) {
     Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
@@ -6738,7 +6738,7 @@ static void sculpt_brush_stroke_init(bContext *C, wmOperator *op)
   view3d_operator_needs_opengl(C);
   sculpt_brush_init_tex(scene, sd, ss);
 
-  is_smooth = sculpt_needs_conectivity_info(brush, ss, mode);
+  is_smooth = sculpt_needs_connectivity_info(brush, ss, mode);
   BKE_sculpt_update_object_for_edit(depsgraph, ob, is_smooth, need_mask);
 }



More information about the Bf-blender-cvs mailing list