diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_hide.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 11 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_utils.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 20 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 14 |
5 files changed, 28 insertions, 22 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 8377b22756e..4c6cd8d6d22 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -384,7 +384,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) clip_planes_from_rect(C, clip_planes, &rect); dm = mesh_get_derived_final(&eval_ctx, CTX_data_scene(C), ob, CD_MASK_BAREMESH); - pbvh = dm->getPBVH(ob, dm); + pbvh = dm->getPBVH(ob, dm, eval_ctx.object_mode); ob->sculpt->pbvh = pbvh; get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area); diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1ae13fcaec0..662485bf4f7 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1376,19 +1376,20 @@ static int texture_paint_toggle_poll(bContext *C) static int texture_paint_toggle_exec(bContext *C, wmOperator *op) { + WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_TEXTURE_PAINT; - const bool is_mode_set = (ob->mode & mode_flag) != 0; + const bool is_mode_set = (workspace->object_mode & mode_flag) != 0; if (!is_mode_set) { - if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { + if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } - if (ob->mode & mode_flag) { - ob->mode &= ~mode_flag; + if (workspace->object_mode & mode_flag) { + workspace->object_mode &= ~mode_flag; if (U.glreslimit != 0) GPU_free_images(); @@ -1436,7 +1437,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) } } - ob->mode |= mode_flag; + workspace->object_mode |= mode_flag; BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 1ec1e052d43..6b14f97d80c 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -566,10 +566,11 @@ static int brush_curve_preset_exec(bContext *C, wmOperator *op) Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C)); if (br) { + const WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape")); - BKE_paint_invalidate_cursor_overlay(scene, view_layer, br->curve); + BKE_paint_invalidate_cursor_overlay(scene, view_layer, br->curve, workspace->object_mode); } return OPERATOR_FINISHED; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 43bb19639cf..3a20973c465 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1045,23 +1045,24 @@ static void vertex_paint_init_session_data( */ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_WEIGHT_PAINT; - const bool is_mode_set = (ob->mode & mode_flag) != 0; + const bool is_mode_set = (workspace->object_mode & mode_flag) != 0; Scene *scene = CTX_data_scene(C); VPaint *wp = scene->toolsettings->wpaint; Mesh *me; if (!is_mode_set) { - if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { + if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } me = BKE_mesh_from_object(ob); - if (ob->mode & mode_flag) { - ob->mode &= ~mode_flag; + if (workspace->object_mode & mode_flag) { + workspace->object_mode &= ~mode_flag; if (me->editflag & ME_EDIT_PAINT_VERT_SEL) { BKE_mesh_flush_select_from_verts(me); @@ -1085,7 +1086,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) paint_cursor_delete_textures(); } else { - ob->mode |= mode_flag; + workspace->object_mode |= mode_flag; if (wp == NULL) wp = scene->toolsettings->wpaint = new_vpaint(); @@ -2222,15 +2223,16 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) */ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) { + WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_VERTEX_PAINT; - const bool is_mode_set = (ob->mode & mode_flag) != 0; + const bool is_mode_set = (workspace->object_mode & mode_flag) != 0; Scene *scene = CTX_data_scene(C); VPaint *vp = scene->toolsettings->vpaint; Mesh *me; if (!is_mode_set) { - if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { + if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } @@ -2239,7 +2241,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) /* toggle: end vpaint */ if (is_mode_set) { - ob->mode &= ~mode_flag; + workspace->object_mode &= ~mode_flag; if (me->editflag & ME_EDIT_PAINT_FACE_SEL) { BKE_mesh_flush_select_from_polys(me); @@ -2259,7 +2261,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) paint_cursor_delete_textures(); } else { - ob->mode |= mode_flag; + workspace->object_mode |= mode_flag; ED_mesh_color_ensure(me, NULL); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index e121030da0c..d6b279008f0 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -5221,7 +5221,7 @@ void sculpt_pbvh_clear(Object *ob) BKE_pbvh_free(ss->pbvh); ss->pbvh = NULL; if (dm) - dm->getPBVH(NULL, dm); + dm->getPBVH(NULL, dm, OB_MODE_OBJECT); BKE_object_free_derived_caches(ob); } @@ -5616,16 +5616,17 @@ static void sculpt_init_session(const bContext *C, Scene *scene, Object *ob) static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) { + WorkSpace *workspace = CTX_wm_workspace(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); const int mode_flag = OB_MODE_SCULPT; - const bool is_mode_set = (ob->mode & mode_flag) != 0; + const bool is_mode_set = (workspace->object_mode & mode_flag) != 0; Mesh *me; MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); int flush_recalc = 0; if (!is_mode_set) { - if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) { + if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) { return OPERATOR_CANCELLED; } } @@ -5659,7 +5660,7 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) } /* Leave sculptmode */ - ob->mode &= ~mode_flag; + workspace->object_mode &= ~mode_flag; BKE_sculptsession_free(ob); @@ -5667,14 +5668,15 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) } else { /* Enter sculptmode */ - ob->mode |= mode_flag; + workspace->object_mode |= mode_flag; if (flush_recalc) DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* Create sculpt mode session data */ - if (ob->sculpt) + if (ob->sculpt) { BKE_sculptsession_free(ob); + } sculpt_init_session(C, scene, ob); |