Fix T68268: Crash switching to Weight Paint mode
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Aug 2019 17:51:24 +0000 (03:51 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Aug 2019 18:36:43 +0000 (04:36 +1000)
Also applied to sculpt mode

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

index 32b89f5676fe1cc203ecd4195c4ef0cda686cab0..12da8790b91c5478662abff008650b2efaf96d0a 100644 (file)
@@ -1299,6 +1299,9 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
   }
   else {
     Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C);
+    if (depsgraph) {
+      depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+    }
     wmWindowManager *wm = CTX_wm_manager(C);
     ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
     BKE_paint_toolslots_brush_validate(bmain, &ts->wpaint->paint);
index 3567625819f057d6d2fdbb0e5d3f4137da06a9ea..285e6aff7d01724717a9b996de7acb7df5ac0d64 100644 (file)
@@ -6238,6 +6238,9 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
     ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
   }
   else {
+    if (depsgraph) {
+      depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
+    }
     ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports);
     BKE_paint_toolslots_brush_validate(bmain, &ts->sculpt->paint);
   }