Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-04-05 19:20:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-04-05 19:21:14 +0300
commit1c24c04e6023f2d2a328dfcdc9f86cd381d029a3 (patch)
tree7a5af59ce078cb66fb17ec33cf111ffc8d5fb328 /source/blender/editors/sculpt_paint
parent57329304b061efe756e3a4ce1b828e9a7c7f7030 (diff)
Remove workspace object mode, reverts changes w/ 2.8
This caused too many problems syncing object modes with multiple objects/windows/workspaces, see: D3130 for details.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c47
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c99
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c32
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c3
12 files changed, 81 insertions, 134 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index 710ee7fcb44..049d8ff8c0b 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -32,7 +32,6 @@
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_math_vector.h"
@@ -60,13 +59,12 @@
int paint_curve_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
Paint *p;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
SpaceImage *sima;
- if (rv3d && !(ob && ((workspace->object_mode & OB_MODE_ALL_PAINT) != 0)))
+ if (rv3d && !(ob && ((ob->mode & OB_MODE_ALL_PAINT) != 0)))
return false;
sima = CTX_wm_space_image(C);
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 5d4451dd3d8..4d3c8fe4d5c 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, eval_ctx.object_mode);
+ pbvh = dm->getPBVH(ob, dm);
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 e72dac3b19e..ae26de8b269 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -269,13 +269,11 @@ static int image_paint_poll(bContext *C)
{
Object *obact;
- if (!image_paint_brush(C)) {
+ if (!image_paint_brush(C))
return 0;
- }
- const WorkSpace *workspace = CTX_wm_workspace(C);
obact = CTX_data_active_object(C);
- if ((obact && workspace->object_mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
+ if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
return 1;
}
else {
@@ -1048,21 +1046,19 @@ static int texture_paint_toggle_poll(bContext *C)
static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- 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 = (workspace->object_mode & mode_flag) != 0;
+ const bool is_mode_set = (ob->mode & mode_flag) != 0;
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
+ if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
- if (workspace->object_mode & mode_flag) {
- workspace->object_mode &= ~mode_flag;
+ if (ob->mode & mode_flag) {
+ ob->mode &= ~mode_flag;
if (U.glreslimit != 0)
GPU_free_images();
@@ -1112,7 +1108,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
}
}
- workspace->object_mode |= mode_flag;
+ ob->mode |= mode_flag;
BKE_paint_init(scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT);
@@ -1123,7 +1119,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
toggle_paint_cursor(C, 1);
}
- ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
+ // ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
GPU_drawobject_free(ob->derivedFinal);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
@@ -1151,10 +1147,9 @@ static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
{
UnifiedPaintSettings *ups = &CTX_data_tool_settings(C)->unified_paint_settings;
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
Brush *br;
- if (!(ob && (workspace->object_mode & OB_MODE_VERTEX_PAINT))) {
+ if (!(ob && (ob->mode & OB_MODE_VERTEX_PAINT))) {
br = image_paint_brush(C);
}
else {
@@ -1185,11 +1180,8 @@ static int brush_colors_flip_poll(bContext *C)
}
else {
Object *ob = CTX_data_active_object(C);
- if (ob) {
- WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_VERTEX_PAINT) {
- return 1;
- }
+ if (ob && (ob->mode & OB_MODE_VERTEX_PAINT)) {
+ return 1;
}
}
return 0;
@@ -1231,12 +1223,10 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
static int texture_paint_poll(bContext *C)
{
- if (texture_paint_toggle_poll(C)) {
- WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (texture_paint_toggle_poll(C))
+ if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
return 1;
- }
- }
+
return 0;
}
@@ -1247,19 +1237,16 @@ int image_texture_paint_poll(bContext *C)
int facemask_paint_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
- return BKE_paint_select_face_test(CTX_data_active_object(C), workspace->object_mode);
+ return BKE_paint_select_face_test(CTX_data_active_object(C));
}
int vert_paint_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
- return BKE_paint_select_vert_test(CTX_data_active_object(C), workspace->object_mode);
+ return BKE_paint_select_vert_test(CTX_data_active_object(C));
}
int mask_paint_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
- return BKE_paint_select_elem_test(CTX_data_active_object(C), workspace->object_mode);
+ return BKE_paint_select_elem_test(CTX_data_active_object(C));
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 6530fb5c750..18019597865 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -5941,9 +5941,9 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
static int add_simple_uvs_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- if (!ob || (ob->type != OB_MESH) || (workspace->object_mode != OB_MODE_TEXTURE_PAINT)) {
+
+ if (!ob || ob->type != OB_MESH || ob->mode != OB_MODE_TEXTURE_PAINT) {
return false;
}
return true;
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index e9b6f5a410b..ade775d14e6 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -407,18 +407,17 @@ static void paint_undosys_step_decode_restore_ids(ImageUndoStep *us)
static bool image_undosys_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *obact = CTX_data_active_object(C);
ScrArea *sa = CTX_wm_area(C);
if (sa && (sa->spacetype == SPACE_IMAGE)) {
SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
- if ((obact && (workspace->object_mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
+ if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) {
return true;
}
}
else if (sa && (sa->spacetype == SPACE_VIEW3D)) {
- if (obact && (workspace->object_mode & OB_MODE_TEXTURE_PAINT)) {
+ if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) {
return true;
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index c031a733630..004d2757a71 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -40,8 +40,6 @@
#include "BKE_paint.h"
#include "BKE_main.h"
-#include "DEG_depsgraph.h"
-
#include "ED_paint.h"
#include "ED_screen.h"
#include "ED_image.h"
@@ -262,9 +260,7 @@ static void PALETTE_OT_color_delete(wmOperatorType *ot)
}
static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
-
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
Object *ob = CTX_data_active_object(C);
@@ -272,7 +268,7 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
if (!ob || !brush) return OPERATOR_CANCELLED;
/* TODO: other modes */
- if (workspace->object_mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
BKE_brush_sculpt_reset(brush);
}
else {
@@ -405,7 +401,6 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
static int brush_select_exec(bContext *C, wmOperator *op)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Main *bmain = CTX_data_main(C);
ToolSettings *toolsettings = CTX_data_tool_settings(C);
Paint *paint = NULL;
@@ -419,7 +414,7 @@ static int brush_select_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
if (ob) {
/* select current paint mode */
- paint_mode = workspace->object_mode & OB_MODE_ALL_PAINT;
+ paint_mode = ob->mode & OB_MODE_ALL_PAINT;
}
else {
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index a45e33e4654..0f22973c45d 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -566,11 +566,10 @@ 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, workspace->object_mode);
+ BKE_paint_invalidate_cursor_overlay(scene, view_layer, br->curve);
}
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index f8ad943ffef..12fe55fb956 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -201,12 +201,9 @@ static void paint_last_stroke_update(Scene *scene, ARegion *ar, const float mval
/* Returns true if vertex paint mode is active */
int vertex_paint_mode_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- return (ob &&
- (ob->type == OB_MESH) &&
- ((Mesh *)ob->data)->totpoly &&
- (workspace->object_mode & OB_MODE_VERTEX_PAINT));
+
+ return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly;
}
int vertex_paint_poll(bContext *C)
@@ -226,22 +223,18 @@ int vertex_paint_poll(bContext *C)
int weight_paint_mode_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- return (ob &&
- (ob->type == OB_MESH) &&
- ((Mesh *)ob->data)->totpoly &&
- (workspace->object_mode == OB_MODE_WEIGHT_PAINT));
+
+ return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly;
}
int weight_paint_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
ScrArea *sa;
if ((ob != NULL) &&
- (workspace->object_mode & OB_MODE_WEIGHT_PAINT) &&
+ (ob->mode & OB_MODE_WEIGHT_PAINT) &&
(BKE_paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
(sa = CTX_wm_area(C)) &&
(sa->spacetype == SPACE_VIEW3D))
@@ -958,18 +951,17 @@ static void vertex_paint_init_session(const EvaluationContext *eval_ctx, Scene *
}
}
-static void vertex_paint_init_session_data(
- const EvaluationContext *eval_ctx, const ToolSettings *ts, Object *ob)
+static void vertex_paint_init_session_data(const ToolSettings *ts, Object *ob)
{
/* Create maps */
struct SculptVertexPaintGeomMap *gmap = NULL;
const Brush *brush = NULL;
- if (eval_ctx->object_mode == OB_MODE_VERTEX_PAINT) {
+ 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;
}
- else if (eval_ctx->object_mode == OB_MODE_WEIGHT_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;
@@ -998,7 +990,7 @@ static void vertex_paint_init_session_data(
}
/* Create average brush arrays */
- if (eval_ctx->object_mode == OB_MODE_VERTEX_PAINT) {
+ if (ob->mode == OB_MODE_VERTEX_PAINT) {
if (!brush_use_accumulate(brush)) {
if (ob->sculpt->mode.vpaint.previous_color == NULL) {
ob->sculpt->mode.vpaint.previous_color =
@@ -1009,7 +1001,7 @@ static void vertex_paint_init_session_data(
MEM_SAFE_FREE(ob->sculpt->mode.vpaint.previous_color);
}
}
- else if (eval_ctx->object_mode == OB_MODE_WEIGHT_PAINT) {
+ else if (ob->mode == OB_MODE_WEIGHT_PAINT) {
if (!brush_use_accumulate(brush)) {
if (ob->sculpt->mode.wpaint.alpha_weight == NULL) {
ob->sculpt->mode.wpaint.alpha_weight =
@@ -1042,12 +1034,10 @@ static void vertex_paint_init_session_data(
* \{ */
static void ed_vwpaintmode_enter_generic(
- const EvaluationContext *eval_ctx,
- wmWindowManager *wm,
- WorkSpace *workspace, Scene *scene,
+ const EvaluationContext *eval_ctx, wmWindowManager *wm, Scene *scene,
Object *ob, const eObjectMode mode_flag)
{
- workspace->object_mode |= mode_flag;
+ ob->mode |= mode_flag;
Mesh *me = BKE_mesh_from_object(ob);
if (mode_flag == OB_MODE_VERTEX_PAINT) {
@@ -1091,44 +1081,40 @@ static void ed_vwpaintmode_enter_generic(
}
vertex_paint_init_session(eval_ctx, scene, ob);
-
- ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
}
void ED_object_vpaintmode_enter_ex(
const EvaluationContext *eval_ctx, wmWindowManager *wm,
- WorkSpace *workspace, Scene *scene, Object *ob)
+ Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- eval_ctx, wm, workspace, scene, ob, OB_MODE_VERTEX_PAINT);
+ eval_ctx, wm, scene, ob, OB_MODE_VERTEX_PAINT);
}
void ED_object_vpaintmode_enter(struct bContext *C)
{
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
wmWindowManager *wm = CTX_wm_manager(C);
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ED_object_vpaintmode_enter_ex(&eval_ctx, wm, workspace, scene, ob);
+ ED_object_vpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
}
void ED_object_wpaintmode_enter_ex(
const EvaluationContext *eval_ctx, wmWindowManager *wm,
- WorkSpace *workspace, Scene *scene, Object *ob)
+ Scene *scene, Object *ob)
{
ed_vwpaintmode_enter_generic(
- eval_ctx, wm, workspace, scene, ob, OB_MODE_WEIGHT_PAINT);
+ eval_ctx, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
}
void ED_object_wpaintmode_enter(struct bContext *C)
{
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
wmWindowManager *wm = CTX_wm_manager(C);
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- ED_object_wpaintmode_enter_ex(&eval_ctx, wm, workspace, scene, ob);
+ ED_object_wpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
}
/** \} */
@@ -1138,11 +1124,10 @@ void ED_object_wpaintmode_enter(struct bContext *C)
* \{ */
static void ed_vwpaintmode_exit_generic(
- WorkSpace *workspace,
Object *ob, const eObjectMode mode_flag)
{
Mesh *me = BKE_mesh_from_object(ob);
- workspace->object_mode &= ~mode_flag;
+ ob->mode &= ~mode_flag;
if (mode_flag == OB_MODE_VERTEX_PAINT) {
if (me->editflag & ME_EDIT_PAINT_FACE_SEL) {
@@ -1178,30 +1163,26 @@ static void ed_vwpaintmode_exit_generic(
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, NULL, 'e');
}
-
- ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
}
-void ED_object_vpaintmode_exit_ex(WorkSpace *workspace, Object *ob)
+void ED_object_vpaintmode_exit_ex(Object *ob)
{
- ed_vwpaintmode_exit_generic(workspace, ob, OB_MODE_VERTEX_PAINT);
+ ed_vwpaintmode_exit_generic(ob, OB_MODE_VERTEX_PAINT);
}
void ED_object_vpaintmode_exit(struct bContext *C)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- ED_object_vpaintmode_exit_ex(workspace, ob);
+ ED_object_vpaintmode_exit_ex(ob);
}
-void ED_object_wpaintmode_exit_ex(WorkSpace *workspace, Object *ob)
+void ED_object_wpaintmode_exit_ex(Object *ob)
{
- ed_vwpaintmode_exit_generic(workspace, ob, OB_MODE_WEIGHT_PAINT);
+ ed_vwpaintmode_exit_generic(ob, OB_MODE_WEIGHT_PAINT);
}
void ED_object_wpaintmode_exit(struct bContext *C)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- ED_object_wpaintmode_exit_ex(workspace, ob);
+ ED_object_wpaintmode_exit_ex(ob);
}
/** \} */
@@ -1213,14 +1194,13 @@ void ED_object_wpaintmode_exit(struct bContext *C)
*/
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 = (workspace->object_mode & mode_flag) != 0;
+ const bool is_mode_set = (ob->mode & mode_flag) != 0;
Scene *scene = CTX_data_scene(C);
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
+ if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
@@ -1228,17 +1208,15 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
Mesh *me = BKE_mesh_from_object(ob);
if (is_mode_set) {
- ED_object_wpaintmode_exit_ex(workspace, ob);
+ ED_object_wpaintmode_exit_ex(ob);
}
else {
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_wpaintmode_enter_ex(&eval_ctx, wm, workspace, scene, ob);
+ ED_object_wpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
}
- BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
-
/* Weightpaint works by overriding colors in mesh,
* so need to make sure we recalc on enter and
* exit (exit needs doing regardless because we
@@ -1427,14 +1405,11 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
bool *defbase_sel;
SculptSession *ss = ob->sculpt;
VPaint *vp = CTX_data_tool_settings(C)->wpaint;
- EvaluationContext eval_ctx;
if (ED_wpaint_ensure_data(C, op->reports, WPAINT_ENSURE_MIRROR, &vgroup_index) == false) {
return false;
}
- CTX_data_eval_ctx(C, &eval_ctx);
-
{
/* check if we are attempting to paint onto a locked vertex group,
* and other options disallow it from doing anything useful */
@@ -1532,10 +1507,13 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
wpd->precomputed_weight = MEM_mallocN(sizeof(float) * me->totvert, __func__);
}
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
+
/* If not previously created, create vertex/weight paint mode session data */
vertex_paint_init_session(&eval_ctx, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
- vertex_paint_init_session_data(&eval_ctx, ts, ob);
+ vertex_paint_init_session_data(ts, ob);
if (ob->sculpt->mode.wpaint.dvert_prev != NULL) {
MDeformVert *dv = ob->sculpt->mode.wpaint.dvert_prev;
@@ -2351,14 +2329,13 @@ 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 = (workspace->object_mode & mode_flag) != 0;
+ const bool is_mode_set = (ob->mode & mode_flag) != 0;
Scene *scene = CTX_data_scene(C);
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
+ if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
@@ -2367,13 +2344,13 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
/* toggle: end vpaint */
if (is_mode_set) {
- ED_object_vpaintmode_exit_ex(workspace, ob);
+ ED_object_vpaintmode_exit_ex(ob);
}
else {
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
wmWindowManager *wm = CTX_wm_manager(C);
- ED_object_vpaintmode_enter_ex(&eval_ctx, wm, workspace, scene, ob);
+ ED_object_vpaintmode_enter_ex(&eval_ctx, wm, scene, ob);
}
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
@@ -2522,7 +2499,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(&eval_ctx, scene, ob);
vwpaint_update_cache_invariants(C, vp, ss, op, mouse);
- vertex_paint_init_session_data(&eval_ctx, ts, ob);
+ vertex_paint_init_session_data(ts, ob);
if (ob->sculpt->mode.vpaint.previous_color != NULL) {
memset(ob->sculpt->mode.vpaint.previous_color, 0, sizeof(uint) * me->totloop);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index f442c12cbe9..d7668a48139 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -28,7 +28,6 @@
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_math_base.h"
#include "BLI_math_color.h"
@@ -52,10 +51,9 @@
static int vertex_weight_paint_mode_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
Mesh *me = BKE_mesh_from_object(ob);
- return (ob && ELEM(workspace->object_mode, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT)) &&
+ return (ob && (ob->mode == OB_MODE_VERTEX_PAINT || ob->mode == OB_MODE_WEIGHT_PAINT)) &&
(me && me->totpoly && me->dvert);
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 7ff9c3851ac..3892b776440 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -118,10 +118,9 @@ static void wpaint_prev_destroy(struct WPaintPrev *wpp)
static int weight_from_bones_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- return (ob && (workspace->object_mode & OB_MODE_WEIGHT_PAINT) && modifiers_isDeformedByArmature(ob));
+ return (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && modifiers_isDeformedByArmature(ob));
}
static int weight_from_bones_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ce34fb6d05d..4a9d2597415 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4083,9 +4083,8 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
int sculpt_mode_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- return ob && workspace->object_mode & OB_MODE_SCULPT;
+ return ob && ob->mode & OB_MODE_SCULPT;
}
int sculpt_mode_poll_view3d(bContext *C)
@@ -5220,7 +5219,7 @@ void sculpt_pbvh_clear(Object *ob)
BKE_pbvh_free(ss->pbvh);
ss->pbvh = NULL;
if (dm)
- dm->getPBVH(NULL, dm, OB_MODE_OBJECT);
+ dm->getPBVH(NULL, dm);
BKE_object_free_derived_caches(ob);
}
@@ -5649,14 +5648,14 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, Object *ob, Mult
void ED_object_sculptmode_enter_ex(
const EvaluationContext *eval_ctx,
- WorkSpace *workspace, Scene *scene, Object *ob,
+ Scene *scene, Object *ob,
ReportList *reports)
{
const int mode_flag = OB_MODE_SCULPT;
Mesh *me = BKE_mesh_from_object(ob);
/* Enter sculptmode */
- workspace->object_mode |= mode_flag;
+ ob->mode |= mode_flag;
MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob);
@@ -5739,7 +5738,7 @@ void ED_object_sculptmode_enter_ex(
}
}
- ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
+ // ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
/* VBO no longer valid */
if (ob->derivedFinal) {
@@ -5749,17 +5748,16 @@ void ED_object_sculptmode_enter_ex(
void ED_object_sculptmode_enter(struct bContext *C, ReportList *reports)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
- ED_object_sculptmode_enter_ex(&eval_ctx, workspace, scene, ob, reports);
+ ED_object_sculptmode_enter_ex(&eval_ctx, scene, ob, reports);
}
void ED_object_sculptmode_exit_ex(
const EvaluationContext *eval_ctx,
- WorkSpace *workspace, Scene *scene, Object *ob)
+ Scene *scene, Object *ob)
{
const int mode_flag = OB_MODE_SCULPT;
Mesh *me = BKE_mesh_from_object(ob);
@@ -5792,9 +5790,9 @@ void ED_object_sculptmode_exit_ex(
}
/* Leave sculptmode */
- workspace->object_mode &= ~mode_flag;
+ ob->mode &= ~mode_flag;
- ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
+ // ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
BKE_sculptsession_free(ob);
@@ -5808,24 +5806,22 @@ void ED_object_sculptmode_exit_ex(
void ED_object_sculptmode_exit(bContext *C)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
- ED_object_sculptmode_exit_ex(&eval_ctx, workspace, scene, ob);
+ ED_object_sculptmode_exit_ex(&eval_ctx, scene, 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 = (workspace->object_mode & mode_flag) != 0;
+ const bool is_mode_set = (ob->mode & mode_flag) != 0;
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
+ if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
@@ -5834,10 +5830,10 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
CTX_data_eval_ctx(C, &eval_ctx);
if (is_mode_set) {
- ED_object_sculptmode_exit_ex(&eval_ctx, workspace, scene, ob);
+ ED_object_sculptmode_exit_ex(&eval_ctx, scene, ob);
}
else {
- ED_object_sculptmode_enter_ex(&eval_ctx, workspace, scene, ob, op->reports);
+ ED_object_sculptmode_enter_ex(&eval_ctx, scene, ob, op->reports);
}
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 694e1f048f5..e12ef2df4ab 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1020,9 +1020,8 @@ static bool sculpt_undosys_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa && (sa->spacetype == SPACE_VIEW3D)) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *obact = CTX_data_active_object(C);
- if (obact && (workspace->object_mode & OB_MODE_SCULPT)) {
+ if (obact && (obact->mode & OB_MODE_SCULPT)) {
return true;
}
}