diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-19 09:56:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-19 09:56:45 +0300 |
commit | 7a3e037dc0dc9e10141c5a6c5e8c149bdb530dc2 (patch) | |
tree | a47dc43847253a201fe8c84a7cadbe693848e701 /source/blender/editors/sculpt_paint/paint_vertex.c | |
parent | bd3fe54b0d1fae577813d1b2850d5da57dbb1fe5 (diff) | |
parent | 751189e9d6828368614fe3f517a80ddb95f8c547 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_vertex.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index ac6bfe019a1..85a1f11be4b 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -967,15 +967,20 @@ static void do_weight_paint_vertex( /* Toggle operator for turning vertex paint mode on or off (copied from sculpt.c) */ -static void vertex_paint_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob) +static void vertex_paint_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob, eObjectMode object_mode) { /* Create persistent sculpt mode data */ BKE_sculpt_toolsettings_data_ensure(scene); - if (ob->sculpt == NULL) { - ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); - BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, false, false); - } + BLI_assert(ob->sculpt == NULL); + ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); + ob->sculpt->mode_type = object_mode; + BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, false, false); +} + +static void vertex_paint_init_stroke(Depsgraph *depsgraph, Scene *scene, Object *ob) +{ + BKE_sculpt_update_mesh_elements(depsgraph, scene, scene->toolsettings->sculpt, ob, false, false); } static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) @@ -986,12 +991,12 @@ static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob) if (ob->mode == OB_MODE_VERTEX_PAINT) { gmap = &ob->sculpt->mode.vpaint.gmap; brush = BKE_paint_brush(&ts->vpaint->paint); - ob->sculpt->mode_type = OB_MODE_VERTEX_PAINT; + BLI_assert(ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT); } else if (ob->mode == OB_MODE_WEIGHT_PAINT) { gmap = &ob->sculpt->mode.wpaint.gmap; brush = BKE_paint_brush(&ts->wpaint->paint); - ob->sculpt->mode_type = OB_MODE_WEIGHT_PAINT; + BLI_assert(ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT); } else { ob->sculpt->mode_type = 0; @@ -1113,7 +1118,7 @@ static void ed_vwpaintmode_enter_generic( BKE_sculptsession_free(ob); } - vertex_paint_init_session(depsgraph, scene, ob); + vertex_paint_init_session(depsgraph, scene, ob, mode_flag); /* Flush object mode. */ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); @@ -1556,7 +1561,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo } /* If not previously created, create vertex/weight paint mode session data */ - vertex_paint_init_session(depsgraph, scene, ob); + vertex_paint_init_stroke(depsgraph, scene, ob); vwpaint_update_cache_invariants(C, vp, ss, op, mouse); vertex_paint_init_session_data(ts, ob); @@ -2545,7 +2550,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f } /* If not previously created, create vertex/weight paint mode session data */ - vertex_paint_init_session(depsgraph, scene, ob); + vertex_paint_init_stroke(depsgraph, scene, ob); vwpaint_update_cache_invariants(C, vp, ss, op, mouse); vertex_paint_init_session_data(ts, ob); |