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/object
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/object')
-rw-r--r--source/blender/editors/object/object_add.c18
-rw-r--r--source/blender/editors/object/object_bake.c21
-rw-r--r--source/blender/editors/object/object_bake_api.c2
-rw-r--r--source/blender/editors/object/object_constraint.c39
-rw-r--r--source/blender/editors/object/object_edit.c87
-rw-r--r--source/blender/editors/object/object_facemap_ops.c3
-rw-r--r--source/blender/editors/object/object_modes.c112
-rw-r--r--source/blender/editors/object/object_modifier.c142
-rw-r--r--source/blender/editors/object/object_ops.c3
-rw-r--r--source/blender/editors/object/object_relations.c12
-rw-r--r--source/blender/editors/object/object_select.c57
-rw-r--r--source/blender/editors/object/object_shapekey.c10
-rw-r--r--source/blender/editors/object/object_transform.c3
-rw-r--r--source/blender/editors/object/object_vgroup.c42
14 files changed, 175 insertions, 376 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 96a5a95a5cd..bfeb48f9308 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2081,9 +2081,7 @@ void OBJECT_OT_convert(wmOperatorType *ot)
/* used below, assumes id.new is correct */
/* leaves selection of base/object unaltered */
/* Does set ID->newid pointers. */
-static Base *object_add_duplicate_internal(
- Main *bmain, Scene *scene,
- ViewLayer *view_layer, Object *ob, int dupflag)
+static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, int dupflag)
{
#define ID_NEW_REMAP_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; }
#define ID_NEW_REMAP_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; }
@@ -2094,14 +2092,10 @@ static Base *object_add_duplicate_internal(
ID *id;
int a, didit;
- /* ignore pose mode now, Caller can inspect mode. */
-#if 0
- if (eval_ctx->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
; /* nothing? */
}
- else
-#endif
- {
+ else {
obn = ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
@@ -2529,10 +2523,9 @@ static int join_poll(bContext *C)
static int join_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- if (workspace->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
@@ -2583,10 +2576,9 @@ static int join_shapes_poll(bContext *C)
static int join_shapes_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
- if (workspace->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index e23329a7a68..a38b9959dab 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -206,8 +206,7 @@ static bool multiresbake_check(bContext *C, wmOperator *op)
return ok;
}
-static DerivedMesh *multiresbake_create_loresdm(
- Scene *scene, Object *ob, eObjectMode object_mode, int *lvl)
+static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *lvl)
{
DerivedMesh *dm;
MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
@@ -227,15 +226,13 @@ static DerivedMesh *multiresbake_create_loresdm(
tmp_mmd.lvl = *lvl;
tmp_mmd.sculptlvl = *lvl;
- dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0, object_mode);
+ dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
cddm->release(cddm);
return dm;
}
-static DerivedMesh *multiresbake_create_hiresdm(
- Scene *scene, Object *ob, eObjectMode object_mode,
- int *lvl, bool *simple)
+static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *lvl, bool *simple)
{
Mesh *me = (Mesh *)ob->data;
MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
@@ -256,7 +253,7 @@ static DerivedMesh *multiresbake_create_hiresdm(
tmp_mmd.lvl = mmd->totlvl;
tmp_mmd.sculptlvl = mmd->totlvl;
- dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0, object_mode);
+ dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
cddm->release(cddm);
return dm;
@@ -320,7 +317,6 @@ static void clear_images_poly(Image **ob_image_array, int ob_image_array_len, Cl
static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
{
Object *ob;
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
int objects_baked = 0;
@@ -375,8 +371,8 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
bkr.ob_image.array = BKE_object_material_edit_image_get_array(ob);
bkr.ob_image.len = ob->totcol;
- bkr.hires_dm = multiresbake_create_hiresdm(scene, ob, workspace->object_mode, &bkr.tot_lvl, &bkr.simple);
- bkr.lores_dm = multiresbake_create_loresdm(scene, ob, workspace->object_mode, &bkr.lvl);
+ bkr.hires_dm = multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
+ bkr.lores_dm = multiresbake_create_loresdm(scene, ob, &bkr.lvl);
RE_multires_bake_images(&bkr);
@@ -400,7 +396,6 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
/* Multiresbake adopted for job-system executing */
static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob;
@@ -432,8 +427,8 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
data->ob_image.len = ob->totcol;
/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
- data->hires_dm = multiresbake_create_hiresdm(scene, ob, workspace->object_mode, &data->tot_lvl, &data->simple);
- data->lores_dm = multiresbake_create_loresdm(scene, ob, workspace->object_mode, &lvl);
+ data->hires_dm = multiresbake_create_hiresdm(scene, ob, &data->tot_lvl, &data->simple);
+ data->lores_dm = multiresbake_create_loresdm(scene, ob, &lvl);
data->lvl = lvl;
BLI_addtail(&bkj->data, data);
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index acf3f73c9c6..0fde6f643a8 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -866,7 +866,7 @@ static int bake(
/* triangulating so BVH returns the primitive_id that will be used for rendering */
highpoly[i].tri_mod = ED_object_modifier_add(
- reports, bmain, scene, highpoly[i].ob, OB_MODE_OBJECT,
+ reports, bmain, scene, highpoly[i].ob,
"TmpTriangulate", eModifierType_Triangulate);
tmd = (TriangulateModifierData *)highpoly[i].tri_mod;
tmd->quad_method = MOD_TRIANGULATE_QUAD_FIXED;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 1b462e92ca4..1a20a8db5b3 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -87,12 +87,12 @@
/* -------------- Get Active Constraint Data ---------------------- */
/* if object in posemode, active bone constraints, else object constraints */
-ListBase *get_active_constraints(const EvaluationContext *eval_ctx, Object *ob)
+ListBase *get_active_constraints(Object *ob)
{
if (ob == NULL)
return NULL;
- if (eval_ctx->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
pchan = BKE_pose_channel_active(ob);
@@ -142,9 +142,9 @@ ListBase *get_constraint_lb(Object *ob, bConstraint *con, bPoseChannel **r_pchan
}
/* single constraint */
-bConstraint *get_active_constraint(const EvaluationContext *eval_ctx, Object *ob)
+bConstraint *get_active_constraint(Object *ob)
{
- return BKE_constraints_active_get(get_active_constraints(eval_ctx, ob));
+ return BKE_constraints_active_get(get_active_constraints(ob));
}
/* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */
@@ -639,8 +639,7 @@ static int edit_constraint_invoke_properties(bContext *C, wmOperator *op)
return 0;
}
-static bConstraint *edit_constraint_property_get(
- const EvaluationContext *eval_ctx, wmOperator *op, Object *ob, int type)
+static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int type)
{
char constraint_name[MAX_NAME];
int owner = RNA_enum_get(op->ptr, "owner");
@@ -665,7 +664,7 @@ static bConstraint *edit_constraint_property_get(
else {
//if (G.debug & G_DEBUG)
//printf("edit_constraint_property_get: defaulting to getting list in the standard way\n");
- list = get_active_constraints(eval_ctx, ob);
+ list = get_active_constraints(ob);
}
con = BKE_constraints_find_name(list, constraint_name);
@@ -688,7 +687,7 @@ static int stretchto_reset_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_STRETCHTO);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_STRETCHTO);
bStretchToConstraint *data = (con) ? (bStretchToConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
@@ -736,7 +735,7 @@ static int limitdistance_reset_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_DISTLIMIT);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_DISTLIMIT);
bDistLimitConstraint *data = (con) ? (bDistLimitConstraint *)con->data : NULL;
/* despite 3 layers of checks, we may still not be able to find a constraint */
@@ -875,7 +874,7 @@ static int childof_set_inverse_exec(bContext *C, wmOperator *op)
CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_CHILDOF);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
const int owner = RNA_enum_get(op->ptr, "owner");
@@ -926,7 +925,7 @@ static int childof_clear_inverse_exec(bContext *C, wmOperator *op)
Object *ob = ED_object_active_context(C);
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_CHILDOF);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
bChildOfConstraint *data = (con) ? (bChildOfConstraint *)con->data : NULL;
if (data == NULL) {
@@ -976,7 +975,7 @@ static int followpath_path_animate_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_FOLLOWPATH);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_FOLLOWPATH);
bFollowPathConstraint *data = (con) ? (bFollowPathConstraint *)con->data : NULL;
bAction *act = NULL;
@@ -1103,7 +1102,7 @@ static int objectsolver_set_inverse_exec(bContext *C, wmOperator *op)
CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
const int owner = RNA_enum_get(op->ptr, "owner");
@@ -1153,7 +1152,7 @@ static int objectsolver_clear_inverse_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
+ bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
bObjectSolverConstraint *data = (con) ? (bObjectSolverConstraint *)con->data : NULL;
if (data == NULL) {
@@ -1324,7 +1323,7 @@ static int constraint_move_down_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, 0);
+ bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->next) {
ListBase *conlist = get_constraint_lb(ob, con, NULL);
@@ -1375,7 +1374,7 @@ static int constraint_move_up_exec(bContext *C, wmOperator *op)
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- bConstraint *con = edit_constraint_property_get(&eval_ctx, op, ob, 0);
+ bConstraint *con = edit_constraint_property_get(op, ob, 0);
if (con && con->prev) {
ListBase *conlist = get_constraint_lb(ob, con, NULL);
@@ -1892,8 +1891,6 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op)
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = BKE_object_pose_armature_get(ED_object_active_context(C));
int type = RNA_enum_get(op->ptr, "type");
short with_targets = 0;
@@ -1909,7 +1906,7 @@ static int pose_constraint_add_exec(bContext *C, wmOperator *op)
if (strstr(op->idname, "with_targets"))
with_targets = 1;
- return constraint_add_exec(C, op, ob, get_active_constraints(&eval_ctx, ob), type, with_targets);
+ return constraint_add_exec(C, op, ob, get_active_constraints(ob), type, with_targets);
}
/* ------------------ */
@@ -2050,13 +2047,11 @@ static int pose_ik_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED
/* call constraint_add_exec() to add the IK constraint */
static int pose_ik_add_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = CTX_data_active_object(C);
const bool with_targets = RNA_boolean_get(op->ptr, "with_targets");
/* add the constraint - all necessary checks should have been done by the invoke() callback already... */
- return constraint_add_exec(C, op, ob, get_active_constraints(&eval_ctx, ob), CONSTRAINT_TYPE_KINEMATIC, with_targets);
+ return constraint_add_exec(C, op, ob, get_active_constraints(ob), CONSTRAINT_TYPE_KINEMATIC, with_targets);
}
void POSE_OT_ik_add(wmOperatorType *ot)
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0506225769c..9306213581e 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -274,9 +274,12 @@ bool ED_object_editmode_load(Object *obedit)
* - Only in exceptional cases should #EM_DO_UNDO NOT be in the flag.
* - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
*/
-void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene *scene, Object *obedit, int flag)
+void ED_object_editmode_exit_ex(bContext *C, Scene *scene, Object *obedit, int flag)
{
BLI_assert(C || !(flag & EM_DO_UNDO));
+ /* Note! only in exceptional cases should 'EM_DO_UNDO' NOT be in the flag */
+ /* Note! if 'EM_FREEDATA' isn't in the flag, use ED_object_editmode_load directly */
+ ViewLayer *view_layer = CTX_data_view_layer(C);
const bool freedata = (flag & EM_FREEDATA) != 0;
if (flag & EM_WAITCURSOR) waitcursor(1);
@@ -284,7 +287,9 @@ void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene *scene,
if (ED_object_editmode_load_ex(G.main, obedit, freedata) == false) {
/* in rare cases (background mode) its possible active object
* is flagged for editmode, without 'obedit' being set [#35489] */
- workspace->object_mode &= ~OB_MODE_EDIT;
+ if (UNLIKELY(view_layer->basact && (view_layer->basact->object->mode & OB_MODE_EDIT))) {
+ view_layer->basact->object->mode &= ~OB_MODE_EDIT;
+ }
if (flag & EM_WAITCURSOR) waitcursor(0);
return;
}
@@ -306,21 +311,14 @@ void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene *scene,
/* also flush ob recalc, doesn't take much overhead, but used for particles */
DEG_id_tag_update(&obedit->id, OB_RECALC_OB | OB_RECALC_DATA);
-
- workspace->object_mode &= ~OB_MODE_EDIT;
if (flag & EM_DO_UNDO)
ED_undo_push(C, "Editmode");
- if (C != NULL) {
- WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
- }
- else {
- WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
- }
- }
+ WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
- ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, obedit);
+ obedit->mode &= ~OB_MODE_EDIT;
+ }
if (flag & EM_WAITCURSOR) waitcursor(0);
@@ -330,15 +328,13 @@ void ED_object_editmode_exit_ex(bContext *C, WorkSpace *workspace, Scene *scene,
void ED_object_editmode_exit(bContext *C, int flag)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
- ED_object_editmode_exit_ex(C, workspace, scene, obedit, flag);
+ ED_object_editmode_exit_ex(C, scene, obedit, flag);
}
void ED_object_editmode_enter(bContext *C, int flag)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob;
@@ -368,14 +364,14 @@ void ED_object_editmode_enter(bContext *C, int flag)
if (flag & EM_WAITCURSOR) waitcursor(1);
- workspace->object_mode_restore = workspace->object_mode;
+ ob->restore_mode = ob->mode;
/* note, when switching scenes the object can have editmode data but
* not be scene->obedit: bug 22954, this avoids calling self eternally */
- if ((workspace->object_mode_restore & OB_MODE_EDIT) == 0)
- ED_object_mode_toggle(C, workspace->object_mode);
+ if ((ob->restore_mode & OB_MODE_EDIT) == 0)
+ ED_object_mode_toggle(C, ob->mode);
- workspace->object_mode = OB_MODE_EDIT;
+ ob->mode = OB_MODE_EDIT;
if (ob->type == OB_MESH) {
BMEditMesh *em;
@@ -446,25 +442,23 @@ void ED_object_editmode_enter(bContext *C, int flag)
DEG_id_tag_update(&scene->id, 0);
}
else {
- workspace->object_mode &= ~OB_MODE_EDIT;
+ ob->mode &= ~OB_MODE_EDIT;
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene);
}
- ED_workspace_object_mode_sync_from_object(G.main->wm.first, workspace, ob);
-
if (flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
if (flag & EM_WAITCURSOR) waitcursor(0);
}
static int editmode_toggle_exec(bContext *C, wmOperator *op)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
const int mode_flag = OB_MODE_EDIT;
const bool is_mode_set = (CTX_data_edit_object(C) != NULL);
Scene *scene = CTX_data_scene(C);
if (!is_mode_set) {
- if (!ED_object_mode_compat_set(C, workspace, mode_flag, op->reports)) {
+ Object *ob = CTX_data_active_object(C);
+ if (!ED_object_mode_compat_set(C, ob, mode_flag, op->reports)) {
return OPERATOR_CANCELLED;
}
}
@@ -487,10 +481,8 @@ static int editmode_toggle_poll(bContext *C)
if (ELEM(NULL, ob, ob->data) || ID_IS_LINKED(ob->data))
return 0;
- const WorkSpace *workspace = CTX_wm_workspace(C);
-
/* if hidden but in edit mode, we still display */
- if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(workspace->object_mode & OB_MODE_EDIT)) {
+ if ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT)) {
return 0;
}
@@ -517,15 +509,13 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
static int posemode_exec(bContext *C, wmOperator *op)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- WorkSpace *workspace = CTX_wm_workspace(C);
Base *base = CTX_data_active_base(C);
Object *ob = base->object;
const int mode_flag = OB_MODE_POSE;
- 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;
}
}
@@ -540,8 +530,6 @@ static int posemode_exec(bContext *C, wmOperator *op)
else
ED_armature_enter_posemode(C, base);
- ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
-
return OPERATOR_FINISHED;
}
@@ -1020,7 +1008,7 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLaye
/* ******************* force field toggle operator ***************** */
-void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object, eObjectMode object_mode)
+void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object)
{
PartDeflect *pd = object->pd;
ModifierData *md = modifiers_findByType(object, eModifierType_Surface);
@@ -1029,7 +1017,7 @@ void ED_object_check_force_modifiers(Main *bmain, Scene *scene, Object *object,
if (!md) {
if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && !ELEM(pd->forcefield, 0, PFIELD_GUIDE, PFIELD_TEXTURE)) {
if (ELEM(object->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) {
- ED_object_modifier_add(NULL, bmain, scene, object, object_mode, NULL, eModifierType_Surface);
+ ED_object_modifier_add(NULL, bmain, scene, object, NULL, eModifierType_Surface);
}
}
}
@@ -1051,8 +1039,7 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
else
ob->pd->forcefield = 0;
- const WorkSpace *workspace = CTX_wm_workspace(C);
- ED_object_check_force_modifiers(CTX_data_main(C), CTX_data_scene(C), ob, workspace->object_mode);
+ ED_object_check_force_modifiers(CTX_data_main(C), CTX_data_scene(C), ob);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1513,11 +1500,10 @@ static int object_mode_set_poll(bContext *C)
static int object_mode_set_exec(bContext *C, wmOperator *op)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
bGPdata *gpd = CTX_data_gpencil_data(C);
eObjectMode mode = RNA_enum_get(op->ptr, "mode");
- eObjectMode restore_mode = workspace->object_mode;
+ eObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
const bool toggle = RNA_boolean_get(op->ptr, "toggle");
if (gpd) {
@@ -1541,31 +1527,28 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
if (!ob || !ED_object_mode_compat_test(ob, mode))
return OPERATOR_PASS_THROUGH;
- if (workspace->object_mode != mode) {
+ if (ob->mode != mode) {
/* we should be able to remove this call, each operator calls */
- ED_object_mode_compat_set(C, workspace, mode, op->reports);
+ ED_object_mode_compat_set(C, ob, mode, op->reports);
}
/* Exit current mode if it's not the mode we're setting */
- if (mode != OB_MODE_OBJECT && (workspace->object_mode != mode || toggle)) {
+ if (mode != OB_MODE_OBJECT && (ob->mode != mode || toggle)) {
/* Enter new mode */
ED_object_mode_toggle(C, mode);
}
if (toggle) {
/* Special case for Object mode! */
- if ((mode == OB_MODE_OBJECT) &&
- (restore_mode == OB_MODE_OBJECT) &&
- (workspace->object_mode_restore != OB_MODE_OBJECT))
- {
- ED_object_mode_toggle(C, workspace->object_mode_restore);
+ if (mode == OB_MODE_OBJECT && restore_mode == OB_MODE_OBJECT && ob->restore_mode != OB_MODE_OBJECT) {
+ ED_object_mode_toggle(C, ob->restore_mode);
}
- else if (workspace->object_mode == mode) {
+ else if (ob->mode == mode) {
/* For toggling, store old mode so we know what to go back to */
- workspace->object_mode_restore = restore_mode;
+ ob->restore_mode = restore_mode;
}
- else if (!ELEM(workspace->object_mode_restore, mode, OB_MODE_OBJECT)) {
- ED_object_mode_toggle(C, workspace->object_mode_restore);
+ else if (ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
+ ED_object_mode_toggle(C, ob->restore_mode);
}
}
diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c
index c865b45889a..a076521b41d 100644
--- a/source/blender/editors/object/object_facemap_ops.c
+++ b/source/blender/editors/object/object_facemap_ops.c
@@ -175,8 +175,7 @@ static int face_map_supported_edit_mode_poll(bContext *C)
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
if (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode == OB_MODE_EDIT) {
+ if (ob->mode == OB_MODE_EDIT) {
return true;
}
}
diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c
index 8bfd94d9e59..f074a56fb86 100644
--- a/source/blender/editors/object/object_modes.c
+++ b/source/blender/editors/object/object_modes.c
@@ -121,14 +121,14 @@ bool ED_object_mode_compat_test(const Object *ob, eObjectMode mode)
*
* This is so each mode's exec function can call
*/
-bool ED_object_mode_compat_set(bContext *C, WorkSpace *workspace, eObjectMode mode, ReportList *reports)
+bool ED_object_mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
{
bool ok;
- if (!ELEM(workspace->object_mode, mode, OB_MODE_OBJECT)) {
- const char *opstring = object_mode_op_string(workspace->object_mode);
+ if (!ELEM(ob->mode, mode, OB_MODE_OBJECT)) {
+ const char *opstring = object_mode_op_string(ob->mode);
WM_operator_name_call(C, opstring, WM_OP_EXEC_REGION_WIN, NULL);
- ok = ELEM(workspace->object_mode, mode, OB_MODE_OBJECT);
+ ok = ELEM(ob->mode, mode, OB_MODE_OBJECT);
if (!ok) {
wmOperatorType *ot = WM_operatortype_find(opstring, false);
BKE_reportf(reports, RPT_ERROR, "Unable to execute '%s', error changing modes", ot->name);
@@ -176,8 +176,8 @@ void ED_object_mode_set(bContext *C, eObjectMode mode)
bool ED_object_mode_generic_enter(
struct bContext *C, eObjectMode object_mode)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode == object_mode) {
+ Object *ob = CTX_data_active_object(C);
+ if (ob->mode == object_mode) {
return true;
}
wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_mode_set", false);
@@ -186,7 +186,7 @@ bool ED_object_mode_generic_enter(
RNA_enum_set(&ptr, "mode", object_mode);
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr);
WM_operator_properties_free(&ptr);
- return (workspace->object_mode == object_mode);
+ return (ob->mode == object_mode);
}
/**
@@ -195,46 +195,46 @@ bool ED_object_mode_generic_enter(
*/
static bool ed_object_mode_generic_exit_ex(
const struct EvaluationContext *eval_ctx,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob,
+ struct Scene *scene, struct Object *ob,
bool only_test)
{
- if (eval_ctx->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
if (BKE_object_is_in_editmode(ob)) {
if (only_test) {
return true;
}
- ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA);
+ ED_object_editmode_exit_ex(NULL, scene, ob, EM_FREEDATA);
}
}
- else if (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT) {
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_VERTEX_PAINT)) {
if (only_test) {
return true;
}
- ED_object_vpaintmode_exit_ex(workspace, ob);
+ ED_object_vpaintmode_exit_ex(ob);
}
}
- else if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_WEIGHT_PAINT)) {
if (only_test) {
return true;
}
- ED_object_wpaintmode_exit_ex(workspace, ob);
+ ED_object_wpaintmode_exit_ex(ob);
}
}
- else if (eval_ctx->object_mode & OB_MODE_SCULPT) {
+ else if (ob->mode & OB_MODE_SCULPT) {
if (ob->sculpt && (ob->sculpt->mode_type == OB_MODE_SCULPT)) {
if (only_test) {
return true;
}
- ED_object_sculptmode_exit_ex(eval_ctx, workspace, scene, ob);
+ ED_object_sculptmode_exit_ex(eval_ctx, scene, ob);
}
}
else {
if (only_test) {
return false;
}
- BLI_assert((eval_ctx->object_mode & OB_MODE_ALL_MODE_DATA) == 0);
+ BLI_assert((ob->mode & OB_MODE_ALL_MODE_DATA) == 0);
}
return false;
@@ -242,88 +242,16 @@ static bool ed_object_mode_generic_exit_ex(
void ED_object_mode_generic_exit(
const struct EvaluationContext *eval_ctx,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob)
+ struct Scene *scene, struct Object *ob)
{
- ed_object_mode_generic_exit_ex(eval_ctx, workspace, scene, ob, false);
+ ed_object_mode_generic_exit_ex(eval_ctx, scene, ob, false);
}
bool ED_object_mode_generic_has_data(
const struct EvaluationContext *eval_ctx,
struct Object *ob)
{
- return ed_object_mode_generic_exit_ex(eval_ctx, NULL, NULL, ob, true);
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
-/** \name Mode Syncing Utils
- *
- * \{ */
-
-/**
- * A version of #ED_object_mode_generic_enter that checks if the object
- * has an active mode mode in another window we need to use another window first.
- */
-bool ED_object_mode_generic_enter_or_other_window(
- struct bContext *C, const wmWindow *win_compare, eObjectMode object_mode)
-{
- WorkSpace *workspace = CTX_wm_workspace(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Base *basact = view_layer->basact;
- if (basact == NULL) {
- workspace->object_mode = OB_MODE_OBJECT;
- return (workspace->object_mode == object_mode);
- }
-
- wmWindowManager *wm = CTX_wm_manager(C);
- eObjectMode object_mode_set = OB_MODE_OBJECT;
- bool use_object_mode = ED_workspace_object_mode_in_other_window(wm, win_compare, basact->object, &object_mode_set);
-
- if (use_object_mode) {
- workspace->object_mode = object_mode_set;
- return (workspace->object_mode == object_mode);
- }
- else {
- workspace->object_mode = OB_MODE_OBJECT;
- return ED_object_mode_generic_enter(C, object_mode);
- }
-}
-
-void ED_object_mode_generic_exit_or_other_window(
- const struct EvaluationContext *eval_ctx, wmWindowManager *wm,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob)
-{
- if (ob == NULL) {
- return;
- }
- bool is_active = ED_workspace_object_mode_in_other_window(wm, NULL, ob, NULL);
- if (is_active == false) {
- ED_object_mode_generic_exit(eval_ctx, workspace, scene, ob);
- }
-}
-
-/**
- * Use to find if we need to create the mode-data.
- *
- * When the mode 'exists' it means we have a windowing showing an object with this mode.
- * So it's data is already created.
- * Used to check if we need to perform mode switching.
- */
-bool ED_object_mode_generic_exists(
- wmWindowManager *wm, struct Object *ob,
- eObjectMode object_mode)
-{
- if (ob == NULL) {
- return false;
- }
- eObjectMode object_mode_test;
- if (ED_workspace_object_mode_in_other_window(wm, NULL, ob, &object_mode_test)) {
- if (object_mode == object_mode_test) {
- return true;
- }
- }
- return false;
+ return ed_object_mode_generic_exit_ex(eval_ctx, NULL, ob, true);
}
/** \} */
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 9d1792e9f16..04243660440 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -95,10 +95,7 @@ static void modifier_skin_customdata_delete(struct Object *ob);
/******************************** API ****************************/
-ModifierData *ED_object_modifier_add(
- ReportList *reports,
- Main *bmain, Scene *scene,
- Object *ob, eObjectMode object_mode, const char *name, int type)
+ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
{
ModifierData *md = NULL, *new_md = NULL;
const ModifierTypeInfo *mti = modifierType_getInfo(type);
@@ -165,7 +162,7 @@ ModifierData *ED_object_modifier_add(
/* set totlvl from existing MDISPS layer if object already had it */
multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
- if (object_mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
/* ensure that grid paint mask layer is created */
BKE_sculpt_mask_layers_ensure(ob, (MultiresModifierData *)new_md);
}
@@ -205,11 +202,9 @@ static bool object_has_modifier(const Object *ob, const ModifierData *exclude,
* If the callback ever returns true, iteration will stop and the
* function value will be true. Otherwise the function returns false.
*/
-bool ED_object_iter_other(
- const EvaluationContext *eval_ctx,
- Main *bmain, Object *orig_ob, const bool include_orig,
- bool (*callback)(const EvaluationContext *eval_ctx, Object *ob, void *callback_data),
- void *callback_data)
+bool ED_object_iter_other(Main *bmain, Object *orig_ob, const bool include_orig,
+ bool (*callback)(Object *ob, void *callback_data),
+ void *callback_data)
{
ID *ob_data_id = orig_ob->data;
int users = ob_data_id->us;
@@ -228,7 +223,7 @@ bool ED_object_iter_other(
if (((ob != orig_ob) || include_orig) &&
(ob->data == orig_ob->data))
{
- if (callback(eval_ctx, ob, callback_data))
+ if (callback(ob, callback_data))
return true;
totfound++;
@@ -236,15 +231,13 @@ bool ED_object_iter_other(
}
}
else if (include_orig) {
- return callback(eval_ctx, orig_ob, callback_data);
+ return callback(orig_ob, callback_data);
}
return false;
}
-static bool object_has_modifier_cb(
- const EvaluationContext *UNUSED(eval_ctx),
- Object *ob, void *data)
+static bool object_has_modifier_cb(Object *ob, void *data)
{
ModifierType type = *((ModifierType *)data);
@@ -254,16 +247,14 @@ static bool object_has_modifier_cb(
/* Use with ED_object_iter_other(). Sets the total number of levels
* for any multires modifiers on the object to the int pointed to by
* callback_data. */
-bool ED_object_multires_update_totlevels_cb(
- const struct EvaluationContext *eval_ctx,
- Object *ob, void *totlevel_v)
+bool ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v)
{
ModifierData *md;
int totlevel = *((char *)totlevel_v);
for (md = ob->modifiers.first; md; md = md->next) {
if (md->type == eModifierType_Multires) {
- multires_set_tot_level((MultiresModifierData *)md, totlevel, eval_ctx->object_mode);
+ multires_set_tot_level(ob, (MultiresModifierData *)md, totlevel);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
@@ -276,7 +267,7 @@ static bool object_modifier_safe_to_delete(Main *bmain, Object *ob,
ModifierType type)
{
return (!object_has_modifier(ob, exclude, type) &&
- !ED_object_iter_other(NULL, bmain, ob, false,
+ !ED_object_iter_other(bmain, ob, false,
object_has_modifier_cb, &type));
}
@@ -325,13 +316,11 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
modifier_skin_customdata_delete(ob);
}
-#if 0 /* not needed now modes are in workspace */
if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
BLI_listbase_is_empty(&ob->particlesystem))
{
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
-#endif
DEG_relations_tag_update(bmain);
@@ -424,9 +413,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *
return 1;
}
-int ED_object_modifier_convert(
- ReportList *UNUSED(reports), Main *bmain, Scene *scene,
- ViewLayer *view_layer, Object *UNUSED(ob), eObjectMode object_mode, ModifierData *md)
+int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *scene, ViewLayer *view_layer, Object *ob, ModifierData *md)
{
Object *obn;
ParticleSystem *psys;
@@ -440,7 +427,7 @@ int ED_object_modifier_convert(
int totpart = 0, totchild = 0;
if (md->type != eModifierType_ParticleSystem) return 0;
- if (object_mode & OB_MODE_PARTICLE_EDIT) return 0;
+ if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
psys = ((ParticleSystemModifierData *)md)->psys;
part = psys->part;
@@ -535,12 +522,9 @@ int ED_object_modifier_convert(
return 1;
}
-static int modifier_apply_shape(ReportList *reports, const bContext *C, Scene *scene, Object *ob, ModifierData *md)
+static int modifier_apply_shape(ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
md->scene = scene;
@@ -571,7 +555,7 @@ static int modifier_apply_shape(ReportList *reports, const bContext *C, Scene *s
return 0;
}
- dm = mesh_create_derived_for_modifier(&eval_ctx, scene, ob, md, 0);
+ dm = mesh_create_derived_for_modifier(eval_ctx, scene, ob, md, 0);
if (!dm) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled or returned error, skipping apply");
return 0;
@@ -598,12 +582,9 @@ static int modifier_apply_shape(ReportList *reports, const bContext *C, Scene *s
return 1;
}
-static int modifier_apply_obdata(ReportList *reports, const bContext *C, Scene *scene, Object *ob, ModifierData *md)
+static int modifier_apply_obdata(ReportList *reports, const EvaluationContext *eval_ctx, Scene *scene, Object *ob, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- EvaluationContext eval_ctx;
-
- CTX_data_eval_ctx(C, &eval_ctx);
md->scene = scene;
@@ -627,13 +608,13 @@ static int modifier_apply_obdata(ReportList *reports, const bContext *C, Scene *
multires_force_update(ob);
if (mmd && mmd->totlvl && mti->type == eModifierTypeType_OnlyDeform) {
- if (!multiresModifier_reshapeFromDeformMod(&eval_ctx, scene, mmd, ob, md)) {
+ if (!multiresModifier_reshapeFromDeformMod(eval_ctx, scene, mmd, ob, md)) {
BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
return 0;
}
}
else {
- dm = mesh_create_derived_for_modifier(&eval_ctx, scene, ob, md, 1);
+ dm = mesh_create_derived_for_modifier(eval_ctx, scene, ob, md, 1);
if (!dm) {
BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping apply");
return 0;
@@ -659,7 +640,7 @@ static int modifier_apply_obdata(ReportList *reports, const bContext *C, Scene *
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
- mti->deformVerts(md, &eval_ctx, ob, NULL, vertexCos, numVerts, 0);
+ mti->deformVerts(md, eval_ctx, ob, NULL, vertexCos, numVerts, 0);
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@@ -681,16 +662,17 @@ static int modifier_apply_obdata(ReportList *reports, const bContext *C, Scene *
if (psys->part->type != PART_HAIR)
continue;
- psys_apply_hair_lattice(&eval_ctx, scene, ob, psys);
+ psys_apply_hair_lattice(eval_ctx, scene, ob, psys);
}
}
return 1;
}
-int ED_object_modifier_apply(ReportList *reports, const bContext *C, Scene *scene, Object *ob, ModifierData *md, int mode)
+int ED_object_modifier_apply(
+ ReportList *reports, const EvaluationContext *eval_ctx,
+ Scene *scene, Object *ob, ModifierData *md, int mode)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
int prev_mode;
if (BKE_object_is_in_editmode(ob)) {
@@ -701,7 +683,7 @@ int ED_object_modifier_apply(ReportList *reports, const bContext *C, Scene *scen
BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
return 0;
}
- else if ((workspace->object_mode & OB_MODE_SCULPT) &&
+ else if ((ob->mode & OB_MODE_SCULPT) &&
(find_multires_modifier_before(scene, md)) &&
(modifier_isSameTopology(md) == false))
{
@@ -717,13 +699,13 @@ int ED_object_modifier_apply(ReportList *reports, const bContext *C, Scene *scen
md->mode |= eModifierMode_Realtime;
if (mode == MODIFIER_APPLY_SHAPE) {
- if (!modifier_apply_shape(reports, C, scene, ob, md)) {
+ if (!modifier_apply_shape(reports, eval_ctx, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
}
else {
- if (!modifier_apply_obdata(reports, C, scene, ob, md)) {
+ if (!modifier_apply_obdata(reports, eval_ctx, scene, ob, md)) {
md->mode = prev_mode;
return 0;
}
@@ -753,13 +735,12 @@ int ED_object_modifier_copy(ReportList *UNUSED(reports), Object *ob, ModifierDat
static int modifier_add_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
int type = RNA_enum_get(op->ptr, "type");
- if (!ED_object_modifier_add(op->reports, bmain, scene, ob, workspace->object_mode, NULL, type))
+ if (!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type))
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -896,12 +877,11 @@ ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
static int modifier_remove_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Main *bmain = CTX_data_main(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
- int mode_orig = workspace->object_mode;
+ int mode_orig = ob->mode;
if (!md || !ED_object_modifier_remove(op->reports, bmain, ob, md))
return OPERATOR_CANCELLED;
@@ -910,8 +890,8 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
/* if cloth/softbody was removed, particle mode could be cleared */
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
- if ((workspace->object_mode & OB_MODE_PARTICLE_EDIT) == 0) {
- if (view_layer->basact && view_layer->basact->object == ob) {
+ if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
+ if (ob == OBACT(view_layer)) {
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
}
}
@@ -1029,7 +1009,10 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
ModifierData *md = edit_modifier_property_get(op, ob, 0);
int apply_as = RNA_enum_get(op->ptr, "apply_as");
- if (!md || !ED_object_modifier_apply(op->reports, C, scene, ob, md, apply_as)) {
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
+
+ if (!md || !ED_object_modifier_apply(op->reports, &eval_ctx, scene, ob, md, apply_as)) {
return OPERATOR_CANCELLED;
}
@@ -1074,16 +1057,14 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
static int modifier_convert_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = ED_object_active_context(C);
ModifierData *md = edit_modifier_property_get(op, ob, 0);
-
- if (!md || !ED_object_modifier_convert(op->reports, bmain, scene, view_layer, ob, workspace->object_mode, md)) {
+
+ if (!md || !ED_object_modifier_convert(op->reports, bmain, scene, view_layer, ob, md))
return OPERATOR_CANCELLED;
- }
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1167,13 +1148,10 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
if (!mmd)
return OPERATOR_CANCELLED;
+
+ multiresModifier_del_levels(mmd, ob, 1);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
- multiresModifier_del_levels(mmd, ob, 1, eval_ctx.object_mode);
-
- ED_object_iter_other(&eval_ctx, CTX_data_main(C), ob, true,
+ ED_object_iter_other(CTX_data_main(C), ob, true,
ED_object_multires_update_totlevels_cb,
&mmd->totlvl);
@@ -1214,20 +1192,17 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
if (!mmd)
return OPERATOR_CANCELLED;
+
+ multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- multiresModifier_subdivide(mmd, ob, 0, mmd->simple, eval_ctx.object_mode);
-
- ED_object_iter_other(
- &eval_ctx, CTX_data_main(C), ob, true,
- ED_object_multires_update_totlevels_cb,
- &mmd->totlvl);
+ ED_object_iter_other(CTX_data_main(C), ob, true,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
- if (eval_ctx.mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
/* ensure that grid paint mask layer is created */
BKE_sculpt_mask_layers_ensure(ob, mmd);
}
@@ -1264,11 +1239,8 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_active_context(C), *secondob = NULL;
Scene *scene = CTX_data_scene(C);
- EvaluationContext eval_ctx;
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (!mmd)
return OPERATOR_CANCELLED;
@@ -1291,6 +1263,9 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
+
if (!multiresModifier_reshape(&eval_ctx, scene, mmd, ob, secondob)) {
BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices");
return OPERATOR_CANCELLED;
@@ -1441,9 +1416,8 @@ static int multires_base_apply_exec(bContext *C, wmOperator *op)
if (!mmd)
return OPERATOR_CANCELLED;
-
- const WorkSpace *workspace = CTX_wm_workspace(C);
- multiresModifier_base_apply(mmd, ob, workspace->object_mode);
+
+ multiresModifier_base_apply(mmd, ob);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1725,10 +1699,8 @@ static void skin_armature_bone_create(Object *skin_ob,
}
}
-static Object *modifier_skin_armature_create(const bContext *C, Scene *scene, ViewLayer *view_layer, Object *skin_ob)
+static Object *modifier_skin_armature_create(const EvaluationContext *eval_ctx, Main *bmain, Scene *scene, Object *skin_ob)
{
- Main *bmain = CTX_data_main(C);
- EvaluationContext eval_ctx;
BLI_bitmap *edges_visited;
DerivedMesh *deform_dm;
MVert *mvert;
@@ -1740,9 +1712,7 @@ static Object *modifier_skin_armature_create(const bContext *C, Scene *scene, Vi
int *emap_mem;
int v;
- CTX_data_eval_ctx(C, &eval_ctx);
-
- deform_dm = mesh_get_derived_deform(&eval_ctx, scene, skin_ob, CD_MASK_BAREMESH);
+ deform_dm = mesh_get_derived_deform(eval_ctx, scene, skin_ob, CD_MASK_BAREMESH);
mvert = deform_dm->getVertArray(deform_dm);
/* add vertex weights to original mesh */
@@ -1752,7 +1722,7 @@ static Object *modifier_skin_armature_create(const bContext *C, Scene *scene, Vi
NULL,
me->totvert);
- arm_ob = BKE_object_add(bmain, scene, view_layer, OB_ARMATURE, NULL);
+ arm_ob = BKE_object_add(bmain, scene, eval_ctx->view_layer, OB_ARMATURE, NULL);
BKE_object_transform_copy(arm_ob, skin_ob);
arm = arm_ob->data;
arm->layer = 1;
@@ -1811,7 +1781,6 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = CTX_data_active_object(C), *arm_ob;
Mesh *me = ob->data;
ModifierData *skin_md;
@@ -1822,8 +1791,11 @@ static int skin_armature_create_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
+
/* create new armature */
- arm_ob = modifier_skin_armature_create(C, scene, view_layer, ob);
+ arm_ob = modifier_skin_armature_create(&eval_ctx, bmain, scene, ob);
/* add a modifier to connect the new armature to the mesh */
arm_md = (ArmatureModifierData *)modifier_new(eModifierType_Armature);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 492eca20006..66dc17fe77d 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -286,9 +286,8 @@ void ED_operatormacros_object(void)
static int object_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_OBJECT);
+ return (!ob || ob->mode == OB_MODE_OBJECT);
}
void ED_keymap_object(wmKeyConfig *keyconf)
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 00c5fdf3cc7..3443a268ef2 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -717,8 +717,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
switch (partype) {
case PAR_CURVE: /* curve deform */
if (modifiers_isDeformedByCurve(ob) != par) {
- md = ED_object_modifier_add(
- reports, bmain, scene, ob, eval_ctx.object_mode, NULL, eModifierType_Curve);
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
if (md) {
((CurveModifierData *)md)->object = par;
}
@@ -729,8 +728,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
break;
case PAR_LATTICE: /* lattice deform */
if (modifiers_isDeformedByLattice(ob) != par) {
- md = ED_object_modifier_add(
- reports, bmain, scene, ob, eval_ctx.object_mode, NULL, eModifierType_Lattice);
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Lattice);
if (md) {
((LatticeModifierData *)md)->object = par;
}
@@ -738,8 +736,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
break;
default: /* armature deform */
if (modifiers_isDeformedByArmature(ob) != par) {
- md = ED_object_modifier_add(
- reports, bmain, scene, ob, eval_ctx.object_mode, NULL, eModifierType_Armature);
+ md = ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
if (md) {
((ArmatureModifierData *)md)->object = par;
}
@@ -1428,7 +1425,6 @@ static bool allow_make_links_data(const int type, Object *ob_src, Object *ob_dst
static int make_links_data_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Main *bmain = CTX_data_main(C);
const int type = RNA_enum_get(op->ptr, "type");
Object *ob_src;
@@ -1513,7 +1509,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
break;
case MAKE_LINKS_MODIFIERS:
- BKE_object_link_modifiers(ob_dst, ob_src, workspace->object_mode);
+ BKE_object_link_modifiers(ob_dst, ob_src);
DEG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
break;
case MAKE_LINKS_FONTS:
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 2feca9184f8..cd1300dd52e 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -123,51 +123,7 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
void ED_object_base_activate(bContext *C, Base *base)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
-
- wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *win = CTX_wm_window(C);
- WorkSpace *workspace = CTX_wm_workspace(C);
-
- eObjectMode object_mode = workspace->object_mode;
- eObjectMode object_mode_set = OB_MODE_OBJECT;
-
- if (base && ED_workspace_object_mode_in_other_window(
- wm, win, base->object,
- &object_mode_set))
- {
- /* Sync existing object mode with workspace. */
- workspace->object_mode = object_mode_set;
- view_layer->basact = base;
- }
- else {
- /* Apply the workspaces mode to the object (when possible). */
- Scene *scene = CTX_data_scene(C);
- Object *obact = base ? base->object : NULL;
- /* We don't know the previous active object in update.
- *
- * Not correct because it's possible other work-spaces use these.
- * although that's a corner case. */
- if (workspace->object_mode & OB_MODE_ALL_MODE_DATA) {
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
- FOREACH_OBJECT_BEGIN(view_layer, ob) {
- if (ob != obact) {
- if (ED_object_mode_generic_has_data(&eval_ctx, ob) &&
- ED_workspace_object_mode_in_other_window(wm, win, ob, NULL) == false)
- {
- ED_object_mode_generic_exit(&eval_ctx, workspace, scene, ob);
- }
- }
- }
- FOREACH_OBJECT_END;
- }
-
- workspace->object_mode = OB_MODE_OBJECT;
-
- view_layer->basact = base;
-
- ED_object_mode_generic_enter(C, object_mode);
- }
+ view_layer->basact = base;
if (base) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, view_layer);
@@ -183,14 +139,13 @@ static int objects_selectable_poll(bContext *C)
{
/* we don't check for linked scenes here, selection is
* still allowed then for inspection of scene */
- if (CTX_data_edit_object(C)) {
- return 0;
- }
+ Object *obact = CTX_data_active_object(C);
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode != OB_MODE_OBJECT) {
+ if (CTX_data_edit_object(C))
return 0;
- }
+ if (obact && obact->mode)
+ return 0;
+
return 1;
}
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index bd3bd8fd0a5..1f80cb5f0bc 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -49,7 +49,6 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "DNA_workspace_types.h"
#include "BKE_context.h"
#include "BKE_key.h"
@@ -226,20 +225,18 @@ static bool object_shape_key_mirror(bContext *C, Object *ob,
static int shape_key_mode_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
- return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (workspace->object_mode != OB_MODE_EDIT));
+ return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT);
}
static int shape_key_mode_exists_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
/* same as shape_key_mode_poll */
- return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && (workspace->object_mode != OB_MODE_EDIT)) &&
+ return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT) &&
/* check a keyblock exists */
(BKE_keyblock_from_object(ob) != NULL);
}
@@ -247,13 +244,12 @@ static int shape_key_mode_exists_poll(bContext *C)
static int shape_key_move_poll(bContext *C)
{
/* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
Key *key = BKE_key_from_object(ob);
return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) &&
- (workspace->object_mode != OB_MODE_EDIT) && key && key->totkey > 1);
+ ob->mode != OB_MODE_EDIT && key && key->totkey > 1);
}
static int shape_key_poll(bContext *C)
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 7ea1a04f31f..bb23f871a25 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -245,7 +245,6 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
void (*clear_func)(Object *, const bool),
const char default_ksName[])
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
const bool clear_delta = RNA_boolean_get(op->ptr, "clear_delta");
@@ -264,7 +263,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
*/
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
- if (!(workspace->object_mode & OB_MODE_WEIGHT_PAINT)) {
+ if (!(ob->mode & OB_MODE_WEIGHT_PAINT)) {
/* run provided clearing function */
clear_func(ob, clear_delta);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index eb04de5feb2..7026e8671ad 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -85,9 +85,9 @@
#include "object_intern.h"
/************************ Exported Functions **********************/
-static bool vertex_group_use_vert_sel(const Object *ob)
+static bool vertex_group_use_vert_sel(Object *ob)
{
- if (BKE_object_is_in_editmode(ob)) {
+ if (ob->mode == OB_MODE_EDIT) {
return true;
}
else if (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_PAINT_VERT_SEL) {
@@ -108,15 +108,13 @@ static Lattice *vgroup_edit_lattice(Object *ob)
bool ED_vgroup_sync_from_pose(Object *ob)
{
Object *armobj = BKE_object_pose_armature_get(ob);
- if (armobj) {
+ if (armobj && (armobj->mode & OB_MODE_POSE)) {
struct bArmature *arm = armobj->data;
- if (arm->flag & ARM_POSEMODE) {
- if (arm->act_bone) {
- int def_num = defgroup_name_index(ob, arm->act_bone->name);
- if (def_num != -1) {
- ob->actdef = def_num + 1;
- return true;
- }
+ if (arm->act_bone) {
+ int def_num = defgroup_name_index(ob, arm->act_bone->name);
+ if (def_num != -1) {
+ ob->actdef = def_num + 1;
+ return true;
}
}
}
@@ -2550,13 +2548,12 @@ static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const
return false;
}
- const WorkSpace *workspace = CTX_wm_workspace(C);
if (BKE_object_is_in_editmode_vgroup(ob)) {
return true;
}
- else if (workspace->object_mode & OB_MODE_WEIGHT_PAINT) {
+ else if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (needs_select) {
- if (BKE_object_is_in_wpaint_select_vert(ob, workspace->object_mode)) {
+ if (BKE_object_is_in_wpaint_select_vert(ob)) {
return true;
}
else {
@@ -2608,9 +2605,8 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C)
if (!(ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data)))
return 0;
- const WorkSpace *workspace = CTX_wm_workspace(C);
if (!(BKE_object_is_in_editmode_vgroup(ob) ||
- BKE_object_is_in_wpaint_select_vert(ob, workspace->object_mode)))
+ BKE_object_is_in_wpaint_select_vert(ob)))
{
return 0;
}
@@ -2636,9 +2632,8 @@ static int vertex_group_vert_select_mesh_poll(bContext *C)
if (ob->type != OB_MESH)
return 0;
- const WorkSpace *workspace = CTX_wm_workspace(C);
return (BKE_object_is_in_editmode_vgroup(ob) ||
- BKE_object_is_in_wpaint_select_vert(ob, workspace->object_mode));
+ BKE_object_is_in_wpaint_select_vert(ob));
}
static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3522,8 +3517,7 @@ static char *vgroup_init_remap(Object *ob)
return name_array;
}
-static int vgroup_do_remap(
- const EvaluationContext *eval_ctx, Object *ob, const char *name_array, wmOperator *op)
+static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op)
{
MDeformVert *dvert = NULL;
bDeformGroup *def;
@@ -3544,7 +3538,7 @@ static int vgroup_do_remap(
BLI_assert(sort_map[i] != -1);
}
- if (eval_ctx->object_mode == OB_MODE_EDIT) {
+ if (ob->mode == OB_MODE_EDIT) {
if (ob->type == OB_MESH) {
BMEditMesh *em = BKE_editmesh_from_object(ob);
const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT);
@@ -3642,8 +3636,6 @@ enum {
static int vertex_group_sort_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_context(C);
char *name_array;
int ret;
@@ -3663,7 +3655,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
}
/*remap vgroup data to map to correct names*/
- ret = vgroup_do_remap(&eval_ctx, ob, name_array, op);
+ ret = vgroup_do_remap(ob, name_array, op);
if (ret != OPERATOR_CANCELLED) {
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -3699,8 +3691,6 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
static int vgroup_move_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_context(C);
bDeformGroup *def;
char *name_array;
@@ -3715,7 +3705,7 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
name_array = vgroup_init_remap(ob);
if (BLI_listbase_link_move(&ob->defbase, def, dir)) {
- ret = vgroup_do_remap(&eval_ctx, ob, name_array, op);
+ ret = vgroup_do_remap(ob, name_array, op);
if (ret != OPERATOR_CANCELLED) {
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);