From 888a0735eee5fbe05fc60d8755d83974a2f74680 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 3 Nov 2018 16:52:06 +1100 Subject: Tool System: validate tool slots when setting modes Needed for entering paint modes on new scenes. --- source/blender/editors/sculpt_paint/paint_vertex.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c') diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 7b3cfe184f5..94aeeb5d158 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1247,6 +1247,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) const int mode_flag = OB_MODE_WEIGHT_PAINT; const bool is_mode_set = (ob->mode & mode_flag) != 0; Scene *scene = CTX_data_scene(C); + ToolSettings *ts = scene->toolsettings; if (!is_mode_set) { if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { @@ -1263,6 +1264,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); wmWindowManager *wm = CTX_wm_manager(C); ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); + BKE_paint_toolslots_brush_validate(bmain, scene, &ts->wpaint->paint); } /* Weightpaint works by overriding colors in mesh, @@ -2390,6 +2392,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) const int mode_flag = OB_MODE_VERTEX_PAINT; const bool is_mode_set = (ob->mode & mode_flag) != 0; Scene *scene = CTX_data_scene(C); + ToolSettings *ts = scene->toolsettings; if (!is_mode_set) { if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { @@ -2407,6 +2410,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) Depsgraph *depsgraph = CTX_data_depsgraph_on_load(C); wmWindowManager *wm = CTX_wm_manager(C); ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob); + BKE_paint_toolslots_brush_validate(bmain, scene, &ts->wpaint->paint); } BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); -- cgit v1.2.3