From 636a8d49a67b453fef2693c602966c1c115168fc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 2 Oct 2012 05:12:49 +0000 Subject: fix for crash in own recent masking commit with 'flood fill' operator. --- source/blender/editors/sculpt_paint/paint_mask.c | 7 ++++++- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index e309bdb99cb..697d7c63d1f 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -54,6 +54,7 @@ #include "WM_types.h" #include "ED_screen.h" +#include "ED_sculpt.h" #include "paint_intern.h" #include "sculpt_intern.h" /* for undo push */ @@ -77,7 +78,9 @@ static void mask_flood_fill_set_elem(float *elem, static int mask_flood_fill_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); + struct Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); + struct MultiresModifierData *mmd = sculpt_multires_active(scene, ob); PaintMaskFloodMode mode; float value; DerivedMesh *dm; @@ -88,7 +91,9 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op) mode = RNA_enum_get(op->ptr, "mode"); value = RNA_float_get(op->ptr, "value"); - dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH); + ED_sculpt_mask_layers_ensure(ob, mmd); + + dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); pbvh = dm->getPBVH(ob, dm); ob->sculpt->pbvh = pbvh; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 5f17d44a881..ec0478d128f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4267,7 +4267,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) paint_cursor_start(C, sculpt_poll); } - WM_event_add_notifier(C, NC_SCENE | ND_MODE, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); return OPERATOR_FINISHED; } -- cgit v1.2.3