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
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')
-rw-r--r--source/blender/editors/animation/keyframing.c13
-rw-r--r--source/blender/editors/armature/armature_relations.c5
-rw-r--r--source/blender/editors/armature/armature_skinning.c14
-rw-r--r--source/blender/editors/armature/meshlaplacian.c3
-rw-r--r--source/blender/editors/armature/meshlaplacian.h1
-rw-r--r--source/blender/editors/armature/pose_edit.c12
-rw-r--r--source/blender/editors/armature/pose_select.c14
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c4
-rw-r--r--source/blender/editors/include/ED_armature.h3
-rw-r--r--source/blender/editors/include/ED_image.h6
-rw-r--r--source/blender/editors/include/ED_info.h5
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/include/ED_object.h59
-rw-r--r--source/blender/editors/include/ED_screen.h6
-rw-r--r--source/blender/editors/include/ED_uvedit.h2
-rw-r--r--source/blender/editors/interface/interface_handlers.c10
-rw-r--r--source/blender/editors/interface/interface_icons.c7
-rw-r--r--source/blender/editors/interface/interface_templates.c14
-rw-r--r--source/blender/editors/mesh/editmesh_select.c4
-rw-r--r--source/blender/editors/mesh/mesh_data.c11
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c8
-rw-r--r--source/blender/editors/mesh/meshtools.c49
-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
-rw-r--r--source/blender/editors/physics/particle_edit.c26
-rw-r--r--source/blender/editors/physics/particle_object.c8
-rw-r--r--source/blender/editors/render/render_shading.c6
-rw-r--r--source/blender/editors/render/render_update.c28
-rw-r--r--source/blender/editors/scene/scene_edit.c21
-rw-r--r--source/blender/editors/screen/screen_context.c16
-rw-r--r--source/blender/editors/screen/screen_ops.c63
-rw-r--r--source/blender/editors/screen/workspace_edit.c130
-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
-rw-r--r--source/blender/editors/space_buttons/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c5
-rw-r--r--source/blender/editors/space_image/image_edit.c16
-rw-r--r--source/blender/editors/space_image/image_ops.c6
-rw-r--r--source/blender/editors/space_image/space_image.c7
-rw-r--r--source/blender/editors/space_info/info_stats.c27
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c19
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c401
-rw-r--r--source/blender/editors/space_time/space_time.c3
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c44
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c18
-rw-r--r--source/blender/editors/space_view3d/drawobject.c220
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c16
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c37
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c32
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c37
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h25
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c133
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c12
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_conversions.c20
-rw-r--r--source/blender/editors/transform/transform_generics.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator.c28
-rw-r--r--source/blender/editors/transform/transform_orientations.c14
-rw-r--r--source/blender/editors/transform/transform_snap.c2
-rw-r--r--source/blender/editors/transform/transform_snap_object.c6
-rw-r--r--source/blender/editors/undo/memfile_undo.c54
-rw-r--r--source/blender/editors/util/ed_util.c50
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c8
91 files changed, 957 insertions, 1647 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 4ed5c49c1e3..126e4b5f736 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1579,9 +1579,6 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
bool changed = false;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
@@ -1598,7 +1595,7 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op))
fcn = fcu->next;
/* in pose mode, only delete the F-Curve if it belongs to a selected bone */
- if (eval_ctx.object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones[")) {
bPoseChannel *pchan;
char *bone_name;
@@ -1661,10 +1658,8 @@ void ANIM_OT_keyframe_clear_v3d(wmOperatorType *ot)
static int delete_key_v3d_exec(bContext *C, wmOperator *op)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
- const float cfra = eval_ctx.ctime;
+ Scene *scene = CTX_data_scene(C);
+ float cfra = (float)CFRA;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
@@ -1692,7 +1687,7 @@ static int delete_key_v3d_exec(bContext *C, wmOperator *op)
/* special exception for bones, as this makes this operator more convenient to use
* NOTE: This is only done in pose mode. In object mode, we're dealign with the entire object.
*/
- if ((eval_ctx.object_mode & OB_MODE_POSE) && strstr(fcu->rna_path, "pose.bones[\"")) {
+ if ((ob->mode & OB_MODE_POSE) && strstr(fcu->rna_path, "pose.bones[\"")) {
bPoseChannel *pchan;
char *bone_name;
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index 8fc7aeaf029..de2611f7092 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -281,6 +281,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
/* get pose of active object and move it out of posemode */
pose = ob->pose;
+ ob->mode &= ~OB_MODE_POSE;
CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
{
@@ -301,6 +302,8 @@ int join_armature_exec(bContext *C, wmOperator *op)
/* Get Pose of current armature */
opose = base->object->pose;
+ base->object->mode &= ~OB_MODE_POSE;
+ //BASACT->flag &= ~OB_MODE_POSE;
/* Find the difference matrix */
invert_m4_m4(oimat, ob->obmat);
@@ -605,6 +608,8 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
/* 1) store starting settings and exit editmode */
oldob = obedit;
oldbase = view_layer->basact;
+ oldob->mode &= ~OB_MODE_POSE;
+ //oldbase->flag &= ~OB_POSEMODE;
ED_armature_from_edit(obedit->data);
ED_armature_edit_free(obedit->data);
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 8900da900c0..5c8e08a0d89 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -192,7 +192,6 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
}
static void envelope_bone_weighting(
- const EvaluationContext *eval_ctx,
Object *ob, Mesh *mesh, float (*verts)[3], int numbones, Bone **bonelist,
bDeformGroup **dgrouplist, bDeformGroup **dgroupflip,
float (*root)[3], float (*tip)[3], const int *selected, float scale)
@@ -206,7 +205,7 @@ static void envelope_bone_weighting(
bool use_topology = (mesh->editflag & ME_EDIT_MIRROR_TOPO) != 0;
bool use_mask = false;
- if ((eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) &&
+ if ((ob->mode & OB_MODE_WEIGHT_PAINT) &&
(mesh->editflag & (ME_EDIT_PAINT_FACE_SEL | ME_EDIT_PAINT_VERT_SEL)))
{
use_mask = true;
@@ -277,12 +276,13 @@ static void add_verts_to_dgroups(
float (*root)[3], (*tip)[3], (*verts)[3];
int *selected;
int numbones, vertsfilled = 0, i, j, segments = 0;
+ const bool wpmode = (ob->mode & OB_MODE_WEIGHT_PAINT);
struct { Object *armob; void *list; int heat; bool is_weight_paint; } looper_data;
looper_data.armob = par;
looper_data.heat = heat;
looper_data.list = NULL;
- looper_data.is_weight_paint = (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT);
+ looper_data.is_weight_paint = wpmode;
/* count the number of skinnable bones */
numbones = bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb);
@@ -355,7 +355,7 @@ static void add_verts_to_dgroups(
mul_m4_v3(par->obmat, tip[j]);
/* set selected */
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (wpmode) {
if ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED))
selected[j] = 1;
}
@@ -375,7 +375,7 @@ static void add_verts_to_dgroups(
mesh = (Mesh *)ob->data;
verts = MEM_callocN(mesh->totvert * sizeof(*verts), "closestboneverts");
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (wpmode) {
/* if in weight paint mode, use final verts from derivedmesh */
DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, CD_MASK_BAREMESH);
@@ -406,7 +406,7 @@ static void add_verts_to_dgroups(
const char *error = NULL;
heat_bone_weighting(
- eval_ctx, ob, mesh, verts, numbones, dgrouplist, dgroupflip,
+ ob, mesh, verts, numbones, dgrouplist, dgroupflip,
root, tip, selected, &error);
if (error) {
BKE_report(reports, RPT_WARNING, error);
@@ -414,7 +414,7 @@ static void add_verts_to_dgroups(
}
else {
envelope_bone_weighting(
- eval_ctx, ob, mesh, verts, numbones, bonelist, dgrouplist,
+ ob, mesh, verts, numbones, bonelist, dgrouplist,
dgroupflip, root, tip, selected, mat4_to_scale(par->obmat));
}
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index d53350ab3cb..489940007e4 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -603,7 +603,6 @@ static float heat_limit_weight(float weight)
}
void heat_bone_weighting(
- const EvaluationContext *eval_ctx,
Object *ob, Mesh *me, float (*verts)[3], int numsource,
bDeformGroup **dgrouplist, bDeformGroup **dgroupflip,
float (*root)[3], float (*tip)[3], int *selected, const char **err_str)
@@ -627,7 +626,7 @@ void heat_bone_weighting(
tottri = poly_to_tri_count(me->totpoly, me->totloop);
/* count triangles and create mask */
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT &&
+ if (ob->mode & OB_MODE_WEIGHT_PAINT &&
(use_face_sel || use_vert_sel))
{
mask = MEM_callocN(sizeof(int) * me->totvert, "heat_bone_weighting mask");
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index c790c2fbee7..05ade4fc43e 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -53,7 +53,6 @@ float laplacian_system_get_solution(LaplacianSystem *sys, int v);
/* Heat Weighting */
void heat_bone_weighting(
- const struct EvaluationContext *eval_ctx,
struct Object *ob, struct Mesh *me, float (*verts)[3],
int numbones, struct bDeformGroup **dgrouplist,
struct bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3],
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index 3f2cf6f5853..15ffd09ebd4 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -94,16 +94,13 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
switch (ob->type) {
case OB_ARMATURE:
- {
- WorkSpace *workspace = CTX_wm_workspace(C);
- workspace->object_mode_restore = workspace->object_mode;
- workspace->object_mode |= OB_MODE_POSE;
+ ob->restore_mode = ob->mode;
+ ob->mode |= OB_MODE_POSE;
/* Inform all CoW versions that we changed the mode. */
DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
break;
- }
default:
return;
}
@@ -115,11 +112,10 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
void ED_armature_exit_posemode(bContext *C, Base *base)
{
if (base) {
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = base->object;
- workspace->object_mode_restore = workspace->object_mode;
- workspace->object_mode &= ~OB_MODE_POSE;
+ ob->restore_mode = ob->mode;
+ ob->mode &= ~OB_MODE_POSE;
/* Inform all CoW versions that we changed the mode. */
DEG_id_tag_update_ex(CTX_data_main(C), &ob->id, DEG_TAG_COPY_ON_WRITE);
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 04e453c44c6..a66cedd8d4f 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -134,7 +134,6 @@ void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select)
/* called from editview.c, for mode-less pose selection */
/* assumes scene obact and basact is still on old situation */
bool ED_do_pose_selectbuffer(
- const EvaluationContext *eval_ctx,
ViewLayer *view_layer, Base *base, const unsigned int *buffer, short hits,
bool extend, bool deselect, bool toggle, bool do_nearest)
{
@@ -144,7 +143,7 @@ bool ED_do_pose_selectbuffer(
if (!ob || !ob->pose) return 0;
Object *ob_act = OBACT(view_layer);
- Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
nearBone = get_bone_from_selectbuffer(base, obedit, buffer, hits, 1, do_nearest);
@@ -157,7 +156,7 @@ bool ED_do_pose_selectbuffer(
* note, special exception for armature mode so we can do multi-select
* we could check for multi-select explicitly but think its fine to
* always give predictable behavior in weight paint mode - campbell */
- if ((ob_act == NULL) || ((ob_act != ob) && (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) == 0)) {
+ if ((ob_act == NULL) || ((ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT) == 0)) {
/* when we are entering into posemode via toggle-select,
* from another active object - always select the bone. */
if (!extend && !deselect && toggle) {
@@ -198,7 +197,7 @@ bool ED_do_pose_selectbuffer(
if (ob_act) {
/* in weightpaint we select the associated vertex group too */
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
if (nearBone == arm->act_bone) {
ED_vgroup_select_by_name(ob_act, nearBone->name);
DEG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
@@ -876,7 +875,6 @@ void POSE_OT_select_grouped(wmOperatorType *ot)
*/
static int pose_select_mirror_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob_act = CTX_data_active_object(C);
Object *ob = BKE_object_pose_armature_get(ob_act);
bArmature *arm;
@@ -884,6 +882,10 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
const bool active_only = RNA_boolean_get(op->ptr, "only_active");
const bool extend = RNA_boolean_get(op->ptr, "extend");
+ if ((ob && (ob->mode & OB_MODE_POSE)) == 0) {
+ return OPERATOR_CANCELLED;
+ }
+
arm = ob->data;
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -920,7 +922,7 @@ static int pose_select_mirror_exec(bContext *C, wmOperator *op)
arm->act_bone = pchan_mirror_act->bone;
/* in weightpaint we select the associated vertex group too */
- if (workspace->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
ED_vgroup_select_by_name(ob_act, pchan_mirror_act->name);
DEG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
}
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index 8d45c6af686..2c3c9f4f9b9 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1294,7 +1294,7 @@ static int gp_convert_poll(bContext *C)
bGPDframe *gpf = NULL;
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
- const WorkSpace *workspace = CTX_wm_workspace(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
/* only if the current view is 3D View, if there's valid data (i.e. at least one stroke!),
* and if we are not in edit mode!
@@ -1303,7 +1303,7 @@ static int gp_convert_poll(bContext *C)
(gpl = BKE_gpencil_layer_getactive(gpd)) &&
(gpf = BKE_gpencil_layer_getframe(gpl, CFRA, 0)) &&
(gpf->strokes.first) &&
- ((workspace->object_mode & OB_MODE_EDIT) == 0));
+ (OBEDIT_FROM_VIEW_LAYER(view_layer) == NULL));
}
static int gp_convert_layer_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 0b1fb57af94..0181cc20cdc 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -143,7 +143,6 @@ void ED_armature_deselect_all(struct Object *obedit);
void ED_armature_deselect_all_visible(struct Object *obedit);
bool ED_do_pose_selectbuffer(
- const struct EvaluationContext *eval_ctx,
struct ViewLayer *view_layer, struct Base *base, const unsigned int *buffer, short hits,
bool extend, bool deselect, bool toggle, bool do_nearest);
bool ED_armature_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
@@ -190,8 +189,6 @@ void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone);
void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);
void ED_armature_bones_flip_names(struct bArmature *arm, struct ListBase *bones_names, const bool do_strip_numbers);
-void undo_push_armature(struct bContext *C, const char *name);
-
/* low level selection functions which handle */
int ED_armature_ebone_selectflag_get(const EditBone *ebone);
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag);
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 9802f8c3c03..cb824b3c9b7 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -40,7 +40,6 @@ struct wmWindowManager;
struct ARegion;
struct Scene;
struct ViewLayer;
-struct WorkSpace;
/* image_edit.c, exported for transform */
struct Image *ED_space_image(struct SpaceImage *sima);
@@ -76,10 +75,7 @@ bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
bool ED_space_image_paint_curve(const struct bContext *C);
-bool ED_space_image_check_show_maskedit(
- struct SpaceImage *sima,
- const struct WorkSpace *workspace,
- struct ViewLayer *view_layer);
+bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer);
int ED_space_image_maskedit_poll(struct bContext *C);
int ED_space_image_maskedit_mask_poll(struct bContext *C);
diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h
index 3d873906ecf..072b1a135a3 100644
--- a/source/blender/editors/include/ED_info.h
+++ b/source/blender/editors/include/ED_info.h
@@ -27,11 +27,8 @@
#ifndef __ED_INFO_H__
#define __ED_INFO_H__
-struct EvaluationContext;
-
/* info_stats.c */
void ED_info_stats_clear(struct ViewLayer *view_layer);
-const char *ED_info_stats_string(
- struct Scene *scene, struct WorkSpace *workspace, struct ViewLayer *view_layer);
+const char *ED_info_stats_string(struct Scene *scene, struct ViewLayer *view_layer);
#endif /* __ED_INFO_H__ */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index b9723e3865e..3217433204e 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -36,7 +36,6 @@ extern "C" {
#endif
struct ID;
-struct EvaluationContext;
struct View3D;
struct ARegion;
struct bContext;
@@ -267,7 +266,6 @@ void ED_vgroup_vert_remove(struct Object *ob, struct bDeformGrou
float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
void ED_vgroup_vert_active_mirror(struct Object *ob, int def_nr);
-
/* mesh_data.c */
// void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 95adea7fbe2..ebd9313f7c5 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -52,13 +52,12 @@ struct wmKeyConfig;
struct wmKeyMap;
struct wmOperator;
struct wmOperatorType;
+struct wmWindow;
+struct wmWindowManager;
struct PointerRNA;
struct PropertyRNA;
struct EnumPropertyItem;
struct EvaluationContext;
-struct WorkSpace;
-struct wmWindow;
-struct wmWindowManager;
#include "DNA_object_enums.h"
@@ -126,7 +125,7 @@ void ED_object_parent(struct Object *ob, struct Object *parent, const int type,
#define EM_DO_UNDO 8
#define EM_IGNORE_LAYER 16
void ED_object_editmode_exit_ex(
- struct bContext *C, struct WorkSpace *workspace, struct Scene *scene, struct Object *obedit, int flag);
+ struct bContext *C, struct Scene *scene, struct Object *obedit, int flag);
void ED_object_editmode_exit(struct bContext *C, int flag);
void ED_object_editmode_enter(struct bContext *C, int flag);
bool ED_object_editmode_load(struct Object *obedit);
@@ -136,26 +135,26 @@ bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool sel
void ED_object_vpaintmode_enter_ex(
const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
+ struct Scene *scene, struct Object *ob);
void ED_object_vpaintmode_enter(struct bContext *C);
void ED_object_wpaintmode_enter_ex(
const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
+ struct Scene *scene, struct Object *ob);
void ED_object_wpaintmode_enter(struct bContext *C);
-void ED_object_vpaintmode_exit_ex(struct WorkSpace *workspace, struct Object *ob);
+void ED_object_vpaintmode_exit_ex(struct Object *ob);
void ED_object_vpaintmode_exit(struct bContext *C);
-void ED_object_wpaintmode_exit_ex(struct WorkSpace *workspace, struct Object *ob);
+void ED_object_wpaintmode_exit_ex(struct Object *ob);
void ED_object_wpaintmode_exit(struct bContext *C);
void ED_object_sculptmode_enter_ex(
const struct EvaluationContext *eval_ctx,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob,
+ struct Scene *scene, struct Object *ob,
struct ReportList *reports);
void ED_object_sculptmode_enter(struct bContext *C, struct ReportList *reports);
void ED_object_sculptmode_exit_ex(
const struct EvaluationContext *eval_ctx,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
+ struct Scene *scene, struct Object *ob);
void ED_object_sculptmode_exit(struct bContext *C);
void ED_object_location_from_view(struct bContext *C, float loc[3]);
@@ -190,9 +189,9 @@ void ED_objects_clear_paths(struct bContext *C, bool only_selected);
void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene);
/* constraints */
-struct ListBase *get_active_constraints(const struct EvaluationContext *eval_ctx, struct Object *ob);
+struct ListBase *get_active_constraints(struct Object *ob);
struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, struct bPoseChannel **r_pchan);
-struct bConstraint *get_active_constraint(const struct EvaluationContext *eval_ctx, struct Object *ob);
+struct bConstraint *get_active_constraint(struct Object *ob);
void object_test_constraints(struct Object *ob);
@@ -205,7 +204,7 @@ void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Objec
/* object_modes.c */
bool ED_object_mode_compat_test(const struct Object *ob, eObjectMode mode);
-bool ED_object_mode_compat_set(struct bContext *C, struct WorkSpace *workspace, eObjectMode mode, struct ReportList *reports);
+bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, eObjectMode mode, struct ReportList *reports);
void ED_object_mode_toggle(struct bContext *C, eObjectMode mode);
void ED_object_mode_set(struct bContext *C, eObjectMode mode);
@@ -214,18 +213,11 @@ bool ED_object_mode_generic_enter(
eObjectMode object_mode);
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);
bool ED_object_mode_generic_has_data(
const struct EvaluationContext *eval_ctx,
struct Object *ob);
-bool ED_object_mode_generic_enter_or_other_window(
- struct bContext *C, const struct wmWindow *win_compare,
- eObjectMode object_mode);
-void ED_object_mode_generic_exit_or_other_window(
- const struct EvaluationContext *eval_ctx, struct wmWindowManager *wm,
- struct WorkSpace *workspace, struct Scene *scene, struct Object *ob);
-
bool ED_object_mode_generic_exists(
struct wmWindowManager *wm, struct Object *ob,
eObjectMode object_mode);
@@ -236,30 +228,25 @@ enum {
MODIFIER_APPLY_SHAPE
};
-struct ModifierData *ED_object_modifier_add(
- struct ReportList *reports, struct Main *bmain, struct Scene *scene,
- struct Object *ob, eObjectMode object_mode, const char *name, int type);
+struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
+ struct Object *ob, const char *name, int type);
bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain,
struct Object *ob, struct ModifierData *md);
void ED_object_modifier_clear(struct Main *bmain, struct Object *ob);
int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
-int ED_object_modifier_convert(
- struct ReportList *reports, struct Main *bmain, struct Scene *scene,
- struct ViewLayer *view_layer, struct Object *ob, eObjectMode object_mode, struct ModifierData *md);
-int ED_object_modifier_apply(struct ReportList *reports, const struct bContext *C, struct Scene *scene,
+int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
+ struct ViewLayer *view_layer, struct Object *ob, struct ModifierData *md);
+int ED_object_modifier_apply(struct ReportList *reports, const struct EvaluationContext *eval_ctx, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
bool ED_object_iter_other(
- const struct EvaluationContext *eval_ctx, struct Main *bmain,
- struct Object *orig_ob, const bool include_orig,
- bool (*callback)(const struct EvaluationContext *eval_ctx, struct Object *ob, void *callback_data),
+ struct Main *bmain, struct Object *orig_ob, const bool include_orig,
+ bool (*callback)(struct Object *ob, void *callback_data),
void *callback_data);
-bool ED_object_multires_update_totlevels_cb(
- const struct EvaluationContext *eval_ctx,
- struct Object *ob, void *totlevel_v);
+bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
/* object_select.c */
void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
@@ -271,9 +258,7 @@ const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(
bool *r_free,
const unsigned int selection_mask);
-void ED_object_check_force_modifiers(
- struct Main *bmain, struct Scene *scene,
- struct Object *object, eObjectMode object_mode);
+void ED_object_check_force_modifiers(struct Main *bmain, struct Scene *scene, struct Object *object);
/* object_facemap_ops.c */
void ED_object_facemap_face_add(struct Object *ob, struct bFaceMap *fmap, int facenum);
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 1f78a5292a7..4720eb05367 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -162,7 +162,7 @@ struct WorkSpace *ED_workspace_add(
bool ED_workspace_change(
struct WorkSpace *workspace_new,
struct bContext *C,
- struct wmWindow *win) ATTR_NONNULL();
+ struct wmWindowManager *wm, struct wmWindow *win) ATTR_NONNULL();
struct WorkSpace *ED_workspace_duplicate(
struct WorkSpace *workspace_old,
struct Main *bmain, struct wmWindow *win);
@@ -194,10 +194,6 @@ void ED_workspace_object_mode_sync_from_object(
void ED_workspace_object_mode_sync_from_scene(
struct wmWindowManager *wm, WorkSpace *workspace, struct Scene *scene);
-bool ED_workspace_object_mode_in_other_window(
- struct wmWindowManager *wm, const struct wmWindow *win_compare, struct Object *obact,
- eObjectMode *r_object_mode);
-
/* anim */
void ED_update_for_newframe(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Depsgraph *depsgraph);
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 15de57da09c..2a5ad494643 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -131,7 +131,7 @@ void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel)
void ED_image_draw_cursor(
struct ARegion *ar, const float cursor[2]);
void ED_uvedit_draw_main(
- struct SpaceImage *sima, const struct EvaluationContext *eval_ctx,
+ struct SpaceImage *sima,
struct ARegion *ar, struct Scene *scene, struct ViewLayer *view_layer,
struct Object *obedit, struct Object *obact, struct Depsgraph *depsgraph);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e01121ed277..b95bf466186 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -46,7 +46,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
@@ -74,8 +73,6 @@
#include "BKE_unit.h"
#include "BKE_paint.h"
-#include "DEG_depsgraph.h"
-
#include "ED_screen.h"
#include "ED_undo.h"
#include "ED_keyframing.h"
@@ -5234,10 +5231,9 @@ static int ui_do_but_COLOR(
if ((int)(but->a1) == UI_PALETTE_COLOR) {
if (!event->ctrl) {
float color[3];
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- Paint *paint = BKE_paint_get_active(scene, view_layer, workspace->object_mode);
+ Paint *paint = BKE_paint_get_active(scene, view_layer);
Brush *brush = BKE_paint_brush(paint);
if (brush->flag & BRUSH_USE_GRADIENT) {
@@ -6153,7 +6149,6 @@ static int ui_do_but_CURVE(
{
int mx, my, a;
bool changed = false;
-
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -6270,7 +6265,6 @@ static int ui_do_but_CURVE(
}
else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
if (data->dragsel != -1) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
CurveMapping *cumap = (CurveMapping *)but->poin;
CurveMap *cuma = cumap->cm + cumap->cur;
CurveMapPoint *cmp = cuma->curve;
@@ -6285,7 +6279,7 @@ static int ui_do_but_CURVE(
}
else {
curvemapping_changed(cumap, true); /* remove doubles */
- BKE_paint_invalidate_cursor_overlay(scene, view_layer, cumap, workspace->object_mode);
+ BKE_paint_invalidate_cursor_overlay(scene, view_layer, cumap);
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index bcc6c40a9e7..9fbb5efdcf3 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1289,7 +1289,6 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
ui_id_icon_render(C, id, true);
}
else {
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = CTX_data_active_object(C);
SpaceImage *sima;
const EnumPropertyItem *items = NULL;
@@ -1300,11 +1299,11 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
* checking various context stuff here */
if (CTX_wm_view3d(C) && ob) {
- if (workspace->object_mode & OB_MODE_SCULPT)
+ if (ob->mode & OB_MODE_SCULPT)
mode = OB_MODE_SCULPT;
- else if (workspace->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
+ else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
mode = OB_MODE_VERTEX_PAINT;
- else if (workspace->object_mode & OB_MODE_TEXTURE_PAINT)
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT)
mode = OB_MODE_TEXTURE_PAINT;
}
else if ((sima = CTX_wm_space_image(C)) &&
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index af14c57fade..375027a84d0 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -575,9 +575,6 @@ static void template_ID(
bContext *C, uiLayout *layout, TemplateID *template_ui, StructRNA *type, int flag,
const char *newop, const char *openop, const char *unlinkop)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
uiBut *but;
uiBlock *block;
PointerRNA idptr;
@@ -662,7 +659,7 @@ static void template_ID(
(idfrom && idfrom->lib) ||
(!editable) ||
/* object in editmode - don't change data */
- (idfrom && GS(idfrom->name) == ID_OB && (eval_ctx.object_mode & OB_MODE_EDIT)))
+ (idfrom && GS(idfrom->name) == ID_OB && (((Object *)idfrom)->mode & OB_MODE_EDIT)))
{
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
@@ -1210,8 +1207,7 @@ static int modifier_is_simulation(ModifierData *md)
}
static uiLayout *draw_modifier(
- uiLayout *layout,
- const EvaluationContext *eval_ctx, Scene *scene, Object *ob,
+ uiLayout *layout, Scene *scene, Object *ob,
ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@@ -1348,7 +1344,7 @@ static uiLayout *draw_modifier(
if (md->type == eModifierType_ParticleSystem) {
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
- if (!(eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
uiItemO(row, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert"), ICON_NONE,
"OBJECT_OT_duplicates_make_real");
@@ -1397,8 +1393,6 @@ static uiLayout *draw_modifier(
uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob;
ModifierData *md, *vmd;
@@ -1429,7 +1423,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
for (i = 0; vmd; i++, vmd = vmd->next) {
if (md == vmd)
- return draw_modifier(layout, &eval_ctx, scene, ob, md, i, cageIndex, lastCageIndex);
+ return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex);
else if (vmd->mode & eModifierMode_Virtual)
i--;
}
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 40a64435cf3..87937fd4146 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -295,7 +295,7 @@ bool EDBM_backbuf_border_mask_init(const struct EvaluationContext *eval_ctx, Vie
/* method in use for face selecting too */
if (vc->obedit == NULL) {
- if (!BKE_paint_select_elem_test(vc->obact, eval_ctx->object_mode)) {
+ if (!BKE_paint_select_elem_test(vc->obact)) {
return false;
}
}
@@ -347,7 +347,7 @@ bool EDBM_backbuf_circle_init(
/* method in use for face selecting too */
if (vc->obedit == NULL) {
- if (!BKE_paint_select_elem_test(vc->obact, eval_ctx->object_mode)) {
+ if (!BKE_paint_select_elem_test(vc->obact)) {
return false;
}
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index aca67dc84e9..69e265f7315 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -506,14 +506,13 @@ static int layers_poll(bContext *C)
static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
if (ED_mesh_uv_texture_add(me, NULL, true) == -1)
return OPERATOR_CANCELLED;
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
Scene *scene = CTX_data_scene(C);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
@@ -623,14 +622,13 @@ void MESH_OT_drop_named_image(wmOperatorType *ot)
static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
Mesh *me = ob->data;
if (!ED_mesh_uv_texture_remove_active(me))
return OPERATOR_CANCELLED;
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
Scene *scene = CTX_data_scene(C);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
@@ -744,14 +742,13 @@ static int mesh_customdata_mask_clear_poll(bContext *C)
{
Object *ob = ED_object_context(C);
if (ob && ob->type == OB_MESH) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
+ Mesh *me = ob->data;
/* special case - can't run this if we're in sculpt mode */
- if (workspace->object_mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
return false;
}
- Mesh *me = ob->data;
if (!ID_IS_LINKED(me)) {
CustomData *data = GET_CD_DATA(me, vdata);
if (CustomData_has_layer(data, CD_PAINT_MASK)) {
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index aaa06951ec6..bd2ad21d51c 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -662,10 +662,8 @@ void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
static int navmesh_obmode_data_poll(bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- if (ob && (eval_ctx.object_mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
+ if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
Mesh *me = ob->data;
return CustomData_has_layer(&me->pdata, CD_RECAST);
}
@@ -674,10 +672,8 @@ static int navmesh_obmode_data_poll(bContext *C)
static int navmesh_obmode_poll(bContext *C)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *ob = ED_object_active_context(C);
- if (ob && (eval_ctx.object_mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
+ if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
return true;
}
return false;
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index fd5beac9cc6..531a26a66a8 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -79,7 +79,7 @@
* return 0 if no join is made (error) and 1 if the join is done */
static void join_mesh_single(
- bContext *C, Main *bmain, Scene *scene,
+ const EvaluationContext *eval_ctx, Main *bmain, Scene *scene,
Object *ob_dst, Object *ob_src, float imat[4][4],
MVert **mvert_pp, MEdge **medge_pp, MLoop **mloop_pp, MPoly **mpoly_pp,
CustomData *vdata, CustomData *edata, CustomData *ldata, CustomData *pdata,
@@ -88,7 +88,6 @@ static void join_mesh_single(
Material **matar, int *matmap, int totcol,
int *vertofs, int *edgeofs, int *loopofs, int *polyofs)
{
- EvaluationContext eval_ctx;
int a, b;
Mesh *me = ob_src->data;
@@ -97,8 +96,6 @@ static void join_mesh_single(
MLoop *mloop = *mloop_pp;
MPoly *mpoly = *mpoly_pp;
- CTX_data_eval_ctx(C, &eval_ctx);
-
if (me->totvert) {
/* merge customdata flag */
((Mesh *)ob_dst->data)->cd_flag |= me->cd_flag;
@@ -210,13 +207,12 @@ static void join_mesh_single(
if (ob_src != ob_dst) {
MultiresModifierData *mmd;
- multiresModifier_prepare_join(&eval_ctx, scene, ob_src, ob_dst);
+ multiresModifier_prepare_join(eval_ctx, scene, ob_src, ob_dst);
if ((mmd = get_multires_modifier(scene, ob_src, true))) {
- ED_object_iter_other(
- &eval_ctx, bmain, ob_src, true,
- ED_object_multires_update_totlevels_cb,
- &mmd->totlvl);
+ ED_object_iter_other(bmain, ob_src, true,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
}
}
@@ -266,7 +262,6 @@ static void join_mesh_single(
int join_mesh_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 = CTX_data_active_object(C);
@@ -286,7 +281,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
bDeformGroup *dg, *odg;
CustomData vdata, edata, fdata, ldata, pdata;
- if (workspace->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode");
return OPERATOR_CANCELLED;
}
@@ -296,7 +291,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh");
return OPERATOR_CANCELLED;
}
-
+
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
+
/* count & check */
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
@@ -491,7 +489,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* active mesh will remain first ones in new result of the merge, in same order for CD layers, etc. See also T50084.
*/
join_mesh_single(
- C, bmain, scene,
+ &eval_ctx, bmain, scene,
ob, ob, imat,
&mvert, &medge, &mloop, &mpoly,
&vdata, &edata, &ldata, &pdata,
@@ -508,7 +506,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* only join if this is a mesh */
if (base->object->type == OB_MESH) {
join_mesh_single(
- C, bmain, scene,
+ &eval_ctx, bmain, scene,
ob, base->object, imat,
&mvert, &medge, &mloop, &mpoly,
&vdata, &edata, &ldata, &pdata,
@@ -1253,17 +1251,17 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
MDeformVert *ED_mesh_active_dvert_get_em(Object *ob, BMVert **r_eve)
{
- if (ob->type == OB_MESH && ob->defbase.first) {
+ if (ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) {
Mesh *me = ob->data;
- if (me->edit_btmesh != NULL) {
- BMesh *bm = me->edit_btmesh->bm;
- const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
- if (cd_dvert_offset != -1) {
- BMVert *eve = BM_mesh_active_vert_get(bm);
- if (eve) {
- if (r_eve) *r_eve = eve;
- return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset);
- }
+ BMesh *bm = me->edit_btmesh->bm;
+ const int cd_dvert_offset = CustomData_get_offset(&bm->vdata, CD_MDEFORMVERT);
+
+ if (cd_dvert_offset != -1) {
+ BMVert *eve = BM_mesh_active_vert_get(bm);
+
+ if (eve) {
+ if (r_eve) *r_eve = eve;
+ return BM_ELEM_CD_GET_VOID_P(eve, cd_dvert_offset);
}
}
}
@@ -1288,8 +1286,7 @@ MDeformVert *ED_mesh_active_dvert_get_ob(Object *ob, int *r_index)
MDeformVert *ED_mesh_active_dvert_get_only(Object *ob)
{
if (ob->type == OB_MESH) {
- Mesh *me = ob->data;
- if (me->edit_btmesh != NULL) {
+ if (ob->mode & OB_MODE_EDIT) {
return ED_mesh_active_dvert_get_em(ob, NULL);
}
else {
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);
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 14bcba3416f..51abb5b2eaa 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -42,7 +42,6 @@
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_math.h"
#include "BLI_lasso_2d.h"
@@ -93,12 +92,10 @@
int PE_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene= CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob= CTX_data_active_object(C);
- if (!scene || !view_layer || !ob || !(workspace->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) {
return 0;
}
return (PE_get_current(scene, ob) != NULL);
@@ -106,12 +103,11 @@ int PE_poll(bContext *C)
int PE_hair_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
PTCacheEdit *edit;
- if (!scene || !ob || !(workspace->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT)) {
return 0;
}
edit= PE_get_current(scene, ob);
@@ -295,7 +291,7 @@ PTCacheEdit *PE_create_current(const EvaluationContext *eval_ctx, Scene *scene,
void PE_current_changed(const EvaluationContext *eval_ctx, Scene *scene, Object *ob)
{
- if (eval_ctx->object_mode == OB_MODE_PARTICLE_EDIT) {
+ if (ob->mode == OB_MODE_PARTICLE_EDIT) {
PE_create_current(eval_ctx, scene, ob);
}
}
@@ -4459,25 +4455,23 @@ static int particle_edit_toggle_poll(bContext *C)
static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- struct WorkSpace *workspace = CTX_wm_workspace(C);
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_PARTICLE_EDIT;
- const bool is_mode_set = (eval_ctx.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 (!is_mode_set) {
PTCacheEdit *edit;
+ EvaluationContext eval_ctx;
+ CTX_data_eval_ctx(C, &eval_ctx);
- workspace->object_mode |= mode_flag;
+ ob->mode |= mode_flag;
edit= PE_create_current(&eval_ctx, scene, ob);
/* mesh may have changed since last entering editmode.
@@ -4489,12 +4483,12 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_PARTICLE, NULL);
}
else {
- workspace->object_mode &= ~mode_flag;
+ ob->mode &= ~mode_flag;
toggle_particle_cursor(C, 0);
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
}
- ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
+ // ED_workspace_object_mode_sync_from_object(wm, workspace, ob);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index ce4137b182d..1fae5b70aff 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -110,25 +110,23 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- eObjectMode mode_orig;
+ int mode_orig;
if (!scene || !ob)
return OPERATOR_CANCELLED;
- mode_orig = workspace->object_mode;
+ mode_orig = ob->mode;
object_remove_particle_system(scene, ob);
/* possible this isn't the active object
* object_remove_particle_system() clears the mode on the last psys
*/
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
- if ((workspace->object_mode & OB_MODE_PARTICLE_EDIT) == 0) {
+ if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
if (view_layer->basact && view_layer->basact->object == ob) {
- workspace->object_mode &= ~OB_MODE_PARTICLE_EDIT;
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
}
}
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 222e0e20dff..270ba2a7947 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -99,7 +99,6 @@
static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
if (!ob)
@@ -107,7 +106,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
BKE_object_material_slot_add(ob);
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
Scene *scene = CTX_data_scene(C);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
@@ -137,7 +136,6 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot)
static int material_slot_remove_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_context(C);
if (!ob)
@@ -151,7 +149,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
BKE_object_material_slot_remove(ob);
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
Scene *scene = CTX_data_scene(C);
BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL);
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index 4d006028245..d29985041c6 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -401,12 +401,10 @@ static void texture_changed(Main *bmain, Tex *tex)
/* icons */
BKE_icon_changed(BKE_icon_id_ensure(&tex->id));
- const eObjectMode object_mode = WM_windows_object_mode_get(bmain->wm.first);
-
/* paint overlays */
for (scene = bmain->scene.first; scene; scene = scene->id.next) {
for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
- BKE_paint_invalidate_overlay_tex(scene, view_layer, tex, object_mode);
+ BKE_paint_invalidate_overlay_tex(scene, view_layer, tex);
}
}
@@ -526,23 +524,11 @@ static void scene_changed(Main *bmain, Scene *scene)
Object *ob;
/* glsl */
- bool has_texture_mode = false;
- wmWindowManager *wm = bmain->wm.first;
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- if (workspace->object_mode & OB_MODE_TEXTURE_PAINT) {
- has_texture_mode = true;
- break;
- }
- }
-
- if (has_texture_mode) {
- for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob->type == OB_MESH) {
- BKE_texpaint_slots_refresh_object(scene, ob);
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
- GPU_drawobject_free(ob->derivedFinal);
- }
+ for (ob = bmain->object.first; ob; ob = ob->id.next) {
+ if (ob->mode & OB_MODE_TEXTURE_PAINT) {
+ BKE_texpaint_slots_refresh_object(scene, ob);
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ GPU_drawobject_free(ob->derivedFinal);
}
}
}
@@ -572,10 +558,8 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
lamp_changed(bmain, (Lamp *)id);
break;
case ID_IM:
- {
image_changed(bmain, (Image *)id);
break;
- }
case ID_SCE:
scene_changed(bmain, (Scene *)id);
render_engine_flag_changed(bmain, RE_ENGINE_UPDATE_OTHER);
diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c
index da720272f67..76abc1489fd 100644
--- a/source/blender/editors/scene/scene_edit.c
+++ b/source/blender/editors/scene/scene_edit.c
@@ -122,21 +122,23 @@ static ViewLayer *scene_change_get_new_view_layer(const WorkSpace *workspace, co
void ED_scene_change_update(
Main *bmain, bContext *C,
- wmWindow *win, const bScreen *screen, Scene *scene_old, Scene *scene_new)
+ wmWindow *win, const bScreen *screen, Scene *UNUSED(scene_old), Scene *scene_new)
{
WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *layer_new = scene_change_get_new_view_layer(workspace, scene_new);
Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene_new, layer_new, true);
Object *obact_new = OBACT(layer_new);
+ UNUSED_VARS(obact_new);
+#if 0
/* mode syncing */
EvaluationContext eval_ctx_old;
CTX_data_eval_ctx(C, &eval_ctx_old);
eObjectMode object_mode_old = workspace->object_mode;
ViewLayer *layer_old = BKE_view_layer_from_workspace_get(scene_old, workspace);
Object *obact_old = OBACT(layer_old);
- bool obact_new_mode_exists = ED_object_mode_generic_exists(bmain->wm.first, obact_new, workspace->object_mode);
-
+ UNUSED_VARS(obact_old, object_mode_old);
+#endif
win->scene = scene_new;
CTX_data_scene_set(C, scene_new);
@@ -145,19 +147,6 @@ void ED_scene_change_update(
DEG_graph_relations_update(depsgraph, bmain, scene_new, layer_new);
DEG_on_visible_update(bmain, false);
- if (obact_new == obact_old) {
- /* pass */
- }
- else {
- ED_object_mode_generic_exit_or_other_window(&eval_ctx_old, bmain->wm.first, workspace, scene_old, obact_old);
- if (obact_new_mode_exists) {
- workspace->object_mode = object_mode_old;
- }
- else {
- ED_object_mode_generic_enter_or_other_window(C, win, object_mode_old);
- }
- }
-
ED_screen_update_after_scene_change(screen, scene_new, layer_new);
ED_render_engine_changed(bmain);
ED_update_for_newframe(bmain, scene_new, layer_new, depsgraph);
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 4c217a5e829..e0c73b1782e 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -93,6 +93,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
Object *obact = (view_layer && view_layer->basact) ? view_layer->basact->object : NULL;
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, screen_context_dir);
@@ -203,7 +204,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
- Object *obedit = BKE_workspace_edit_object(workspace, scene);
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone = NULL;
const bool editable_bones = CTX_data_equals(member, "editable_bones");
@@ -246,7 +246,6 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
}
else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
- Object *obedit = BKE_workspace_edit_object(workspace, scene);
bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
EditBone *ebone, *flipbone = NULL;
const bool selected_editable_bones = CTX_data_equals(member, "selected_editable_bones");
@@ -368,38 +367,37 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "edit_object")) {
/* convenience for now, 1 object per scene in editmode */
- Object *obedit = BKE_workspace_edit_object(workspace, scene);
if (obedit)
CTX_data_id_pointer_set(result, &obedit->id);
return 1;
}
else if (CTX_data_equals(member, "sculpt_object")) {
- if (obact && (workspace->object_mode & OB_MODE_SCULPT)) {
+ if (obact && (obact->mode & OB_MODE_SCULPT))
CTX_data_id_pointer_set(result, &obact->id);
- }
+
return 1;
}
else if (CTX_data_equals(member, "vertex_paint_object")) {
- if (obact && (workspace->object_mode & OB_MODE_VERTEX_PAINT))
+ if (obact && (obact->mode & OB_MODE_VERTEX_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
else if (CTX_data_equals(member, "weight_paint_object")) {
- if (obact && (workspace->object_mode & OB_MODE_WEIGHT_PAINT))
+ if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
else if (CTX_data_equals(member, "image_paint_object")) {
- if (obact && (workspace->object_mode & OB_MODE_TEXTURE_PAINT))
+ if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
}
else if (CTX_data_equals(member, "particle_edit_object")) {
- if (obact && (workspace->object_mode & OB_MODE_PARTICLE_EDIT))
+ if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
CTX_data_id_pointer_set(result, &obact->id);
return 1;
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index c24d08d5fed..0b893d23e13 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -153,7 +153,6 @@ int ED_operator_scene_editable(bContext *C)
int ED_operator_objectmode(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -163,7 +162,7 @@ int ED_operator_objectmode(bContext *C)
return 0;
/* add a check for ob->mode too? */
- if (obact && (workspace->object_mode != OB_MODE_OBJECT))
+ if (obact && (obact->mode != OB_MODE_OBJECT))
return 0;
return 1;
@@ -305,39 +304,35 @@ int ED_operator_console_active(bContext *C)
return ed_spacetype_test(C, SPACE_CONSOLE);
}
-static int ed_object_hidden(Object *ob, eObjectMode object_mode)
+static int ed_object_hidden(Object *ob)
{
/* if hidden but in edit mode, we still display, can happen with animation */
- return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(object_mode & OB_MODE_EDIT));
+ return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT));
}
int ED_operator_object_active(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ed_object_hidden(ob, workspace->object_mode));
+ return ((ob != NULL) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode));
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob));
}
int ED_operator_object_active_editable_mesh(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode) &&
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_MESH) && !ID_IS_LINKED(ob->data));
}
int ED_operator_object_active_editable_font(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = ED_object_active_context(C);
- return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob, workspace->object_mode) &&
+ return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_FONT));
}
@@ -382,14 +377,11 @@ int ED_operator_posemode_exclusive(bContext *C)
{
Object *obact = CTX_data_active_object(C);
- if (obact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- Object *obpose;
- if ((obpose = BKE_object_pose_armature_get(obact))) {
- if (obact == obpose) {
- return 1;
- }
+ if (obact && !(obact->mode & OB_MODE_EDIT)) {
+ Object *obpose;
+ if ((obpose = BKE_object_pose_armature_get(obact))) {
+ if (obact == obpose) {
+ return 1;
}
}
}
@@ -403,15 +395,9 @@ int ED_operator_posemode_context(bContext *C)
{
Object *obpose = ED_pose_object_from_context(C);
- if (obpose) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- /* TODO, should we allow this out of pose mode? */
- if (workspace->object_mode & OB_MODE_POSE) {
- // if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- if (BKE_object_pose_context_check(obpose)) {
- return 1;
- }
- // }
+ if (obpose && !(obpose->mode & OB_MODE_EDIT)) {
+ if (BKE_object_pose_context_check(obpose)) {
+ return 1;
}
}
@@ -422,17 +408,11 @@ int ED_operator_posemode(bContext *C)
{
Object *obact = CTX_data_active_object(C);
-
- if (obact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if ((workspace->object_mode & OB_MODE_EDIT) == 0) {
- Object *obpose;
- if ((obpose = BKE_object_pose_armature_get(obact))) {
- if (((workspace->object_mode & OB_MODE_POSE) && (obact == obpose)) ||
- (workspace->object_mode & OB_MODE_WEIGHT_PAINT))
- {
- return 1;
- }
+ if (obact && !(obact->mode & OB_MODE_EDIT)) {
+ Object *obpose;
+ if ((obpose = BKE_object_pose_armature_get(obact))) {
+ if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
+ return 1;
}
}
}
@@ -568,10 +548,9 @@ int ED_operator_mask(bContext *C)
}
case SPACE_IMAGE:
{
- WorkSpace *workspace = CTX_wm_workspace(C);
SpaceImage *sima = sa->spacedata.first;
ViewLayer *view_layer = CTX_data_view_layer(C);
- return ED_space_image_check_show_maskedit(sima, workspace, view_layer);
+ return ED_space_image_check_show_maskedit(sima, view_layer);
}
}
}
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index bf2e788e2b0..dee62f9c5dd 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -85,6 +85,26 @@ WorkSpace *ED_workspace_add(
return workspace;
}
+/**
+ * Changes the object mode (if needed) to the one set in \a workspace_new.
+ * Object mode is still stored on object level. In future it should all be workspace level instead.
+ */
+static void workspace_change_update_mode(
+ const WorkSpace *workspace_old, const WorkSpace *workspace_new,
+ bContext *C, Object *ob_act, ReportList *reports)
+{
+ UNUSED_VARS(workspace_old, workspace_new, C, ob_act, reports);
+#if 0
+ eObjectMode mode_old = workspace_old->object_mode;
+ eObjectMode mode_new = workspace_new->object_mode;
+
+ if (mode_old != mode_new) {
+ ED_object_mode_compat_set(C, ob_act, mode_new, reports);
+ ED_object_mode_toggle(C, mode_new);
+ }
+#endif
+}
+
static void workspace_change_update_view_layer(
WorkSpace *workspace_new, const WorkSpace *workspace_old,
Scene *scene)
@@ -96,10 +116,11 @@ static void workspace_change_update_view_layer(
static void workspace_change_update(
WorkSpace *workspace_new, const WorkSpace *workspace_old,
- bContext *C)
+ bContext *C, wmWindowManager *wm)
{
/* needs to be done before changing mode! (to ensure right context) */
workspace_change_update_view_layer(workspace_new, workspace_old, CTX_data_scene(C));
+ workspace_change_update_mode(workspace_old, workspace_new, C, CTX_data_active_object(C), &wm->reports);
}
static bool workspace_change_find_new_layout_cb(const WorkSpaceLayout *layout, void *UNUSED(arg))
@@ -151,7 +172,7 @@ static WorkSpaceLayout *workspace_change_get_new_layout(
* \returns if workspace changing was successful.
*/
bool ED_workspace_change(
- WorkSpace *workspace_new, bContext *C, wmWindow *win)
+ WorkSpace *workspace_new, bContext *C, wmWindowManager *wm, wmWindow *win)
{
Main *bmain = CTX_data_main(C);
WorkSpace *workspace_old = WM_window_get_active_workspace(win);
@@ -169,20 +190,11 @@ bool ED_workspace_change(
BLI_assert(BKE_workspace_layout_screen_get(layout_new) == screen_new);
if (screen_new) {
- Scene *scene = WM_window_get_active_scene(win);
- bool use_object_mode = false;
-
- /* Store old context for exiting edit-mode. */
- EvaluationContext eval_ctx_old;
- CTX_data_eval_ctx(C, &eval_ctx_old);
-
-
WM_window_set_active_layout(win, workspace_new, layout_new);
WM_window_set_active_workspace(win, workspace_new);
/* update screen *after* changing workspace - which also causes the actual screen change */
- screen_change_update(C, win, screen_new);
- workspace_change_update(workspace_new, workspace_old, C);
+ workspace_change_update(workspace_new, workspace_old, C, wm);
BLI_assert(BKE_workspace_view_layer_get(workspace_new, CTX_data_scene(C)) != NULL);
BLI_assert(CTX_wm_workspace(C) == workspace_new);
@@ -190,40 +202,6 @@ bool ED_workspace_change(
WM_toolsystem_unlink(C, workspace_old);
WM_toolsystem_link(C, workspace_new);
- ViewLayer *view_layer_old = BKE_workspace_view_layer_get(workspace_old, scene);
- Object *obact_old = OBACT(view_layer_old);
-
- ViewLayer *view_layer_new = BKE_workspace_view_layer_get(workspace_new, scene);
- Object *obact_new = OBACT(view_layer_new);
-
- /* Handle object mode switching */
- if ((workspace_old->object_mode != OB_MODE_OBJECT) ||
- (workspace_new->object_mode != OB_MODE_OBJECT))
- {
- if ((workspace_old->object_mode == workspace_new->object_mode) &&
- (obact_old == obact_new))
- {
- /* pass */
- }
- else {
- use_object_mode = true;
- }
- }
-
- if (use_object_mode) {
- /* weak, set it back so it's used when activating again. */
- eObjectMode object_mode = workspace_old->object_mode;
- ED_object_mode_generic_exit_or_other_window(&eval_ctx_old, bmain->wm.first, workspace_old, scene, obact_old);
- workspace_old->object_mode = object_mode;
- ED_workspace_object_mode_sync_from_object(bmain->wm.first, workspace_old, obact_old);
- ED_object_mode_generic_enter_or_other_window(C, NULL, workspace_new->object_mode);
- }
- else {
- if (obact_new == NULL) {
- workspace_new->object_mode = OB_MODE_OBJECT;
- }
- }
-
return true;
}
@@ -250,7 +228,6 @@ WorkSpace *ED_workspace_duplicate(
BLI_duplicatelist(transform_orientations_new, transform_orientations_old);
workspace_new->tool = workspace_old->tool;
- workspace_new->object_mode = workspace_old->object_mode;
for (WorkSpaceLayout *layout_old = layouts_old->first; layout_old; layout_old = layout_old->next) {
WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(workspace_new, layout_old, win);
@@ -278,7 +255,7 @@ bool ED_workspace_delete(
WorkSpace *prev = workspace_id->prev;
WorkSpace *next = workspace_id->next;
- ED_workspace_change((prev != NULL) ? prev : next, C, win);
+ ED_workspace_change((prev != NULL) ? prev : next, C, wm, win);
}
BKE_libblock_free(bmain, workspace_id);
@@ -307,63 +284,6 @@ void ED_workspace_view_layer_unset(
}
}
-/**
- * When a work-space mode has changed,
- * flush it to all other visible work-spaces using the same object
- * since we don't support one object being in two different modes at once.
- * \note We could support this but it's more trouble than it's worth.
- */
-
-void ED_workspace_object_mode_sync_from_object(wmWindowManager *wm, WorkSpace *workspace, Object *obact)
-{
- if (obact == NULL) {
- return;
- }
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- WorkSpace *workspace_iter = BKE_workspace_active_get(win->workspace_hook);
- if ((workspace != workspace_iter) && (workspace->object_mode != workspace_iter->object_mode)) {
- Scene *scene_iter = WM_window_get_active_scene(win);
- ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene_iter, workspace_iter);
- if (obact == OBACT(view_layer)) {
- workspace_iter->object_mode = workspace->object_mode;
- /* TODO(campbell), use msgbus */
- WM_main_add_notifier(NC_SCENE | ND_MODE | NS_MODE_OBJECT, scene_iter);
- }
- }
- }
-}
-
-void ED_workspace_object_mode_sync_from_scene(wmWindowManager *wm, WorkSpace *workspace, Scene *scene)
-{
- ViewLayer *view_layer = BKE_workspace_view_layer_get(workspace, scene);
- if (view_layer) {
- Object *obact = OBACT(view_layer);
- ED_workspace_object_mode_sync_from_object(wm, workspace, obact);
- }
-}
-
-bool ED_workspace_object_mode_in_other_window(
- struct wmWindowManager *wm, const wmWindow *win_compare, Object *obact,
- eObjectMode *r_object_mode)
-{
- for (wmWindow *win_iter = wm->windows.first; win_iter; win_iter = win_iter->next) {
- if (win_compare != win_iter) {
- WorkSpace *workspace_iter = BKE_workspace_active_get(win_iter->workspace_hook);
- Scene *scene_iter = WM_window_get_active_scene(win_iter);
- ViewLayer *view_layer_iter = BKE_view_layer_from_workspace_get(scene_iter, workspace_iter);
- Object *obact_iter = OBACT(view_layer_iter);
- if (obact == obact_iter) {
- if (r_object_mode) {
- *r_object_mode = workspace_iter->object_mode;
- }
- return true;
- }
- }
- }
-
- return false;
-}
-
/** \} Workspace API */
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;
}
}
diff --git a/source/blender/editors/space_buttons/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index ec866780122..397d79e1dbe 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -23,7 +23,6 @@ set(INC
../../blenkernel
../../blenlib
../../blentranslation
- ../../depsgraph
../../gpu
../../makesdna
../../makesrna
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index ebb14d3caeb..8866c6b6c40 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -62,8 +62,6 @@
#include "RNA_access.h"
-#include "DEG_depsgraph.h"
-
#include "ED_buttons.h"
#include "ED_armature.h"
#include "ED_screen.h"
@@ -425,9 +423,8 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
scene = path->ptr[path->len - 1].data;
if (scene) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer, workspace->object_mode));
+ br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
}
if (br) {
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 95ed8967380..c719af9e0e2 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -323,16 +323,15 @@ bool ED_image_slot_cycle(struct Image *image, int direction)
void ED_space_image_scopes_update(const struct bContext *C, struct SpaceImage *sima, struct ImBuf *ibuf, bool use_view_settings)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
-
+
/* scope update can be expensive, don't update during paint modes */
if (sima->mode == SI_MODE_PAINT)
return;
- if (ob && ((workspace->object_mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0)) {
+ if (ob && ((ob->mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_EDIT)) != 0))
return;
- }
+
/* We also don't update scopes of render result during render. */
if (G.is_rendering) {
const Image *image = sima->image;
@@ -377,12 +376,11 @@ bool ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
}
/* matches clip function */
-bool ED_space_image_check_show_maskedit(
- SpaceImage *sima, const WorkSpace *workspace, ViewLayer *view_layer)
+bool ED_space_image_check_show_maskedit(SpaceImage *sima, ViewLayer *view_layer)
{
/* check editmode - this is reserved for UV editing */
Object *ob = OBACT(view_layer);
- if (ob && (workspace->object_mode & OB_MODE_EDIT) && ED_space_image_show_uvedit(sima, ob)) {
+ if (ob && ob->mode & OB_MODE_EDIT && ED_space_image_show_uvedit(sima, ob)) {
return false;
}
@@ -392,10 +390,10 @@ bool ED_space_image_check_show_maskedit(
int ED_space_image_maskedit_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
+
if (sima) {
- WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- return ED_space_image_check_show_maskedit(sima, workspace, view_layer);
+ return ED_space_image_check_show_maskedit(sima, view_layer);
}
return false;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 711f8732d71..9162b8b76a9 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -275,12 +275,11 @@ int space_image_main_region_poll(bContext *C)
/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */
static int space_image_main_area_not_uv_brush_poll(bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
ToolSettings *toolsettings = scene->toolsettings;
- if (sima && !toolsettings->uvsculpt && ((workspace->object_mode & OB_MODE_EDIT) == 0)) {
+ if (sima && !toolsettings->uvsculpt && (CTX_data_edit_object(C) == NULL)) {
return 1;
}
@@ -793,7 +792,6 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
{
- WorkSpace *workspace = CTX_wm_workspace(C);
SpaceImage *sima;
ARegion *ar;
Scene *scene;
@@ -817,7 +815,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
}
- else if (ED_space_image_check_show_maskedit(sima, workspace, view_layer)) {
+ else if (ED_space_image_check_show_maskedit(sima, view_layer)) {
if (!ED_mask_selected_minmax(C, min, max)) {
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index c66d588c50d..54037059cc3 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -551,7 +551,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn, Sc
{
ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
Object *ob = OBACT(view_layer);
- if (ob && (ob == wmn->reference) && (workspace->object_mode & OB_MODE_EDIT)) {
+ if (ob && (ob == wmn->reference) && (ob->mode & OB_MODE_EDIT)) {
if (sima->lock && (sima->flag & SI_DRAWSHADOW)) {
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa);
@@ -725,9 +725,6 @@ static void image_main_region_init(wmWindowManager *wm, ARegion *ar)
static void image_main_region_draw(const bContext *C, ARegion *ar)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
-
/* draw entirely, view changes should be handled here */
SpaceImage *sima = CTX_wm_space_image(C);
Object *obact = CTX_data_active_object(C);
@@ -762,7 +759,7 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
- ED_uvedit_draw_main(sima, &eval_ctx, ar, scene, view_layer, obedit, obact, depsgraph);
+ ED_uvedit_draw_main(sima, ar, scene, view_layer, obedit, obact, depsgraph);
/* check for mask (delay draw) */
if (ED_space_image_show_uvedit(sima, obedit)) {
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 800560c380c..157171481bc 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -36,7 +36,6 @@
#include "DNA_lattice_types.h"
#include "DNA_meta_types.h"
#include "DNA_scene_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_math.h"
#include "BLI_string.h"
@@ -375,21 +374,22 @@ static bool stats_is_object_dynamic_topology_sculpt(Object *ob, const eObjectMod
}
/* Statistics displayed in info header. Called regularly on scene changes. */
-static void stats_update(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode)
+static void stats_update(ViewLayer *view_layer)
{
SceneStats stats = {0};
- Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
+ Object *ob = OBACT(view_layer);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
Base *base;
if (obedit) {
/* Edit Mode */
stats_object_edit(ob, &stats);
}
- else if (ob && (object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
/* Pose Mode */
stats_object_pose(ob, &stats);
}
- else if (stats_is_object_dynamic_topology_sculpt(ob, object_mode)) {
+ else if (stats_is_object_dynamic_topology_sculpt(ob, ob->mode)) {
/* Dynamic-topology sculpt mode */
stats_object_sculpt_dynamic_topology(ob, &stats);
}
@@ -408,12 +408,14 @@ static void stats_update(ViewLayer *view_layer, Object *obedit, const eObjectMod
*(view_layer->stats) = stats;
}
-static void stats_string(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode)
+static void stats_string(ViewLayer *view_layer)
{
#define MAX_INFO_MEM_LEN 64
SceneStats *stats = view_layer->stats;
SceneStatsFmt stats_fmt;
- Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL;
+ Object *ob = OBACT(view_layer);
+ Object *obedit = OBEDIT_FROM_OBACT(ob);
+ eObjectMode object_mode = ob ? ob->mode : OB_MODE_OBJECT;
uintptr_t mem_in_use, mmap_in_use;
char memstr[MAX_INFO_MEM_LEN];
char gpumemstr[MAX_INFO_MEM_LEN] = "";
@@ -528,16 +530,11 @@ void ED_info_stats_clear(ViewLayer *view_layer)
}
}
-const char *ED_info_stats_string(Scene *UNUSED(scene), WorkSpace *workspace, ViewLayer *view_layer)
+const char *ED_info_stats_string(Scene *UNUSED(scene), ViewLayer *view_layer)
{
- Object *obact = (view_layer->basact) ? view_layer->basact->object : NULL;
- Object *obedit = (obact && (workspace->object_mode & OB_MODE_EDIT) &&
- BKE_object_is_in_editmode(obact)) ? obact : NULL;
-
if (!view_layer->stats) {
- stats_update(view_layer, obedit, workspace->object_mode);
+ stats_update(view_layer);
}
- stats_string(view_layer, obedit, workspace->object_mode);
-
+ stats_string(view_layer);
return view_layer->stats->infostr;
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 90e59a677ac..15b411280a5 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1902,10 +1902,10 @@ void draw_outliner(const bContext *C)
{
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
- Object *obedit = OBEDIT_FROM_EVAL_CTX(&eval_ctx);
Main *mainvar = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -1914,7 +1914,7 @@ void draw_outliner(const bContext *C)
TreeElement *te_edit = NULL;
bool has_restrict_icons;
- outliner_build_tree(mainvar, &eval_ctx, scene, view_layer, soops, ar); // always
+ outliner_build_tree(mainvar, scene, view_layer, soops, ar); // always
/* get extents of data */
outliner_height(soops, &soops->tree, &sizey);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 93e9b77a837..f5d117922c0 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -63,7 +63,6 @@
#include "BKE_material.h"
#include "BKE_group.h"
-#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "../blenloader/BLO_readfile.h"
@@ -977,7 +976,6 @@ static int outliner_open_back(TreeElement *te)
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
SpaceOops *so = CTX_wm_space_outliner(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *ar = CTX_wm_region(C);
@@ -998,13 +996,13 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
/* traverse down the bone hierarchy in case of armature */
TreeElement *te_obact = te;
- if (workspace->object_mode & OB_MODE_POSE) {
+ if (obact->mode & OB_MODE_POSE) {
bPoseChannel *pchan = CTX_data_active_pose_bone(C);
if (pchan) {
te = outliner_find_posechannel(&te_obact->subtree, pchan);
}
}
- else if (workspace->object_mode & OB_MODE_EDIT) {
+ else if (obact->mode & OB_MODE_EDIT) {
EditBone *ebone = CTX_data_active_bone(C);
if (ebone) {
te = outliner_find_editbone(&te_obact->subtree, ebone);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 148af52050d..bedd2f09f3b 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -193,7 +193,7 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree);
void outliner_remove_treestore_element(struct SpaceOops *soops, TreeStoreElem *tselem);
void outliner_build_tree(
- struct Main *mainvar, const struct EvaluationContext *eval_ctx,
+ struct Main *mainvar,
struct Scene *scene, struct ViewLayer *view_layer,
struct SpaceOops *soops, struct ARegion *ar);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 018756f2a99..bfa8633ab7d 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -193,10 +193,10 @@ static eOLDrawState tree_element_set_active_object(
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
-
- if (CTX_data_edit_object(C)) {
+
+ if (ob != OBEDIT_FROM_VIEW_LAYER(view_layer))
ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
- }
+
return OL_DRAWSEL_NORMAL;
}
@@ -658,7 +658,6 @@ static eOLDrawState tree_element_active_text(
static eOLDrawState tree_element_active_pose(
bContext *C, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = (Object *)tselem->id;
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -668,18 +667,16 @@ static eOLDrawState tree_element_active_pose(
}
if (set != OL_SETSEL_NONE) {
- if (workspace->object_mode & OB_MODE_EDIT) {
+ if (OBEDIT_FROM_VIEW_LAYER(view_layer))
ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO);
- }
- if (workspace->object_mode & OB_MODE_POSE) {
+
+ if (ob->mode & OB_MODE_POSE)
ED_armature_exit_posemode(C, base);
- }
- else {
+ else
ED_armature_enter_posemode(C, base);
- }
}
else {
- if (workspace->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
return OL_DRAWSEL_NORMAL;
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 8c6d7783f01..eff726868c7 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -92,12 +92,10 @@
/* prototypes */
static void outliner_add_layer_collections_recursive(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
+ SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects);
static void outliner_add_view_layer(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, TreeElement *parent,
+ SpaceOops *soops, ListBase *tree, TreeElement *parent,
Scene *scene, ViewLayer *layer, const bool show_objects);
static void outliner_make_hierarchy(ListBase *lb);
@@ -235,25 +233,23 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
/* ********************************************************* */
/* Prototype, see functions below */
-static TreeElement *outliner_add_element(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *lb, void *idv, TreeElement *parent, short type, short index);
+static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+ TreeElement *parent, short type, short index);
/* -------------------------------------------------------- */
/* special handling of hierarchical non-lib data */
-static void outliner_add_bone(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *lb, ID *id, Bone *curBone, TreeElement *parent, int *a)
+static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curBone,
+ TreeElement *parent, int *a)
{
- TreeElement *te = outliner_add_element(soops, eval_ctx, lb, id, parent, TSE_BONE, *a);
+ TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
(*a)++;
te->name = curBone->name;
te->directdata = curBone;
for (curBone = curBone->childbase.first; curBone; curBone = curBone->next) {
- outliner_add_bone(soops, eval_ctx, &te->subtree, id, curBone, te, a);
+ outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
}
}
@@ -261,9 +257,7 @@ static void outliner_add_bone(
#define LOG2I(x) (int)(log(x) / M_LN2)
-static void outliner_add_passes(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- TreeElement *tenla, ID *id, ViewLayer *view_layer)
+static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, ViewLayer *view_layer)
{
TreeStoreElem *tselem = NULL;
TreeElement *te = NULL;
@@ -271,7 +265,7 @@ static void outliner_add_passes(
/* log stuff is to convert bitflags (powers of 2) to small integers,
* in order to not overflow short tselem->nr */
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
te->name = IFACE_("Combined");
te->directdata = &view_layer->passflag;
@@ -280,71 +274,71 @@ static void outliner_add_passes(
if (tselem->flag & TSE_CLOSED)
return;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
te->name = IFACE_("Z");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
te->name = IFACE_("Vector");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
te->name = IFACE_("Normal");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
te->name = IFACE_("UV");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
te->name = IFACE_("Mist");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
te->name = IFACE_("Index Object");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
te->name = IFACE_("Index Material");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
te->name = IFACE_("Color");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
te->name = IFACE_("Diffuse");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
te->name = IFACE_("Specular");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
te->name = IFACE_("Shadow");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
te->name = IFACE_("AO");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
te->name = IFACE_("Reflection");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
te->name = IFACE_("Refraction");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
te->name = IFACE_("Indirect");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
te->name = IFACE_("Environment");
te->directdata = &view_layer->passflag;
- te = outliner_add_element(soops, eval_ctx, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
+ te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
te->name = IFACE_("Emit");
te->directdata = &view_layer->passflag;
}
@@ -379,43 +373,41 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
if (!(linestyle->id.tag & LIB_TAG_DOIT))
continue;
linestyle->id.tag &= ~LIB_TAG_DOIT;
- outliner_add_element(soops, eval_ctx, lb, linestyle, te, 0, 0);
+ outliner_add_element(soops, lb, linestyle, te, 0, 0);
}
}
}
}
#endif
-static void outliner_add_scene_contents(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *lb, Scene *sce, TreeElement *te)
+static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
{
ViewLayer *view_layer;
- TreeElement *tenla = outliner_add_element(soops, eval_ctx, lb, sce, te, TSE_R_LAYER_BASE, 0);
+ TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
int a;
tenla->name = IFACE_("View Layers");
for (a = 0, view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next, a++) {
- TreeElement *tenlay = outliner_add_element(soops, eval_ctx, &tenla->subtree, sce, te, TSE_R_LAYER, a);
+ TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
tenlay->name = view_layer->name;
tenlay->directdata = &view_layer->flag;
TreeElement *te_view_layers;
- te_view_layers = outliner_add_element(soops, eval_ctx, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
+ te_view_layers = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
te_view_layers->name = IFACE_("Collections");
- outliner_add_view_layer(soops, eval_ctx, &te_view_layers->subtree, te_view_layers, sce, view_layer, false);
+ outliner_add_view_layer(soops, &te_view_layers->subtree, te_view_layers, sce, view_layer, false);
TreeElement *te_passes;
- te_passes = outliner_add_element(soops, eval_ctx, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
+ te_passes = outliner_add_element(soops, &tenlay->subtree, sce, tenlay, TSE_LAYER_COLLECTION_BASE, 0);
te_passes->name = IFACE_("Passes");
- outliner_add_passes(soops, eval_ctx, te_passes, &sce->id, view_layer);
+ outliner_add_passes(soops, te_passes, &sce->id, view_layer);
}
// TODO: move this to the front?
if (outliner_animdata_test(sce->adt))
- outliner_add_element(soops, eval_ctx, lb, sce, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, lb, sce, te, TSE_ANIM_DATA, 0);
- outliner_add_element(soops, eval_ctx, lb, sce->gpd, te, 0, 0);
+ outliner_add_element(soops, lb, sce->gpd, te, 0, 0);
#ifdef WITH_FREESTYLE
if (STREQ(sce->view_render->engine_id, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS))
@@ -520,41 +512,37 @@ static bool outliner_object_reorder_poll(
}
// can be inlined if necessary
-static void outliner_add_object_contents(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- TreeElement *te, TreeStoreElem *tselem, Object *ob)
+static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
{
te->reinsert = outliner_object_reorder;
te->reinsert_poll = outliner_object_reorder_poll;
if (outliner_animdata_test(ob->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
- outliner_add_element(soops, eval_ctx, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this
+ outliner_add_element(soops, &te->subtree, ob->poselib, te, 0, 0); // XXX FIXME.. add a special type for this
if (ob->proxy && !ID_IS_LINKED(ob))
- outliner_add_element(soops, eval_ctx, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
+ outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
- outliner_add_element(soops, eval_ctx, &te->subtree, ob->gpd, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, ob->gpd, te, 0, 0);
- outliner_add_element(soops, eval_ctx, &te->subtree, ob->data, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
if (ob->pose) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
- TreeElement *tenla = outliner_add_element(
- soops, eval_ctx, &te->subtree, ob, te, TSE_POSE_BASE, 0);
+ TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
tenla->name = IFACE_("Pose");
/* channels undefined in editmode, but we want the 'tenla' pose icon itself */
- if ((arm->edbo == NULL) && (eval_ctx->object_mode & OB_MODE_POSE)) {
+ if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
TreeElement *ten;
int a = 0, const_index = 1000; /* ensure unique id for bone constraints */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) {
- ten = outliner_add_element(
- soops, eval_ctx, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
+ ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
ten->name = pchan->name;
ten->directdata = pchan;
pchan->temp = (void *)ten;
@@ -563,14 +551,12 @@ static void outliner_add_object_contents(
//Object *target;
bConstraint *con;
TreeElement *ten1;
- TreeElement *tenla1 = outliner_add_element(
- soops, eval_ctx, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
+ TreeElement *tenla1 = outliner_add_element(soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
//char *str;
tenla1->name = IFACE_("Constraints");
for (con = pchan->constraints.first; con; con = con->next, const_index++) {
- ten1 = outliner_add_element(
- soops, eval_ctx, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
+ ten1 = outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
target = get_constraint_target(con, &str);
if (str && str[0]) ten1->name = str;
@@ -604,15 +590,13 @@ static void outliner_add_object_contents(
/* Pose Groups */
if (ob->pose->agroups.first) {
bActionGroup *agrp;
- TreeElement *ten_bonegrp = outliner_add_element(
- soops, eval_ctx, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
+ TreeElement *ten_bonegrp = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
int a = 0;
ten_bonegrp->name = IFACE_("Bone Groups");
for (agrp = ob->pose->agroups.first; agrp; agrp = agrp->next, a++) {
TreeElement *ten;
- ten = outliner_add_element(
- soops, eval_ctx, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
+ ten = outliner_add_element(soops, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
ten->name = agrp->name;
ten->directdata = agrp;
}
@@ -620,21 +604,20 @@ static void outliner_add_object_contents(
}
for (int a = 0; a < ob->totcol; a++) {
- outliner_add_element(
- soops, eval_ctx, &te->subtree, ob->mat[a], te, 0, a);
+ outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
}
if (ob->constraints.first) {
//Object *target;
bConstraint *con;
TreeElement *ten;
- TreeElement *tenla = outliner_add_element(soops, eval_ctx, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
+ TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
//char *str;
int a;
tenla->name = IFACE_("Constraints");
for (con = ob->constraints.first, a = 0; con; con = con->next, a++) {
- ten = outliner_add_element(soops, eval_ctx, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
+ ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
#if 0 /* disabled due to constraints system targets recode... code here needs review */
target = get_constraint_target(con, &str);
if (str && str[0]) ten->name = str;
@@ -649,38 +632,32 @@ static void outliner_add_object_contents(
if (ob->modifiers.first) {
ModifierData *md;
- TreeElement *ten_mod = outliner_add_element(soops, eval_ctx, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
+ TreeElement *ten_mod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
int index;
ten_mod->name = IFACE_("Modifiers");
for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) {
- TreeElement *ten = outliner_add_element(
- soops, eval_ctx, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
+ TreeElement *ten = outliner_add_element(soops, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
ten->name = md->name;
ten->directdata = md;
if (md->type == eModifierType_Lattice) {
- outliner_add_element(
- soops, eval_ctx, &ten->subtree, ((LatticeModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(soops, &ten->subtree, ((LatticeModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Curve) {
- outliner_add_element(
- soops, eval_ctx, &ten->subtree, ((CurveModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(soops, &ten->subtree, ((CurveModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Armature) {
- outliner_add_element(
- soops, eval_ctx, &ten->subtree, ((ArmatureModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(soops, &ten->subtree, ((ArmatureModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Hook) {
- outliner_add_element(
- soops, eval_ctx, &ten->subtree, ((HookModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(soops, &ten->subtree, ((HookModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_ParticleSystem) {
ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys;
TreeElement *ten_psys;
- ten_psys = outliner_add_element(
- soops, eval_ctx, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0);
+ ten_psys = outliner_add_element(soops, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0);
ten_psys->directdata = psys;
ten_psys->name = psys->part->id.name + 2;
}
@@ -691,29 +668,25 @@ static void outliner_add_object_contents(
if (ob->defbase.first) {
bDeformGroup *defgroup;
TreeElement *ten;
- TreeElement *tenla = outliner_add_element(
- soops, eval_ctx, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
+ TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
int a;
tenla->name = IFACE_("Vertex Groups");
for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) {
- ten = outliner_add_element(soops, eval_ctx, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
+ ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
ten->name = defgroup->name;
ten->directdata = defgroup;
}
}
/* duplicated group */
- if (ob->dup_group) {
- outliner_add_element(soops, eval_ctx, &te->subtree, ob->dup_group, te, 0, 0);
- }
+ if (ob->dup_group)
+ outliner_add_element(soops, &te->subtree, ob->dup_group, te, 0, 0);
}
// can be inlined if necessary
-static void outliner_add_id_contents(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- TreeElement *te, TreeStoreElem *tselem, ID *id)
+static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, ID *id)
{
/* tuck pointer back in object, to construct hierarchy */
if (GS(id->name) == ID_OB) id->newid = (ID *)te;
@@ -727,26 +700,25 @@ static void outliner_add_id_contents(
}
case ID_SCE:
{
- outliner_add_scene_contents(soops, eval_ctx, &te->subtree, (Scene *)id, te);
+ outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
break;
}
case ID_OB:
{
- outliner_add_object_contents(soops, eval_ctx, te, tselem, (Object *)id);
+ outliner_add_object_contents(soops, te, tselem, (Object *)id);
break;
}
case ID_ME:
{
Mesh *me = (Mesh *)id;
int a;
-
- if (outliner_animdata_test(me->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, me, te, TSE_ANIM_DATA, 0);
- }
-
- outliner_add_element(soops, eval_ctx, &te->subtree, me->key, te, 0, 0);
+
+ if (outliner_animdata_test(me->adt))
+ outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
+
+ outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
for (a = 0; a < me->totcol; a++)
- outliner_add_element(soops, eval_ctx, &te->subtree, me->mat[a], te, 0, a);
+ outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
/* could do tfaces with image links, but the images are not grouped nicely.
* would require going over all tfaces, sort images in use. etc... */
break;
@@ -757,10 +729,10 @@ static void outliner_add_id_contents(
int a;
if (outliner_animdata_test(cu->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
for (a = 0; a < cu->totcol; a++)
- outliner_add_element(soops, eval_ctx, &te->subtree, cu->mat[a], te, 0, a);
+ outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
break;
}
case ID_MB:
@@ -769,10 +741,10 @@ static void outliner_add_id_contents(
int a;
if (outliner_animdata_test(mb->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
for (a = 0; a < mb->totcol; a++)
- outliner_add_element(soops, eval_ctx, &te->subtree, mb->mat[a], te, 0, a);
+ outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
break;
}
case ID_MA:
@@ -780,14 +752,11 @@ static void outliner_add_id_contents(
Material *ma = (Material *)id;
int a;
- if (outliner_animdata_test(ma->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(ma->adt))
+ outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
for (a = 0; a < MAX_MTEX; a++) {
- if (ma->mtex[a]) {
- outliner_add_element(soops, eval_ctx, &te->subtree, ma->mtex[a]->tex, te, 0, a);
- }
+ if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
}
break;
}
@@ -795,10 +764,10 @@ static void outliner_add_id_contents(
{
Tex *tex = (Tex *)id;
- if (outliner_animdata_test(tex->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
- }
- outliner_add_element(soops, eval_ctx, &te->subtree, tex->ima, te, 0, 0);
+ if (outliner_animdata_test(tex->adt))
+ outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
+
+ outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
break;
}
case ID_CA:
@@ -806,7 +775,7 @@ static void outliner_add_id_contents(
Camera *ca = (Camera *)id;
if (outliner_animdata_test(ca->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
break;
}
case ID_CF:
@@ -814,7 +783,7 @@ static void outliner_add_id_contents(
CacheFile *cache_file = (CacheFile *)id;
if (outliner_animdata_test(cache_file->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, cache_file, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, cache_file, te, TSE_ANIM_DATA, 0);
}
break;
@@ -825,12 +794,10 @@ static void outliner_add_id_contents(
int a;
if (outliner_animdata_test(la->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, la, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
for (a = 0; a < MAX_MTEX; a++) {
- if (la->mtex[a]) {
- outliner_add_element(soops, eval_ctx, &te->subtree, la->mtex[a]->tex, te, 0, a);
- }
+ if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
}
break;
}
@@ -838,18 +805,16 @@ static void outliner_add_id_contents(
{
Speaker *spk = (Speaker *)id;
- if (outliner_animdata_test(spk->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(spk->adt))
+ outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
break;
}
case ID_LP:
{
LightProbe *prb = (LightProbe *)id;
- if (outliner_animdata_test(prb->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, prb, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(prb->adt))
+ outliner_add_element(soops, &te->subtree, prb, te, TSE_ANIM_DATA, 0);
break;
}
case ID_WO:
@@ -857,13 +822,11 @@ static void outliner_add_id_contents(
World *wrld = (World *)id;
int a;
- if (outliner_animdata_test(wrld->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(wrld->adt))
+ outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
+
for (a = 0; a < MAX_MTEX; a++) {
- if (wrld->mtex[a]) {
- outliner_add_element(soops, eval_ctx, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
- }
+ if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
}
break;
}
@@ -871,9 +834,8 @@ static void outliner_add_id_contents(
{
Key *key = (Key *)id;
- if (outliner_animdata_test(key->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, key, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(key->adt))
+ outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0);
break;
}
case ID_AC:
@@ -887,15 +849,15 @@ static void outliner_add_id_contents(
bArmature *arm = (bArmature *)id;
int a = 0;
- if (outliner_animdata_test(arm->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
- }
+ if (outliner_animdata_test(arm->adt))
+ outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
+
if (arm->edbo) {
EditBone *ebone;
TreeElement *ten;
for (ebone = arm->edbo->first; ebone; ebone = ebone->next, a++) {
- ten = outliner_add_element(soops, eval_ctx, &te->subtree, id, te, TSE_EBONE, a);
+ ten = outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
ten->directdata = ebone;
ten->name = ebone->name;
ebone->temp.p = ten;
@@ -917,17 +879,13 @@ static void outliner_add_id_contents(
else {
/* do not extend Armature when we have posemode */
tselem = TREESTORE(te->parent);
- if (GS(tselem->id->name) == ID_OB &&
- (eval_ctx->object_mode & OB_MODE_POSE)
- /* (((Object *)tselem->id)->mode & OB_MODE_POSE) */
- )
- {
+ if (GS(tselem->id->name) == ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE) {
/* pass */
}
else {
Bone *curBone;
for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) {
- outliner_add_bone(soops, eval_ctx, &te->subtree, id, curBone, te, &a);
+ outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
}
}
}
@@ -937,14 +895,13 @@ static void outliner_add_id_contents(
{
FreestyleLineStyle *linestyle = (FreestyleLineStyle *)id;
int a;
-
- if (outliner_animdata_test(linestyle->adt)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0);
- }
+
+ if (outliner_animdata_test(linestyle->adt))
+ outliner_add_element(soops, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0);
for (a = 0; a < MAX_MTEX; a++) {
if (linestyle->mtex[a])
- outliner_add_element(soops, eval_ctx, &te->subtree, linestyle->mtex[a]->tex, te, 0, a);
+ outliner_add_element(soops, &te->subtree, linestyle->mtex[a]->tex, te, 0, a);
}
break;
}
@@ -955,11 +912,11 @@ static void outliner_add_id_contents(
int a = 0;
if (outliner_animdata_test(gpd->adt))
- outliner_add_element(soops, eval_ctx, &te->subtree, gpd, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(soops, &te->subtree, gpd, te, TSE_ANIM_DATA, 0);
// TODO: base element for layers?
for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- outliner_add_element(soops, eval_ctx, &te->subtree, gpl, te, TSE_GP_LAYER, a);
+ outliner_add_element(soops, &te->subtree, gpl, te, TSE_GP_LAYER, a);
a++;
}
break;
@@ -971,9 +928,8 @@ static void outliner_add_id_contents(
// TODO: this function needs to be split up! It's getting a bit too large...
// Note: "ID" is not always a real ID
-static TreeElement *outliner_add_element(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *lb, void *idv, TreeElement *parent, short type, short index)
+static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *idv,
+ TreeElement *parent, short type, short index)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1046,7 +1002,7 @@ static TreeElement *outliner_add_element(
/* ID datablock */
if (tsepar == NULL || tsepar->type != TSE_ID_BASE)
- outliner_add_id_contents(soops, eval_ctx, te, tselem, id);
+ outliner_add_id_contents(soops, te, tselem, id);
}
else if (type == TSE_ANIM_DATA) {
IdAdtTemplate *iat = (IdAdtTemplate *)idv;
@@ -1057,11 +1013,11 @@ static TreeElement *outliner_add_element(
te->directdata = adt;
/* Action */
- outliner_add_element(soops, eval_ctx, &te->subtree, adt->action, te, 0, 0);
+ outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
/* Drivers */
if (adt->drivers.first) {
- TreeElement *ted = outliner_add_element(soops, eval_ctx, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
+ TreeElement *ted = outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
ID *lastadded = NULL;
FCurve *fcu;
@@ -1078,7 +1034,7 @@ static TreeElement *outliner_add_element(
{
if (lastadded != dtar->id) {
// XXX this lastadded check is rather lame, and also fails quite badly...
- outliner_add_element(soops, eval_ctx, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
+ outliner_add_element(soops, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
lastadded = dtar->id;
}
}
@@ -1090,14 +1046,14 @@ static TreeElement *outliner_add_element(
/* NLA Data */
if (adt->nla_tracks.first) {
- TreeElement *tenla = outliner_add_element(soops, eval_ctx, &te->subtree, adt, te, TSE_NLA, 0);
+ TreeElement *tenla = outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
NlaTrack *nlt;
int a = 0;
tenla->name = IFACE_("NLA Tracks");
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
- TreeElement *tenlt = outliner_add_element(soops, eval_ctx, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
+ TreeElement *tenlt = outliner_add_element(soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
NlaStrip *strip;
TreeElement *ten;
int b = 0;
@@ -1105,7 +1061,7 @@ static TreeElement *outliner_add_element(
tenlt->name = nlt->name;
for (strip = nlt->strips.first; strip; strip = strip->next, b++) {
- ten = outliner_add_element(soops, eval_ctx, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
+ ten = outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
if (ten) ten->directdata = strip;
}
}
@@ -1140,12 +1096,12 @@ static TreeElement *outliner_add_element(
if (seq->type == SEQ_TYPE_META) {
p = seq->seqbase.first;
while (p) {
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
+ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
p = p->next;
}
}
else
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
+ outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
}
}
else if (type == TSE_SEQ_STRIP) {
@@ -1206,7 +1162,7 @@ static TreeElement *outliner_add_element(
for (a = 0; a < tot; a++) {
RNA_property_collection_lookup_int(ptr, iterprop, a, &propptr);
if (!(RNA_property_flag(propptr.data) & PROP_HIDDEN)) {
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
+ outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
}
}
}
@@ -1235,7 +1191,7 @@ static TreeElement *outliner_add_element(
if (pptr.data) {
if (TSELEM_OPEN(tselem, soops))
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
+ outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
else
te->flag |= TE_LAZY_CLOSED;
}
@@ -1247,7 +1203,7 @@ static TreeElement *outliner_add_element(
if (TSELEM_OPEN(tselem, soops)) {
for (a = 0; a < tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
+ outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
}
}
else if (tot)
@@ -1259,7 +1215,7 @@ static TreeElement *outliner_add_element(
if (TSELEM_OPEN(tselem, soops)) {
for (a = 0; a < tot; a++)
- outliner_add_element(soops, eval_ctx, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
+ outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
else if (tot)
te->flag |= TE_LAZY_CLOSED;
@@ -1307,8 +1263,7 @@ static TreeElement *outliner_add_element(
}
if (ot || kmi->propvalue) {
- TreeElement *ten = outliner_add_element(
- soops, eval_ctx, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
+ TreeElement *ten = outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
ten->directdata = kmi;
@@ -1330,8 +1285,7 @@ static TreeElement *outliner_add_element(
if ((type != TSE_LAYER_COLLECTION) && (te->idcode == ID_GR)) {
Group *group = (Group *)id;
- outliner_add_layer_collections_recursive(
- soops, eval_ctx, &te->subtree, id, &group->view_layer->layer_collections, NULL, true);
+ outliner_add_layer_collections_recursive(soops, &te->subtree, id, &group->view_layer->layer_collections, NULL, true);
}
return te;
@@ -1387,9 +1341,7 @@ static int need_add_seq_dup(Sequence *seq)
return(1);
}
-static void outliner_add_seq_dup(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- Sequence *seq, TreeElement *te, short index)
+static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
{
/* TreeElement *ch; */ /* UNUSED */
Sequence *p;
@@ -1402,8 +1354,7 @@ static void outliner_add_seq_dup(
}
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name))
- /* ch = */ /* UNUSED */ outliner_add_element(
- soops, eval_ctx, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
+ /* ch = */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
p = p->next;
}
}
@@ -1412,9 +1363,7 @@ static void outliner_add_seq_dup(
/* ----------------------------------------------- */
-static void outliner_add_library_contents(
- Main *mainvar, SpaceOops *soops, const EvaluationContext *eval_ctx,
- TreeElement *te, Library *lib)
+static void outliner_add_library_contents(Main *mainvar, SpaceOops *soops, TreeElement *te, Library *lib)
{
TreeElement *ten;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1431,7 +1380,7 @@ static void outliner_add_library_contents(
break;
if (id) {
- ten = outliner_add_element(soops, eval_ctx, &te->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(soops, &te->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
ten->directdata = lbarray[a];
ten->name = BKE_idcode_to_name_plural(GS(id->name));
@@ -1440,7 +1389,7 @@ static void outliner_add_library_contents(
for (id = lbarray[a]->first; id; id = id->next) {
if (id->lib == lib)
- outliner_add_element(soops, eval_ctx, &ten->subtree, id, ten, 0, 0);
+ outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
}
}
}
@@ -1448,7 +1397,7 @@ static void outliner_add_library_contents(
}
-static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops, const EvaluationContext *eval_ctx)
+static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops)
{
TreeElement *ten;
ListBase *lbarray[MAX_LIBARRAY];
@@ -1471,7 +1420,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops, co
* - Add a parameter to BKE_idcode_to_name_plural to get a sane "user-visible" name instead?
* - Ensure that this uses nice icons for the datablock type involved instead of the dot?
*/
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(soops, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
ten->directdata = lbarray[a];
ten->name = BKE_idcode_to_name_plural(GS(id->name));
@@ -1481,7 +1430,7 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOops *soops, co
/* add the orphaned datablocks - these will not be added with any subtrees attached */
for (id = lbarray[a]->first; id; id = id->next) {
if (ID_REAL_USERS(id) <= 0)
- outliner_add_element(soops, eval_ctx, &ten->subtree, id, ten, 0, 0);
+ outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
}
}
}
@@ -1527,24 +1476,22 @@ static bool outliner_layer_collections_reorder_poll(
}
static void outliner_add_layer_collections_recursive(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
+ SpaceOops *soops, ListBase *tree, ID *id, ListBase *layer_collections, TreeElement *parent_ten,
const bool show_objects)
{
for (LayerCollection *collection = layer_collections->first; collection; collection = collection->next) {
- TreeElement *ten = outliner_add_element(soops, eval_ctx, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
+ TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
ten->name = collection->scene_collection->name;
ten->directdata = collection;
ten->reinsert = outliner_layer_collections_reorder;
ten->reinsert_poll = outliner_layer_collections_reorder_poll;
- outliner_add_layer_collections_recursive(
- soops, eval_ctx, &ten->subtree, id, &collection->layer_collections, ten, show_objects);
+ outliner_add_layer_collections_recursive(soops, &ten->subtree, id, &collection->layer_collections, ten, show_objects);
if (show_objects) {
for (LinkData *link = collection->object_bases.first; link; link = link->next) {
Base *base = (Base *)link->data;
- TreeElement *te_object = outliner_add_element(soops, eval_ctx, &ten->subtree, base->object, ten, 0, 0);
+ TreeElement *te_object = outliner_add_element(soops, &ten->subtree, base->object, ten, 0, 0);
te_object->directdata = base;
}
}
@@ -1552,13 +1499,10 @@ static void outliner_add_layer_collections_recursive(
}
}
-static void outliner_add_view_layer(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, TreeElement *parent,
- Scene *scene, ViewLayer *layer, const bool show_objects)
+static void outliner_add_view_layer(SpaceOops *soops, ListBase *tree, TreeElement *parent,
+ Scene *scene, ViewLayer *layer, const bool show_objects)
{
- outliner_add_layer_collections_recursive(
- soops, eval_ctx, tree, &scene->id, &layer->layer_collections, parent, show_objects);
+ outliner_add_layer_collections_recursive(soops, tree, &scene->id, &layer->layer_collections, parent, show_objects);
}
static void outliner_scene_collections_reorder(
@@ -1629,40 +1573,35 @@ BLI_INLINE void outliner_add_scene_collection_init(TreeElement *te, SceneCollect
}
BLI_INLINE void outliner_add_scene_collection_objects(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, SceneCollection *collection, TreeElement *parent)
+ SpaceOops *soops, ListBase *tree, SceneCollection *collection, TreeElement *parent)
{
for (LinkData *link = collection->objects.first; link; link = link->next) {
- outliner_add_element(soops, eval_ctx, tree, link->data, parent, 0, 0);
+ outliner_add_element(soops, tree, link->data, parent, 0, 0);
}
}
static TreeElement *outliner_add_scene_collection_recursive(
- SpaceOops *soops, const EvaluationContext *eval_ctx,
- ListBase *tree, ID *id, SceneCollection *scene_collection, TreeElement *parent_ten)
+ SpaceOops *soops, ListBase *tree, ID *id, SceneCollection *scene_collection, TreeElement *parent_ten)
{
- TreeElement *ten = outliner_add_element(soops, eval_ctx, tree, id, parent_ten, TSE_SCENE_COLLECTION, 0);
+ TreeElement *ten = outliner_add_element(soops, tree, id, parent_ten, TSE_SCENE_COLLECTION, 0);
outliner_add_scene_collection_init(ten, scene_collection);
- outliner_add_scene_collection_objects(soops, eval_ctx, &ten->subtree, scene_collection, ten);
+ outliner_add_scene_collection_objects(soops, &ten->subtree, scene_collection, ten);
for (SceneCollection *scene_collection_nested = scene_collection->scene_collections.first;
scene_collection_nested != NULL;
scene_collection_nested = scene_collection_nested->next)
{
- outliner_add_scene_collection_recursive(
- soops, eval_ctx, &ten->subtree, id, scene_collection_nested, ten);
+ outliner_add_scene_collection_recursive(soops, &ten->subtree, id, scene_collection_nested, ten);
}
outliner_make_hierarchy(&ten->subtree);
return ten;
}
-static void outliner_add_collections(
- SpaceOops *soops, const EvaluationContext *eval_ctx, Scene *scene)
+static void outliner_add_collections(SpaceOops *soops, Scene *scene)
{
SceneCollection *master_collection = BKE_collection_master(&scene->id);
- TreeElement *ten = outliner_add_scene_collection_recursive(
- soops, eval_ctx, &soops->tree, &scene->id, master_collection, NULL);
+ TreeElement *ten = outliner_add_scene_collection_recursive(soops, &soops->tree, &scene->id, master_collection, NULL);
/* Master Collection should always be expanded. */
TREESTORE(ten)->flag &= ~TSE_CLOSED;
}
@@ -2227,9 +2166,7 @@ static void outliner_filter_tree(SpaceOops *soops, ViewLayer *view_layer)
/* Main entry point for building the tree data-structure that the outliner represents */
// TODO: split each mode into its own function?
-void outliner_build_tree(
- Main *mainvar, const EvaluationContext *eval_ctx, Scene *scene,
- ViewLayer *view_layer, SpaceOops *soops, ARegion *ar)
+void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOops *soops, ARegion *ar)
{
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
@@ -2262,20 +2199,20 @@ void outliner_build_tree(
Library *lib;
/* current file first - mainvar provides tselem with unique pointer - not used */
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, mainvar, NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(soops, &soops->tree, mainvar, NULL, TSE_ID_BASE, 0);
ten->name = IFACE_("Current File");
tselem = TREESTORE(ten);
if (!tselem->used)
tselem->flag &= ~TSE_CLOSED;
- outliner_add_library_contents(mainvar, soops, eval_ctx, ten, NULL);
+ outliner_add_library_contents(mainvar, soops, ten, NULL);
for (lib = mainvar->library.first; lib; lib = lib->id.next) {
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, lib, NULL, 0, 0);
+ ten = outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
lib->id.newid = (ID *)ten;
- outliner_add_library_contents(mainvar, soops, eval_ctx, ten, lib);
+ outliner_add_library_contents(mainvar, soops, ten, lib);
}
/* make hierarchy */
@@ -2295,8 +2232,8 @@ void outliner_build_tree(
}
else {
/* Else, make a new copy of the libtree for our parent. */
- TreeElement *dupten = outliner_add_element(soops, eval_ctx, &par->subtree, lib, NULL, 0, 0);
- outliner_add_library_contents(mainvar, soops, eval_ctx, dupten, lib);
+ TreeElement *dupten = outliner_add_element(soops, &par->subtree, lib, NULL, 0, 0);
+ outliner_add_library_contents(mainvar, soops, dupten, lib);
dupten->parent = par;
}
}
@@ -2310,7 +2247,7 @@ void outliner_build_tree(
else if (soops->outlinevis == SO_SCENES) {
Scene *sce;
for (sce = mainvar->scene.first; sce; sce = sce->id.next) {
- te = outliner_add_element(soops, eval_ctx, &soops->tree, sce, NULL, 0, 0);
+ te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
tselem = TREESTORE(te);
if (sce == scene && show_opened) {
@@ -2323,7 +2260,7 @@ void outliner_build_tree(
else if (soops->outlinevis == SO_GROUPS) {
Group *group;
for (group = mainvar->group.first; group; group = group->id.next) {
- te = outliner_add_element(soops, eval_ctx, &soops->tree, group, NULL, 0, 0);
+ te = outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
outliner_make_hierarchy(&te->subtree);
}
}
@@ -2342,11 +2279,11 @@ void outliner_build_tree(
while (seq) {
op = need_add_seq_dup(seq);
if (op == 1) {
- /* ten = */ outliner_add_element(soops, eval_ctx, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
+ /* ten = */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
}
else if (op == 0) {
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
- outliner_add_seq_dup(soops, eval_ctx, seq, ten, 0);
+ ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
+ outliner_add_seq_dup(soops, seq, ten, 0);
}
seq = seq->next;
}
@@ -2356,7 +2293,7 @@ void outliner_build_tree(
RNA_main_pointer_create(mainvar, &mainptr);
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
+ ten = outliner_add_element(soops, &soops->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
if (show_opened) {
tselem = TREESTORE(ten);
@@ -2364,36 +2301,36 @@ void outliner_build_tree(
}
}
else if (soops->outlinevis == SO_ID_ORPHANS) {
- outliner_add_orphaned_datablocks(mainvar, soops, eval_ctx);
+ outliner_add_orphaned_datablocks(mainvar, soops);
}
else if (soops->outlinevis == SO_VIEW_LAYER) {
if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- TreeElement *te_object = outliner_add_element(soops, eval_ctx, &soops->tree, base->object, NULL, 0, 0);
+ TreeElement *te_object = outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
te_object->directdata = base;
}
outliner_make_hierarchy(&soops->tree);
}
else {
- outliner_add_view_layer(soops, eval_ctx, &soops->tree, NULL, scene, view_layer, true);
+ outliner_add_view_layer(soops, &soops->tree, NULL, scene, view_layer, true);
}
}
else if (soops->outlinevis == SO_COLLECTIONS) {
if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
- outliner_add_element(soops, eval_ctx, &soops->tree, ob, NULL, 0, 0);
+ outliner_add_element(soops, &soops->tree, ob, NULL, 0, 0);
}
FOREACH_SCENE_OBJECT_END;
outliner_make_hierarchy(&soops->tree);
}
else {
- outliner_add_collections(soops, eval_ctx, scene);
+ outliner_add_collections(soops, scene);
}
}
else {
if (BASACT(view_layer)) {
- ten = outliner_add_element(soops, eval_ctx, &soops->tree, OBACT(view_layer), NULL, 0, 0);
+ ten = outliner_add_element(soops, &soops->tree, OBACT(view_layer), NULL, 0, 0);
ten->directdata = BASACT(view_layer);
}
}
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 9a736ae977f..42027f10fe6 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -402,7 +402,6 @@ static void time_draw_caches_keyframes(Main *bmain, ViewLayer *view_layer, View2
/* draw keyframe lines for timeline */
static void time_draw_keyframes(const bContext *C, ARegion *ar)
{
- WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = CTX_data_active_object(C);
@@ -444,7 +443,7 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar)
*/
UI_GetThemeColor3ubv(TH_TIME_KEYFRAME, color);
- if (ob && ((workspace->object_mode == OB_MODE_POSE) || onlysel)) {
+ if (ob && ((ob->mode == OB_MODE_POSE) || onlysel)) {
/* draw keyframes for active object only */
time_draw_idblock_keyframes(v2d, (ID *)ob, onlysel, color);
}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index f0adf307bda..77cd64be7c1 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -2667,10 +2667,8 @@ static void ghost_poses_tag_unselected(Object *ob, short unset)
* note: object should be in posemode
*/
static void draw_ghost_poses_range(
- const EvaluationContext *eval_ctx_init,
- Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base)
+ const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, ARegion *ar, Base *base)
{
- EvaluationContext eval_ctx = *eval_ctx_init;
Object *ob = base->object;
AnimData *adt = BKE_animdata_from_id(&ob->id);
bArmature *arm = ob->data;
@@ -2692,7 +2690,7 @@ static void draw_ghost_poses_range(
range = (float)(end - start);
/* store values */
- eval_ctx.object_mode &= ~OB_MODE_POSE;
+ ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
flago = arm->flag;
arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
@@ -2713,8 +2711,8 @@ static void draw_ghost_poses_range(
UI_GetThemeColorShadeAlpha4ubv(TH_WIRE, 0, -128 - (int)(120.0f * sqrtf(colfac)), col);
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
- BKE_pose_where_is(&eval_ctx, scene, ob);
- draw_pose_bones(&eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
+ BKE_pose_where_is(eval_ctx, scene, ob);
+ draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2730,17 +2728,16 @@ static void draw_ghost_poses_range(
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
- eval_ctx.object_mode |= OB_MODE_POSE;
+ ob->mode |= OB_MODE_POSE;
}
/* draw ghosts on keyframes in action within range
* - object should be in posemode
*/
static void draw_ghost_poses_keys(
- const struct EvaluationContext *eval_ctx_init, Scene *scene, ViewLayer *view_layer,
+ const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer,
View3D *v3d, ARegion *ar, Base *base)
{
- EvaluationContext eval_ctx = *eval_ctx_init;
Object *ob = base->object;
AnimData *adt = BKE_animdata_from_id(&ob->id);
bAction *act = (adt) ? adt->action : NULL;
@@ -2774,7 +2771,7 @@ static void draw_ghost_poses_keys(
if (range == 0) return;
/* store values */
- eval_ctx.object_mode &= ~OB_MODE_POSE;
+ ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
flago = arm->flag;
arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
@@ -2797,8 +2794,8 @@ static void draw_ghost_poses_keys(
CFRA = (int)ak->cfra;
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
- BKE_pose_where_is(&eval_ctx, scene, ob);
- draw_pose_bones(&eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
+ BKE_pose_where_is(eval_ctx, scene, ob);
+ draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
}
glDisable(GL_BLEND);
if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
@@ -2815,17 +2812,16 @@ static void draw_ghost_poses_keys(
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
- eval_ctx.object_mode |= OB_MODE_POSE;
+ ob->mode |= OB_MODE_POSE;
}
/* draw ghosts around current frame
* - object is supposed to be armature in posemode
*/
static void draw_ghost_poses(
- const struct EvaluationContext *eval_ctx_init, Scene *scene, ViewLayer *view_layer,
+ const struct EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer,
View3D *v3d, ARegion *ar, Base *base)
{
- EvaluationContext eval_ctx = *eval_ctx_init;
Object *ob = base->object;
AnimData *adt = BKE_animdata_from_id(&ob->id);
bArmature *arm = ob->data;
@@ -2850,7 +2846,7 @@ static void draw_ghost_poses(
range = (float)(arm->ghostep) * stepsize + 0.5f; /* plus half to make the for loop end correct */
/* store values */
- eval_ctx.object_mode &= ~OB_MODE_POSE;
+ ob->mode &= ~OB_MODE_POSE;
cfrao = CFRA;
actframe = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
flago = arm->flag;
@@ -2878,8 +2874,8 @@ static void draw_ghost_poses(
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
- BKE_pose_where_is(&eval_ctx, scene, ob);
- draw_pose_bones(&eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
+ BKE_pose_where_is(eval_ctx, scene, ob);
+ draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
}
}
@@ -2893,8 +2889,8 @@ static void draw_ghost_poses(
if (CFRA != cfrao) {
BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
- BKE_pose_where_is(&eval_ctx, scene, ob);
- draw_pose_bones(&eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
+ BKE_pose_where_is(eval_ctx, scene, ob);
+ draw_pose_bones(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, col, true, false);
}
}
}
@@ -2912,7 +2908,7 @@ static void draw_ghost_poses(
CFRA = cfrao;
ob->pose = poseo;
arm->flag = flago;
- eval_ctx.object_mode |= OB_MODE_POSE;
+ ob->mode |= OB_MODE_POSE;
}
/* ********************************** Armature Drawing - Main ************************* */
@@ -2974,11 +2970,11 @@ bool draw_armature(
}
else
#endif
- if (eval_ctx->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
arm->flag |= ARM_POSEMODE;
}
}
- else if (eval_ctx->object_mode & OB_MODE_POSE) {
+ else if (ob->mode & OB_MODE_POSE) {
if (arm->ghosttype == ARM_GHOST_RANGE) {
draw_ghost_poses_range(eval_ctx, scene, view_layer, v3d, ar, base);
}
@@ -2992,7 +2988,7 @@ bool draw_armature(
if ((dflag & DRAW_SCENESET) == 0) {
if (ob == OBACT(view_layer))
arm->flag |= ARM_POSEMODE;
- else if (OBACT(view_layer) && (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT)) {
+ else if (OBACT(view_layer) && (OBACT(view_layer)->mode & OB_MODE_WEIGHT_PAINT)) {
if (ob == modifiers_isDeformedByArmature(OBACT(view_layer)))
arm->flag |= ARM_POSEMODE;
}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index c014c2b12a0..0d4ec4d42d1 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -59,8 +59,6 @@
#include "UI_resources.h"
-#include "DEG_depsgraph.h"
-
#include "GPU_draw.h"
#include "GPU_material.h"
#include "GPU_basic_shader.h"
@@ -327,10 +325,8 @@ void draw_mesh_paint_weight_edges(RegionView3D *rv3d, DerivedMesh *dm,
}
}
-void draw_mesh_paint(
- const EvaluationContext *eval_ctx,
- View3D *v3d, RegionView3D *rv3d,
- Object *ob, DerivedMesh *dm, const int draw_flags)
+void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
+ Object *ob, DerivedMesh *dm, const int draw_flags)
{
DMSetDrawOptions facemask = NULL;
Mesh *me = ob->data;
@@ -340,21 +336,21 @@ void draw_mesh_paint(
if (me->editflag & (ME_EDIT_PAINT_VERT_SEL | ME_EDIT_PAINT_FACE_SEL))
facemask = wpaint__setSolidDrawOptions_facemask;
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT) {
draw_mesh_paint_weight_faces(dm, use_light, facemask, me);
}
- else if (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT) {
+ else if (ob->mode & OB_MODE_VERTEX_PAINT) {
draw_mesh_paint_vcolor_faces(dm, use_light, facemask, me, me);
}
/* draw face selection on top */
if (draw_flags & DRAW_FACE_SELECT) {
- bool draw_select_edges = (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) == 0;
+ bool draw_select_edges = (ob->mode & OB_MODE_TEXTURE_PAINT) == 0;
draw_mesh_face_select(rv3d, me, dm, draw_select_edges);
}
else if ((use_light == false) || (ob->dtx & OB_DRAWWIRE)) {
- const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT);
- const bool use_alpha = (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT) == 0;
+ const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) || !(ob->mode & OB_MODE_WEIGHT_PAINT);
+ const bool use_alpha = (ob->mode & OB_MODE_VERTEX_PAINT) == 0;
if (use_alpha == false) {
set_inverted_drawing(1);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index f46d3c500bc..2c6d977b552 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -314,15 +314,13 @@ static bool check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
/* check for glsl drawing */
-bool draw_glsl_material(
- const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer,
- Object *ob, View3D *v3d, const char dt)
+bool draw_glsl_material(Scene *scene, ViewLayer *view_layer, Object *ob, View3D *v3d, const char dt)
{
if (G.f & G_PICKSEL)
return false;
if (!check_object_draw_texture(scene, v3d, dt))
return false;
- if (ob == OBACT(view_layer) && (ob && eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT))
+ if (ob == OBACT(view_layer) && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
return false;
if (v3d->flag2 & V3D_SHOW_SOLID_MATCAP)
@@ -336,7 +334,7 @@ bool draw_glsl_material(
return false;
}
-static bool check_alpha_pass(const EvaluationContext *eval_ctx, Base *base)
+static bool check_alpha_pass(Base *base)
{
if (base->flag_legacy & OB_FROMDUPLI)
return false;
@@ -344,9 +342,8 @@ static bool check_alpha_pass(const EvaluationContext *eval_ctx, Base *base)
if (G.f & G_PICKSEL)
return false;
- if (eval_ctx->object_mode & OB_MODE_ALL_PAINT) {
+ if (base->object->mode & OB_MODE_ALL_PAINT)
return false;
- }
return (base->object->dtx & OB_DRAWTRANSP);
}
@@ -3893,9 +3890,8 @@ static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
}
}
-static void draw_em_fancy(
- const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d,
- Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const char dt)
+static void draw_em_fancy(Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d,
+ Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, const char dt)
{
RegionView3D *rv3d = ar->regiondata;
@@ -3932,7 +3928,7 @@ static void draw_em_fancy(
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
else if (check_object_draw_texture(scene, v3d, dt)) {
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt)) {
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt)) {
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
finalDM->drawMappedFacesGLSL(finalDM, GPU_object_material_bind,
@@ -4225,12 +4221,10 @@ static void draw_em_fancy_new(Scene *UNUSED(scene), ARegion *UNUSED(ar), View3D
/* Mesh drawing routines */
-void draw_mesh_object_outline(
- const EvaluationContext *eval_ctx, View3D *v3d,
- Object *ob, DerivedMesh *dm, const unsigned char ob_wire_col[4]) /* LEGACY */
+void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm, const unsigned char ob_wire_col[4]) /* LEGACY */
{
if ((v3d->transp == false) && /* not when we draw the transparent pass */
- (eval_ctx->object_mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
+ (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
{
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(GL_FALSE);
@@ -4253,12 +4247,10 @@ void draw_mesh_object_outline(
}
}
-static void draw_mesh_object_outline_new(
- const EvaluationContext *eval_ctx, View3D *v3d, RegionView3D *rv3d,
- Mesh *me, const bool is_active)
+static void draw_mesh_object_outline_new(View3D *v3d, RegionView3D *rv3d, Object *ob, Mesh *me, const bool is_active)
{
if ((v3d->transp == false) && /* not when we draw the transparent pass */
- (eval_ctx->object_mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
+ (ob->mode & OB_MODE_ALL_PAINT) == false) /* not when painting (its distracting) - campbell */
{
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
glDepthMask(GL_FALSE);
@@ -4308,9 +4300,7 @@ static void draw_mesh_fancy(
const char dt, const unsigned char ob_wire_col[4], const short dflag)
{
#ifdef WITH_GAMEENGINE
- Object *ob = (
- (rv3d->rflag & RV3D_IS_GAME_ENGINE) ?
- BKE_object_lod_meshob_get(base->object, view_layer, eval_ctx->object_mode) : base->object);
+ Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object;
#else
Object *ob = base->object;
#endif
@@ -4319,7 +4309,7 @@ static void draw_mesh_fancy(
bool /* no_verts,*/ no_edges, no_faces;
DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask);
const bool is_obact = (ob == OBACT(view_layer));
- int draw_flags = (is_obact && BKE_paint_select_face_test(ob, eval_ctx->object_mode)) ? DRAW_FACE_SELECT : 0;
+ int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0;
if (!dm)
return;
@@ -4357,7 +4347,7 @@ static void draw_mesh_fancy(
draw_bounding_volume(ob, ob->boundtype, ob_wire_col);
}
else if ((no_faces && no_edges) ||
- ((!is_obact || (eval_ctx->object_mode == OB_MODE_OBJECT)) && object_is_halo(scene, ob)))
+ ((!is_obact || (ob->mode == OB_MODE_OBJECT)) && object_is_halo(scene, ob)))
{
glPointSize(1.5f);
dm->drawVerts(dm);
@@ -4365,7 +4355,7 @@ static void draw_mesh_fancy(
else if ((dt == OB_WIRE) || no_faces) {
draw_wire = OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff */
}
- else if (((is_obact && eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT)) ||
+ else if (((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
check_object_draw_texture(scene, v3d, dt))
{
bool draw_loose = true;
@@ -4376,17 +4366,15 @@ static void draw_mesh_fancy(
!(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
(draw_wire == OBDRAW_WIRE_OFF))
{
- draw_mesh_object_outline(eval_ctx, v3d, ob, dm, ob_wire_col);
+ draw_mesh_object_outline(v3d, ob, dm, ob_wire_col);
}
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
Paint *p;
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
- if ((v3d->flag2 & V3D_SHOW_SOLID_MATCAP) && ob->sculpt &&
- (p = BKE_paint_get_active(scene, view_layer, eval_ctx->object_mode)))
- {
+ if ((v3d->flag2 & V3D_SHOW_SOLID_MATCAP) && ob->sculpt && (p = BKE_paint_get_active(scene, view_layer))) {
GPUVertexAttribs gattribs;
float planes[4][4];
float (*fpl)[4] = NULL;
@@ -4449,7 +4437,7 @@ static void draw_mesh_fancy(
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
- draw_mesh_object_outline(eval_ctx, v3d, ob, dm, ob_wire_col);
+ draw_mesh_object_outline(v3d, ob, dm, ob_wire_col);
}
/* materials arent compatible with vertex colors */
@@ -4473,12 +4461,12 @@ static void draw_mesh_fancy(
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
- draw_mesh_object_outline(eval_ctx, v3d, ob, dm, ob_wire_col);
+ draw_mesh_object_outline(v3d, ob, dm, ob_wire_col);
}
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
- if (ob->sculpt && (p = BKE_paint_get_active(scene, view_layer, eval_ctx->object_mode))) {
+ if (ob->sculpt && (p = BKE_paint_get_active(scene, view_layer))) {
float planes[4][4];
float (*fpl)[4] = NULL;
const bool fast = (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
@@ -4510,7 +4498,7 @@ static void draw_mesh_fancy(
}
}
else if (dt == OB_PAINT) {
- draw_mesh_paint(eval_ctx, v3d, rv3d, ob, dm, draw_flags);
+ draw_mesh_paint(v3d, rv3d, ob, dm, draw_flags);
/* since we already draw wire as wp guide, don't draw over the top */
draw_wire = OBDRAW_WIRE_OFF;
@@ -4525,7 +4513,7 @@ static void draw_mesh_fancy(
* with the background. */
if ((dflag & DRAW_CONSTCOLOR) == 0) {
- if (is_obact && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ if (is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
float color[3];
ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.15f, color);
glColor3fv(color);
@@ -4558,7 +4546,7 @@ static void draw_mesh_fancy(
}
}
- if (is_obact && BKE_paint_select_vert_test(ob, eval_ctx->object_mode)) {
+ if (is_obact && BKE_paint_select_vert_test(ob)) {
const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) != 0;
glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
@@ -4577,7 +4565,7 @@ static bool draw_mesh_object(
const char dt, const unsigned char ob_wire_col[4], const short dflag)
{
Object *ob = base->object;
- Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
bool do_alpha_after = false, drawlinked = false, retval = false;
@@ -4627,13 +4615,13 @@ static bool draw_mesh_object(
if (use_material) {
if (dt > OB_WIRE) {
- const bool glsl = draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt);
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, eval_ctx->object_mode, NULL);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, NULL);
}
}
- draw_em_fancy(eval_ctx, scene, view_layer, ar, v3d, ob, em, cageDM, finalDM, dt);
+ draw_em_fancy(scene, view_layer, ar, v3d, ob, em, cageDM, finalDM, dt);
if (use_material) {
GPU_end_object_materials();
@@ -4646,13 +4634,12 @@ static bool draw_mesh_object(
/* ob->bb was set by derived mesh system, do NULL check just to be sure */
if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->bb))) {
if (dt > OB_WIRE) {
- const bool glsl = draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt);
if (dt == OB_SOLID || glsl) {
- const bool check_alpha = check_alpha_pass(eval_ctx, base);
- GPU_begin_object_materials(
- v3d, rv3d, scene, view_layer, ob,
- glsl, eval_ctx->object_mode, (check_alpha) ? &do_alpha_after : NULL);
+ const bool check_alpha = check_alpha_pass(base);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl,
+ (check_alpha) ? &do_alpha_after : NULL);
}
}
@@ -4731,9 +4718,7 @@ static void draw_mesh_fancy_new(
}
#ifdef WITH_GAMEENGINE
- Object *ob = (
- (rv3d->rflag & RV3D_IS_GAME_ENGINE) ?
- BKE_object_lod_meshob_get(base->object, view_layer, eval_ctx->object_mode) : base->object);
+ Object *ob = (rv3d->rflag & RV3D_IS_GAME_ENGINE) ? BKE_object_lod_meshob_get(base->object, view_layer) : base->object;
#else
Object *ob = base->object;
#endif
@@ -4742,7 +4727,7 @@ static void draw_mesh_fancy_new(
bool no_edges, no_faces;
DerivedMesh *dm = mesh_get_derived_final(eval_ctx, scene, ob, scene->customdata_mask);
const bool is_obact = (ob == OBACT(view_layer));
- int draw_flags = (is_obact && BKE_paint_select_face_test(ob, eval_ctx->object_mode)) ? DRAW_FACE_SELECT : 0;
+ int draw_flags = (is_obact && BKE_paint_select_face_test(ob)) ? DRAW_FACE_SELECT : 0;
if (!dm)
return;
@@ -4785,7 +4770,7 @@ static void draw_mesh_fancy_new(
draw_bounding_volume(ob, ob->boundtype, ob_wire_col);
}
else if ((no_faces && no_edges) ||
- ((!is_obact || (eval_ctx->object_mode == OB_MODE_OBJECT)) && object_is_halo(scene, ob)))
+ ((!is_obact || (ob->mode == OB_MODE_OBJECT)) && object_is_halo(scene, ob)))
{
glPointSize(1.5f);
// dm->drawVerts(dm);
@@ -4851,7 +4836,7 @@ static void draw_mesh_fancy_new(
GWN_batch_draw(batch);
#endif
}
- else if (((is_obact && eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT)) ||
+ else if (((is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
check_object_draw_texture(scene, v3d, dt))
{
bool draw_loose = true;
@@ -4862,17 +4847,15 @@ static void draw_mesh_fancy_new(
!(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
(draw_wire == OBDRAW_WIRE_OFF))
{
- draw_mesh_object_outline_new(eval_ctx, v3d, rv3d, me, (ob == OBACT(view_layer)));
+ draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT(view_layer)));
}
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
Paint *p;
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
- if ((v3d->flag2 & V3D_SHOW_SOLID_MATCAP) && ob->sculpt &&
- (p = BKE_paint_get_active(scene, view_layer, eval_ctx->object_mode)))
- {
+ if ((v3d->flag2 & V3D_SHOW_SOLID_MATCAP) && ob->sculpt && (p = BKE_paint_get_active(scene, view_layer))) {
GPUVertexAttribs gattribs;
float planes[4][4];
float (*fpl)[4] = NULL;
@@ -4931,7 +4914,7 @@ static void draw_mesh_fancy_new(
(draw_wire == OBDRAW_WIRE_OFF) &&
(ob->sculpt == NULL))
{
- draw_mesh_object_outline_new(eval_ctx, v3d, rv3d, me, (ob == OBACT(view_layer)));
+ draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT(view_layer)));
}
/* materials arent compatible with vertex colors */
@@ -4956,12 +4939,12 @@ static void draw_mesh_fancy_new(
(ob->sculpt == NULL))
{
/* TODO: move this into a separate pass */
- draw_mesh_object_outline_new(eval_ctx, v3d, rv3d, me, (ob == OBACT(view_layer)));
+ draw_mesh_object_outline_new(v3d, rv3d, ob, me, (ob == OBACT(view_layer)));
}
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
- if (ob->sculpt && (p = BKE_paint_get_active(scene, view_layer, eval_ctx->object_mode))) {
+ if (ob->sculpt && (p = BKE_paint_get_active(scene, view_layer))) {
float planes[4][4];
float (*fpl)[4] = NULL;
const bool fast = (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
@@ -4993,7 +4976,7 @@ static void draw_mesh_fancy_new(
}
}
else if (dt == OB_PAINT) {
- draw_mesh_paint(eval_ctx, v3d, rv3d, ob, dm, draw_flags);
+ draw_mesh_paint(v3d, rv3d, ob, dm, draw_flags);
/* since we already draw wire as wp guide, don't draw over the top */
draw_wire = OBDRAW_WIRE_OFF;
@@ -5055,7 +5038,7 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)(
/* TODO: handle shadow pass separately */
return true;
}
- Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(eval_ctx->view_layer);
if (obedit && ob != obedit && ob->data == obedit->data) {
if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {}
@@ -5100,9 +5083,9 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)(
DM_update_materials(cageDM, ob);
}
- const bool glsl = draw_glsl_material(eval_ctx, scene, eval_ctx->view_layer, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, eval_ctx->view_layer, ob, v3d, dt);
- GPU_begin_object_materials(v3d, rv3d, scene, eval_ctx->view_layer, ob, glsl, eval_ctx->object_mode, NULL);
+ GPU_begin_object_materials(v3d, rv3d, scene, eval_ctx->view_layer, ob, glsl, NULL);
}
draw_em_fancy_new(scene, ar, v3d, ob, me, em, cageDM, finalDM, dt);
@@ -5118,13 +5101,12 @@ static bool UNUSED_FUNCTION(draw_mesh_object_new)(
/* ob->bb was set by derived mesh system, do NULL check just to be sure */
if (me->totpoly <= 4 || (!ob->bb || ED_view3d_boundbox_clip(rv3d, ob->bb))) {
if (solid) {
- const bool glsl = draw_glsl_material(eval_ctx, scene, eval_ctx->view_layer, ob, v3d, dt);
+ const bool glsl = draw_glsl_material(scene, eval_ctx->view_layer, ob, v3d, dt);
if (dt == OB_SOLID || glsl) {
- const bool check_alpha = check_alpha_pass(eval_ctx, base);
- GPU_begin_object_materials(
- v3d, rv3d, scene, eval_ctx->view_layer, ob,
- eval_ctx->object_mode, glsl, (check_alpha) ? &do_alpha_after : NULL);
+ const bool check_alpha = check_alpha_pass(base);
+ GPU_begin_object_materials(v3d, rv3d, scene, eval_ctx->view_layer, ob, glsl,
+ (check_alpha) ? &do_alpha_after : NULL);
}
}
@@ -5441,9 +5423,7 @@ static void drawCurveDMWired(Object *ob)
}
/* return true when nothing was drawn */
-static bool drawCurveDerivedMesh(
- const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d,
- Base *base, const char dt)
+static bool drawCurveDerivedMesh(Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base, const char dt)
{
Object *ob = base->object;
DerivedMesh *dm = ob->derivedFinal;
@@ -5457,10 +5437,8 @@ static bool drawCurveDerivedMesh(
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
if (dt > OB_WIRE && dm->getNumPolys(dm)) {
- bool glsl = draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt);
- GPU_begin_object_materials(
- v3d, rv3d, scene, view_layer, ob,
- eval_ctx->object_mode, glsl, NULL);
+ bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, NULL);
if (!glsl)
dm->drawFacesSolid(dm, NULL, 0, GPU_object_material_bind);
@@ -5481,9 +5459,8 @@ static bool drawCurveDerivedMesh(
* Only called by #drawDispList
* \return true when nothing was drawn
*/
-static bool drawDispList_nobackface(
- const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d,
- Base *base, const char dt, const short dflag, const unsigned char ob_wire_col[4])
+static bool drawDispList_nobackface(Scene *scene, ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, Base *base,
+ const char dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
ListBase *lb = NULL;
@@ -5523,13 +5500,13 @@ static bool drawDispList_nobackface(
/* pass */
}
else {
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt)) {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, eval_ctx->object_mode, NULL);
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt)) {
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, eval_ctx->object_mode, NULL);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
@@ -5558,13 +5535,13 @@ static bool drawDispList_nobackface(
if (dl->nors == NULL) BKE_displist_normals_add(lb);
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt)) {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, eval_ctx->object_mode, NULL);
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt)) {
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, eval_ctx->object_mode, NULL);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
@@ -5583,13 +5560,13 @@ static bool drawDispList_nobackface(
if (solid) {
- if (draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt)) {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, eval_ctx->object_mode, NULL);
+ if (draw_glsl_material(scene, view_layer, ob, v3d, dt)) {
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 1, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, true);
GPU_end_object_materials();
}
else {
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, eval_ctx->object_mode, NULL);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, 0, NULL);
drawDispListsolid(lb, ob, dflag, ob_wire_col, false);
GPU_end_object_materials();
}
@@ -5620,7 +5597,7 @@ static bool drawDispList(
ensure_curve_cache(eval_ctx, scene, base->object);
#endif
- if (drawCurveDerivedMesh(eval_ctx, scene, view_layer, v3d, rv3d, base, dt) == false) {
+ if (drawCurveDerivedMesh(scene, view_layer, v3d, rv3d, base, dt) == false) {
retval = false;
}
else {
@@ -5636,7 +5613,7 @@ static bool drawDispList(
glFrontFace(mode);
- retval = drawDispList_nobackface(eval_ctx, scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col);
+ retval = drawDispList_nobackface(scene, view_layer, v3d, rv3d, base, dt, dflag, ob_wire_col);
if (mode != GL_CCW) {
glFrontFace(GL_CCW);
@@ -5960,7 +5937,7 @@ static void draw_new_particle_system(
if (pars == NULL) return;
/* don't draw normal paths in edit mode */
- if (psys_in_edit_mode(eval_ctx, eval_ctx->view_layer, psys) && (pset->flag & PE_DRAW_PART) == 0)
+ if (psys_in_edit_mode(eval_ctx->view_layer, psys) && (pset->flag & PE_DRAW_PART) == 0)
return;
if (part->draw_as == PART_DRAW_REND)
@@ -8319,7 +8296,7 @@ static void draw_object_selected_outline(
if (has_faces && ED_view3d_boundbox_clip(rv3d, ob->bb)) {
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
if (dm) {
- draw_mesh_object_outline(eval_ctx, v3d, ob, dm, ob_wire_col);
+ draw_mesh_object_outline(v3d, ob, dm, ob_wire_col);
}
else {
/* only draw 'solid' parts of the display list as wire. */
@@ -8336,7 +8313,7 @@ static void draw_object_selected_outline(
}
}
else if (ob->type == OB_ARMATURE) {
- if (!(eval_ctx->object_mode & OB_MODE_POSE && base == view_layer->basact)) {
+ if (!(ob->mode & OB_MODE_POSE && base == view_layer->basact)) {
glLineWidth(UI_GetThemeValuef(TH_OUTLINE_WIDTH) * 2.0f);
draw_armature(eval_ctx, scene, view_layer, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true);
}
@@ -8447,13 +8424,11 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
immUnbindProgram();
}
-void draw_object_wire_color(
- const EvaluationContext *eval_ctx, ViewLayer *view_layer,
- Base *base, unsigned char r_ob_wire_col[4])
+void draw_object_wire_color(ViewLayer *view_layer, Base *base, unsigned char r_ob_wire_col[4])
{
Object *ob = base->object;
int colindex = 0;
- const bool is_edit = (eval_ctx->object_mode & OB_MODE_EDIT) != 0;
+ const bool is_edit = (ob->mode & OB_MODE_EDIT) != 0;
/* confusing logic here, there are 2 methods of setting the color
* 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
*
@@ -8461,7 +8436,7 @@ void draw_object_wire_color(
int theme_id = is_edit ? TH_WIRE_EDIT : TH_WIRE;
int theme_shade = 0;
- if (((eval_ctx->object_mode & OB_MODE_EDIT) == 0) &&
+ if (((ob->mode & OB_MODE_EDIT) == 0) &&
(G.moving & G_TRANSFORM_OBJ) &&
((base->flag & BASE_SELECTED) || (base->flag_legacy & BA_WAS_SEL)))
{
@@ -8515,12 +8490,10 @@ void draw_object_wire_color(
r_ob_wire_col[3] = 255;
}
-static void draw_object_matcap_check(
- const EvaluationContext *eval_ctx, View3D *v3d, Object *ob)
+static void draw_object_matcap_check(View3D *v3d, Object *ob)
{
/* fixed rule, active object draws as matcap */
- BLI_assert((eval_ctx->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) == 0);
- UNUSED_VARS_NDEBUG(eval_ctx);
+ BLI_assert((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) == 0);
(void)ob;
if (v3d->defmaterial == NULL) {
@@ -8606,9 +8579,10 @@ void draw_object(
unsigned char _ob_wire_col[4]; /* dont initialize this */
const unsigned char *ob_wire_col = NULL; /* dont initialize this, use NULL crashes as a way to find invalid use */
bool zbufoff = false, is_paint = false, empty_object = false;
- const bool is_obact = (ob == OBACT(view_layer));
+ Object *ob_active = OBACT(view_layer);
+ const bool is_obact = (ob == ob_active);
/* this could be moved to a 'dflag'. */
- const bool is_obedit = (is_obact && (ob == OBEDIT_FROM_EVAL_CTX(eval_ctx)));
+ const bool is_obedit = (is_obact && (ob == OBEDIT_FROM_OBACT(ob_active)));
const bool render_override = (v3d->flag2 & V3D_RENDER_OVERRIDE) != 0;
const bool is_picking = (G.f & G_PICKSEL) != 0;
const bool has_particles = (ob->particlesystem.first != NULL);
@@ -8634,7 +8608,7 @@ void draw_object(
return;
}
- if (eval_ctx->object_mode == OB_MODE_OBJECT) {
+ if (ob->mode == OB_MODE_OBJECT) {
ParticleSystem *psys;
skip_object = render_override;
@@ -8674,7 +8648,7 @@ void draw_object(
/* xray delay? */
if ((dflag & DRAW_PICKING) == 0 && (base->flag_legacy & OB_FROMDUPLI) == 0 && (v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
/* don't do xray in particle mode, need the z-buffer */
- if (!(eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
/* xray and transp are set when it is drawing the 2nd/3rd pass */
if (!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
ED_view3d_after_add(&v3d->afterdraw_xray, base, dflag);
@@ -8725,7 +8699,7 @@ void draw_object(
ED_view3d_project_base(ar, base);
- draw_object_wire_color(eval_ctx, view_layer, base, _ob_wire_col);
+ draw_object_wire_color(view_layer, base, _ob_wire_col);
ob_wire_col = _ob_wire_col;
//glColor3ubv(ob_wire_col);
@@ -8741,14 +8715,14 @@ void draw_object(
/* faceselect exception: also draw solid when (dt == wire), except in editmode */
if (is_obact) {
- if (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) {
if (ob->type == OB_MESH) {
if (dt < OB_SOLID) {
zbufoff = true;
dt = OB_SOLID;
}
- if (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
+ if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
dt = OB_PAINT;
}
@@ -8764,13 +8738,13 @@ void draw_object(
(is_paint == false && is_picking == false) &&
((v3d->flag2 & V3D_RENDER_SHADOW) == 0))
{
- draw_object_matcap_check(eval_ctx, v3d, ob);
+ draw_object_matcap_check(v3d, ob);
}
/* draw-extra supported for boundbox drawmode too */
if (dt >= OB_BOUNDBOX) {
dtx = ob->dtx;
- if (eval_ctx->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
/* the only 2 extra drawtypes alowed in editmode */
dtx = dtx & (OB_DRAWWIRE | OB_TEXSPACE);
}
@@ -8779,7 +8753,7 @@ void draw_object(
if (!skip_object) {
/* draw outline for selected objects, mesh does itself */
if ((v3d->flag & V3D_SELECT_OUTLINE) && !render_override && ob->type != OB_MESH) {
- if (dt > OB_WIRE && (eval_ctx->object_mode & OB_MODE_EDIT) == 0 && (dflag & DRAW_SCENESET) == 0) {
+ if (dt > OB_WIRE && (ob->mode & OB_MODE_EDIT) == 0 && (dflag & DRAW_SCENESET) == 0) {
if (!(ob->dtx & OB_DRAWWIRE) && (base->flag & BASE_SELECTED) && !(dflag & (DRAW_PICKING | DRAW_CONSTCOLOR))) {
draw_object_selected_outline(eval_ctx, scene, view_layer, v3d, ar, base, ob_wire_col);
}
@@ -8887,7 +8861,7 @@ void draw_object(
case OB_LATTICE:
if (!render_override) {
/* Do not allow boundbox in edit nor pose mode! */
- if ((dt == OB_BOUNDBOX) && (eval_ctx->object_mode & OB_MODE_EDIT))
+ if ((dt == OB_BOUNDBOX) && (ob->mode & OB_MODE_EDIT))
dt = OB_WIRE;
if (dt == OB_BOUNDBOX) {
draw_bounding_volume(ob, ob->boundtype, ob_wire_col);
@@ -8903,7 +8877,7 @@ void draw_object(
case OB_ARMATURE:
if (!render_override) {
/* Do not allow boundbox in edit nor pose mode! */
- if ((dt == OB_BOUNDBOX) && (eval_ctx->object_mode & (OB_MODE_EDIT | OB_MODE_POSE)))
+ if ((dt == OB_BOUNDBOX) && (ob->mode & (OB_MODE_EDIT | OB_MODE_POSE)))
dt = OB_WIRE;
if (dt == OB_BOUNDBOX) {
draw_bounding_volume(ob, ob->boundtype, ob_wire_col);
@@ -8971,7 +8945,7 @@ afterdraw:
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
/* run this so that possible child particles get cached */
- if (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT && is_obact) {
+ if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob);
if (edit && edit->psys == psys)
draw_update_ptcache_edit(eval_ctx, scene, ob, edit);
@@ -8992,7 +8966,7 @@ afterdraw:
(is_obedit == false))
{
- if (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT && is_obact) {
+ if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
PTCacheEdit *edit = PE_create_current(eval_ctx, scene, ob);
if (edit) {
gpuLoadMatrix(rv3d->viewmat);
@@ -9093,7 +9067,7 @@ afterdraw:
}
}
- if ((ob->gameflag & OB_BOUNDS) && (eval_ctx->object_mode == OB_MODE_OBJECT)) {
+ if ((ob->gameflag & OB_BOUNDS) && (ob->mode == OB_MODE_OBJECT)) {
if (ob->boundtype != ob->collision_boundtype || (dtx & OB_DRAWBOUNDOX) == 0) {
setlinestyle(2);
draw_bounding_volume(ob, ob->collision_boundtype, ob_wire_col);
@@ -9189,7 +9163,7 @@ afterdraw:
}
/* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
- if (!is_obact || !(eval_ctx->object_mode & OB_MODE_ALL_PAINT)) {
+ if (!is_obact || !(ob->mode & OB_MODE_ALL_PAINT)) {
int do_draw_center = -1; /* defines below are zero or positive... */
if (render_override) {
@@ -9789,7 +9763,7 @@ void draw_object_backbufsel(
switch (ob->type) {
case OB_MESH:
- if (eval_ctx->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
Mesh *me = ob->data;
BMEditMesh *em = me->edit_btmesh;
@@ -9835,7 +9809,7 @@ void draw_object_backbufsel(
Mesh *me = ob->data;
if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) &&
/* currently vertex select supports weight paint and vertex paint*/
- ((eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) || (eval_ctx->object_mode & OB_MODE_VERTEX_PAINT)))
+ ((ob->mode & OB_MODE_WEIGHT_PAINT) || (ob->mode & OB_MODE_VERTEX_PAINT)))
{
bbs_mesh_solid_verts(eval_ctx, scene, ob);
}
@@ -9864,7 +9838,7 @@ static void draw_object_mesh_instance(
Mesh *me = ob->data;
DerivedMesh *dm = NULL, *edm = NULL;
- if (eval_ctx->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
edm = editbmesh_get_derived_base(ob, me->edit_btmesh, CD_MASK_BAREMESH);
DM_update_materials(edm, ob);
}
@@ -9882,11 +9856,11 @@ static void draw_object_mesh_instance(
}
else {
if (outline)
- draw_mesh_object_outline(eval_ctx, v3d, ob, dm ? dm : edm, ob_wire_col);
+ draw_mesh_object_outline(v3d, ob, dm ? dm : edm, ob_wire_col);
if (dm) {
- bool glsl = draw_glsl_material(eval_ctx, scene, view_layer, ob, v3d, dt);
- GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, eval_ctx->object_mode, NULL);
+ bool glsl = draw_glsl_material(scene, view_layer, ob, v3d, dt);
+ GPU_begin_object_materials(v3d, rv3d, scene, view_layer, ob, glsl, NULL);
}
glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 3cf915cd029..abfbccdcc27 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -910,7 +910,9 @@ static void view3d_main_region_listener(
case ND_SELECT:
{
WM_manipulatormap_tag_refresh(mmap);
- Object *obedit = OBEDIT_FROM_WINDOW(wmn->window);
+
+ ViewLayer *view_layer = WM_window_get_active_view_layer(wmn->window);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
if (obedit) {
/* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */
DEG_id_tag_update((ID *)obedit->data, DEG_TAG_SELECT_UPDATE);
@@ -1127,8 +1129,9 @@ static void view3d_main_region_message_subscribe(
/* concept is to retrieve cursor type context-less */
static void view3d_main_region_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
{
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- if (workspace->object_mode & OB_MODE_EDIT) {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ if (obedit) {
WM_cursor_set(win, CURSOR_EDIT);
}
else {
@@ -1380,9 +1383,9 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
if (view_layer->basact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
+ Object *ob = view_layer->basact->object;
/* if hidden but in edit mode, we still display, can happen with animation */
- if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (workspace->object_mode & OB_MODE_EDIT)) {
+ if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (ob->mode & OB_MODE_EDIT)) {
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, view_layer->basact);
}
}
@@ -1392,10 +1395,9 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
else if (CTX_data_equals(member, "active_object")) {
ViewLayer *view_layer = CTX_data_view_layer(C);
if (view_layer->basact) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *ob = view_layer->basact->object;
/* if hidden but in edit mode, we still display, can happen with animation */
- if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (workspace->object_mode & OB_MODE_EDIT) != 0) {
+ if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (ob->mode & OB_MODE_EDIT) != 0) {
CTX_data_id_pointer_set(result, &ob->id);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index bd62a4fc3bf..644a6956e54 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -787,12 +787,10 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
-
if (ob && (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)))
{
MDeformVert *dvert_act = ED_mesh_active_dvert_get_only(ob);
if (dvert_act) {
@@ -1130,7 +1128,6 @@ static int view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt))
static void view3d_panel_transform(const bContext *C, Panel *pa)
{
uiBlock *block;
- const WorkSpace *workspace = CTX_wm_workspace(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
@@ -1155,7 +1152,7 @@ static void view3d_panel_transform(const bContext *C, Panel *pa)
v3d_editvertex_buts(col, v3d, ob, lim);
}
}
- else if (workspace->object_mode & OB_MODE_POSE) {
+ else if (ob->mode & OB_MODE_POSE) {
v3d_posearmature_buts(col, ob);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 152d7de4924..596bf28f6b7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -751,7 +751,7 @@ void ED_view3d_draw_depth(
else
#endif /* WITH_OPENGL_LEGACY */
{
- DRW_draw_depth_loop(graph, ar, v3d, eval_ctx->object_mode);
+ DRW_draw_depth_loop(graph, ar, v3d);
}
if (rv3d->rflag & RV3D_CLIPPING) {
@@ -1325,7 +1325,7 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
}
-static bool is_cursor_visible(const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer)
+static bool is_cursor_visible(Scene *scene, ViewLayer *view_layer)
{
if (U.app_flag & USER_APP_VIEW3D_HIDE_CURSOR) {
return false;
@@ -1334,16 +1334,16 @@ static bool is_cursor_visible(const EvaluationContext *eval_ctx, Scene *scene, V
Object *ob = OBACT(view_layer);
/* don't draw cursor in paint modes, but with a few exceptions */
- if (ob && eval_ctx->object_mode & OB_MODE_ALL_PAINT) {
+ if (ob && ob->mode & OB_MODE_ALL_PAINT) {
/* exception: object is in weight paint and has deforming armature in pose mode */
- if (eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT) {
if (BKE_object_pose_armature_get(ob) != NULL) {
return true;
}
}
/* exception: object in texture paint mode, clone brush, use_clone_layer disabled */
- else if (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) {
- const Paint *p = BKE_paint_get_active(scene, view_layer, eval_ctx->object_mode);
+ else if (ob->mode & OB_MODE_TEXTURE_PAINT) {
+ const Paint *p = BKE_paint_get_active(scene, view_layer);
if (p && p->brush && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) {
if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) {
@@ -1718,8 +1718,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
* framenum, object name, bone name (if available), marker name (if available)
*/
-static void draw_selected_name(
- Scene *scene, Object *ob, const eObjectMode object_mode, const rcti *rect)
+static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
{
const int cfra = CFRA;
const char *msg_pin = " (Pinned)";
@@ -1761,7 +1760,7 @@ static void draw_selected_name(
s += BLI_strcpy_rlen(s, arm->act_edbone->name);
}
}
- else if (object_mode & OB_MODE_POSE) {
+ else if (ob->mode & OB_MODE_POSE) {
if (arm->act_bone) {
if (arm->act_bone->layer & arm->layer) {
@@ -1774,9 +1773,9 @@ static void draw_selected_name(
else if (ELEM(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
/* try to display active bone and active shapekey too (if they exist) */
- if (ob->type == OB_MESH && object_mode & OB_MODE_WEIGHT_PAINT) {
+ if (ob->type == OB_MESH && ob->mode & OB_MODE_WEIGHT_PAINT) {
Object *armobj = BKE_object_pose_armature_get(ob);
- if (armobj) {
+ if (armobj && armobj->mode & OB_MODE_POSE) {
bArmature *arm = armobj->data;
if (arm->act_bone) {
if (arm->act_bone->layer & arm->layer) {
@@ -1863,10 +1862,9 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
}
if (U.uiflag & USER_DRAWVIEWINFO) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- draw_selected_name(scene, ob, workspace->object_mode, &rect);
+ draw_selected_name(scene, ob, &rect);
}
#if 0 /* TODO */
if (grid_unit) { /* draw below the viewport name */
@@ -1960,7 +1958,7 @@ void ED_view3d_draw_offscreen_init(const EvaluationContext *eval_ctx, Scene *sce
RenderEngineType *engine_type = eval_ctx->engine_type;
if (engine_type->flag & RE_USE_LEGACY_PIPELINE) {
/* shadow buffers, before we setup matrices */
- if (draw_glsl_material(eval_ctx, scene, view_layer, NULL, v3d, v3d->drawtype)) {
+ if (draw_glsl_material(scene, view_layer, NULL, v3d, v3d->drawtype)) {
VP_deprecated_gpu_update_lamps_shadows_world(eval_ctx, scene, v3d);
}
}
@@ -2051,7 +2049,7 @@ void ED_view3d_draw_offscreen(
}
else {
DRW_draw_render_loop_offscreen(
- eval_ctx->depsgraph, eval_ctx->engine_type, ar, v3d, eval_ctx->object_mode,
+ depsgraph, eval_ctx->engine_type, ar, v3d,
do_sky, ofs, viewport);
}
@@ -2331,10 +2329,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
*
* \{ */
-void VP_legacy_drawcursor(
- const EvaluationContext *eval_ctx, Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d)
+void VP_legacy_drawcursor(Scene *scene, ViewLayer *view_layer, ARegion *ar, View3D *v3d)
{
- if (is_cursor_visible(eval_ctx, scene, view_layer)) {
+ if (is_cursor_visible(scene, view_layer)) {
drawcursor(scene, ar, v3d);
}
}
@@ -2349,9 +2346,9 @@ void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect)
draw_viewport_name(ar, v3d, rect);
}
-void VP_legacy_draw_selected_name(Scene *scene, Object *ob, eObjectMode object_mode, const rcti *rect)
+void VP_legacy_draw_selected_name(Scene *scene, Object *ob, rcti *rect)
{
- draw_selected_name(scene, ob, object_mode, rect);
+ draw_selected_name(scene, ob, rect);
}
void VP_legacy_drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit)
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index b7a1c8663f4..f1c251891b0 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -219,23 +219,23 @@ static void backdrawview3d(
BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
- if (obact && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) ||
- BKE_paint_select_face_test(obact, eval_ctx->object_mode)))
+ if (obact && (obact->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) ||
+ BKE_paint_select_face_test(obact)))
{
/* do nothing */
}
/* texture paint mode sampling */
- else if (obact && (eval_ctx->object_mode & OB_MODE_TEXTURE_PAINT) &&
+ else if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT) &&
(v3d->drawtype > OB_WIRE))
{
/* do nothing */
}
- else if ((obact && (eval_ctx->object_mode & OB_MODE_PARTICLE_EDIT)) &&
+ else if ((obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) &&
V3D_IS_ZBUF(v3d))
{
/* do nothing */
}
- else if ((eval_ctx->object_mode & OB_MODE_EDIT) && (obedit != NULL) &&
+ else if ((obedit && (obedit->mode & OB_MODE_EDIT)) &&
V3D_IS_ZBUF(v3d))
{
/* do nothing */
@@ -1504,7 +1504,7 @@ static void view3d_draw_objects(
Depsgraph *depsgraph = CTX_data_depsgraph(C);
RegionView3D *rv3d = ar->regiondata;
Base *base;
- Object *obedit = OBEDIT_FROM_EVAL_CTX(eval_ctx);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
const bool do_camera_frame = !draw_offscreen;
const bool draw_grids = !draw_offscreen && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0;
const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO);
@@ -1934,9 +1934,8 @@ static void update_lods(Scene *scene, float camera_pos[3])
}
#endif
-static void view3d_main_region_draw_objects(
- const bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d,
- ARegion *ar, const char **grid_unit)
+static void view3d_main_region_draw_objects(const bContext *C, Scene *scene, ViewLayer *view_layer, View3D *v3d,
+ ARegion *ar, const char **grid_unit)
{
wmWindow *win = CTX_wm_window(C);
EvaluationContext eval_ctx;
@@ -1946,7 +1945,7 @@ static void view3d_main_region_draw_objects(
CTX_data_eval_ctx(C, &eval_ctx);
/* shadow buffers, before we setup matrices */
- if (draw_glsl_material(&eval_ctx, scene, view_layer, NULL, v3d, v3d->drawtype))
+ if (draw_glsl_material(scene, view_layer, NULL, v3d, v3d->drawtype))
gpu_update_lamps_shadows_world(&eval_ctx, scene, v3d);
/* reset default OpenGL lights if needed (i.e. after preferences have been altered) */
@@ -1988,13 +1987,10 @@ static void view3d_main_region_draw_objects(
}
}
-static void view3d_main_region_draw_info(
- const bContext *C, Scene *scene,
- ARegion *ar, View3D *v3d,
- const char *grid_unit, bool render_border)
+static void view3d_main_region_draw_info(const bContext *C, Scene *scene,
+ ARegion *ar, View3D *v3d,
+ const char *grid_unit, bool render_border)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
const Depsgraph *depsgraph = CTX_data_depsgraph(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
wmWindowManager *wm = CTX_wm_manager(C);
@@ -2017,7 +2013,7 @@ static void view3d_main_region_draw_info(
}
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- VP_legacy_drawcursor(&eval_ctx, scene, view_layer, ar, v3d); /* 3D cursor */
+ VP_legacy_drawcursor(scene, view_layer, ar, v3d); /* 3D cursor */
if (U.uiflag & USER_SHOW_ROTVIEWICON)
VP_legacy_draw_view_axis(rv3d, &rect);
@@ -2026,7 +2022,7 @@ static void view3d_main_region_draw_info(
if (U.uiflag & USER_DRAWVIEWINFO) {
Object *ob = OBACT(view_layer);
- VP_legacy_draw_selected_name(scene, ob, eval_ctx.object_mode, &rect);
+ VP_legacy_draw_selected_name(scene, ob, &rect);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 45284c1805a..0ae69debf18 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -244,22 +244,21 @@ void view3d_orbit_apply_dyn_ofs(
static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
{
static float lastofs[3] = {0, 0, 0};
- const WorkSpace *workspace = CTX_wm_workspace(C);
bool is_set = false;
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob_act = OBACT(view_layer);
- if (ob_act && (workspace->object_mode & OB_MODE_ALL_PAINT) &&
+ if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) &&
/* with weight-paint + pose-mode, fall through to using calculateTransformCenter */
- ((workspace->object_mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob_act)) == 0)
+ ((ob_act->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob_act)) == 0)
{
/* in case of sculpting use last average stroke position as a rotation
* center, in other cases it's not clear what rotation center shall be
* so just rotate around object origin
*/
- if (workspace->object_mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
+ if (ob_act->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
float stroke[3];
BKE_paint_stroke_get_average(scene, ob_act, stroke);
copy_v3_v3(lastofs, stroke);
@@ -269,7 +268,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
}
is_set = true;
}
- else if (ob_act && (workspace->object_mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) {
+ else if (ob_act && (ob_act->mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) {
Curve *cu = ob_act->data;
EditFont *ef = cu->editfont;
int i;
@@ -284,7 +283,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
is_set = true;
}
- else if (ob_act == NULL || workspace->object_mode == OB_MODE_OBJECT) {
+ else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) {
/* object mode use boundbox centers */
Base *base;
unsigned int tot = 0;
@@ -2793,7 +2792,6 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
/* like a localview without local!, was centerview() in 2.4x */
static int viewselected_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
@@ -2817,10 +2815,16 @@ static int viewselected_exec(bContext *C, wmOperator *op)
ob = NULL;
}
- if (ob && (workspace->object_mode & OB_MODE_WEIGHT_PAINT)) {
- Object *ob_armature = BKE_object_pose_armature_get_visible(ob, view_layer);
- if (ob_armature) {
- ob = ob_armature;
+ if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+ /* hard-coded exception, we look for the one selected armature */
+ /* this is weak code this way, we should make a generic active/selection callback interface once... */
+ Base *base;
+ for (base = view_layer->object_bases.first; base; base = base->next) {
+ if (TESTBASELIB(base)) {
+ if (base->object->type == OB_ARMATURE)
+ if (base->object->mode & OB_MODE_POSE)
+ break;
+ }
}
}
@@ -2842,17 +2846,17 @@ static int viewselected_exec(bContext *C, wmOperator *op)
else if (obedit) {
ok = ED_view3d_minmax_verts(obedit, min, max); /* only selected */
}
- else if (ob && (workspace->object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
ok = BKE_pose_minmax(ob, min, max, true, true);
}
- else if (BKE_paint_select_face_test(ob, workspace->object_mode)) {
+ else if (BKE_paint_select_face_test(ob)) {
ok = paintface_minmax(ob, min, max);
}
- else if (ob && (workspace->object_mode & OB_MODE_PARTICLE_EDIT)) {
+ else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
ok = PE_minmax(scene, view_layer, min, max);
}
else if (ob &&
- (workspace->object_mode & (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)))
+ (ob->mode & (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)))
{
BKE_paint_stroke_get_average(scene, ob, min);
copy_v3_v3(max, min);
@@ -2964,8 +2968,7 @@ static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op))
v3d->ob_centre = obact; /* can be NULL */
if (obact && obact->type == OB_ARMATURE) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_POSE) {
+ if (obact->mode & OB_MODE_POSE) {
bPoseChannel *pcham_act = BKE_pose_channel_active(obact);
if (pcham_act) {
BLI_strncpy(v3d->ob_centre_bone, pcham_act->name, sizeof(v3d->ob_centre_bone));
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 35a37590642..3ed6c87b750 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -276,7 +276,6 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa = CTX_wm_area(C);
View3D *v3d = sa->spacedata.first;
@@ -291,7 +290,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
uiLayout *row;
bool is_paint = (
ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
- ELEM(workspace->object_mode,
+ ELEM(ob->mode,
OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT));
RNA_pointer_create(&screen->id, &RNA_SpaceView3D, v3d, &v3dptr);
@@ -306,18 +305,18 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
row = uiLayoutRow(layout, true);
uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
- if (!ob || ELEM(workspace->object_mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
+ if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) {
uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
if (obedit == NULL && is_paint) {
/* Manipulators aren't used in paint modes */
- if (!ELEM(workspace->object_mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) {
+ if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) {
/* masks aren't used for sculpt and particle painting */
PointerRNA meshptr;
RNA_pointer_create(ob->data, &RNA_Mesh, ob->data, &meshptr);
- if (workspace->object_mode & (OB_MODE_TEXTURE_PAINT)) {
+ if (ob->mode & (OB_MODE_TEXTURE_PAINT)) {
uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
}
else {
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 56e5c4e932c..0f56f1265bc 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -54,7 +54,6 @@ struct wmKeyConfig;
struct wmManipulatorGroupType;
struct wmManipulatorType;
struct wmWindowManager;
-struct EvaluationContext;
/* drawing flags: */
enum {
@@ -155,19 +154,13 @@ void draw_object_select(
const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, struct ARegion *ar, View3D *v3d,
Base *base, const short dflag);
-void draw_mesh_object_outline(
- const struct EvaluationContext *eval_ctx, View3D *v3d,
- struct Object *ob, struct DerivedMesh *dm, const unsigned char ob_wire_col[4]);
+void draw_mesh_object_outline(View3D *v3d, struct Object *ob, struct DerivedMesh *dm, const unsigned char ob_wire_col[4]);
-bool draw_glsl_material(
- const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer,
- struct Object *ob, View3D *v3d, const char dt);
+bool draw_glsl_material(Scene *scene, struct ViewLayer *view_layer, struct Object *ob, View3D *v3d, const char dt);
void draw_object_instance(const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, View3D *v3d, RegionView3D *rv3d, struct Object *ob, const char dt, int outline, const float wire_col[4]);
void draw_object_backbufsel(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Object *ob);
-void draw_object_wire_color(
- const struct EvaluationContext *eval_ctx, struct ViewLayer *,
- Base *base, unsigned char r_ob_wire_col[4]);
+void draw_object_wire_color(struct ViewLayer *, Base *base, unsigned char r_ob_wire_col[4]);
void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const unsigned char color[4]);
void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
const char dt, const short dflag, const unsigned char ob_wire_col[4],
@@ -216,10 +209,8 @@ void draw_mesh_paint_vcolor_faces(struct DerivedMesh *dm, const bool use_light,
void draw_mesh_paint_weight_edges(RegionView3D *rv3d, struct DerivedMesh *dm,
const bool use_depth, const bool use_alpha,
void *edgemask_cb, void *user_data);
-void draw_mesh_paint(
- const struct EvaluationContext *eval_ctx,
- View3D *v3d, RegionView3D *rv3d,
- struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
+void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d,
+ struct Object *ob, struct DerivedMesh *dm, const int draw_flags);
/* drawsimdebug.c */
void draw_sim_debug_data(Scene *scene, View3D *v3d, ARegion *ar);
@@ -376,12 +367,10 @@ extern bool view3d_camera_border_hack_test;
#endif
/* temporary for legacy viewport to work */
-void VP_legacy_drawcursor(
- const struct EvaluationContext *eval_ctx, Scene *scene,
- struct ViewLayer *view_layer, ARegion *ar, View3D *v3d);
+void VP_legacy_drawcursor(Scene *scene, struct ViewLayer *view_layer, ARegion *ar, View3D *v3d);
void VP_legacy_draw_view_axis(RegionView3D *rv3d, const rcti *rect);
void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect);
-void VP_legacy_draw_selected_name(Scene *scene, struct Object *ob, eObjectMode object_mode, const rcti *rect);
+void VP_legacy_draw_selected_name(Scene *scene, struct Object *ob, rcti *rect);
void VP_legacy_drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit);
void VP_legacy_drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool write_depth);
void VP_legacy_view3d_main_region_setup_view(const struct EvaluationContext *eval_ctx, Scene *scene, View3D *v3d, ARegion *ar, float viewmat[4][4], float winmat[4][4]);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 0d37d0bd680..be8e63dffe6 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -210,7 +210,6 @@ static void edbm_backbuf_check_and_select_tfaces(Mesh *me, const bool select)
/* *********************** GESTURE AND LASSO ******************* */
typedef struct LassoSelectUserData {
- const EvaluationContext *eval_ctx;
ViewContext *vc;
const rcti *rect;
const rctf *rect_fl;
@@ -254,15 +253,14 @@ static int view3d_selectable_data(bContext *C)
return 0;
if (ob) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_EDIT) {
+ if (ob->mode & OB_MODE_EDIT) {
if (ob->type == OB_FONT) {
return 0;
}
}
else {
- if ((workspace->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) &&
- !BKE_paint_select_elem_test(ob, workspace->object_mode))
+ if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) &&
+ !BKE_paint_select_elem_test(ob))
{
return 0;
}
@@ -393,7 +391,6 @@ static void object_deselect_all_visible(ViewLayer *view_layer)
}
static void do_lasso_select_objects(
- const EvaluationContext *eval_ctx,
ViewContext *vc, const int mcords[][2], const short moves,
const bool extend, const bool select)
{
@@ -410,7 +407,7 @@ static void do_lasso_select_objects(
ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
}
}
- if (vc->obact == base->object && (eval_ctx->object_mode & OB_MODE_POSE)) {
+ if (vc->obact == base->object && (base->object->mode & OB_MODE_POSE)) {
do_lasso_select_pose(vc, base->object, mcords, moves, select);
}
}
@@ -466,7 +463,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, cons
}
static void do_lasso_select_mesh(
- const EvaluationContext *eval_ctx, ViewContext *vc,
+ const struct EvaluationContext *eval_ctx, ViewContext *vc,
const int mcords[][2], short moves, bool extend, bool select)
{
LassoSelectUserData data;
@@ -522,8 +519,7 @@ static void do_lasso_select_mesh(
EDBM_selectmode_flush(vc->em);
}
-static void do_lasso_select_curve__doSelect(
- void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
+static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, const float screen_co[2])
{
LassoSelectUserData *data = userData;
Object *obedit = data->vc->obedit;
@@ -598,8 +594,7 @@ static void do_lasso_select_lattice(ViewContext *vc, const int mcords[][2], shor
lattice_foreachScreenVert(vc, do_lasso_select_lattice__doSelect, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
-static void do_lasso_select_armature__doSelectBone(
- void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
+static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBone *ebone, const float screen_co_a[2], const float screen_co_b[2])
{
LassoSelectUserData *data = userData;
bArmature *arm = data->vc->obedit->data;
@@ -705,8 +700,7 @@ static void do_lasso_select_meta(ViewContext *vc, const int mcords[][2], short m
mball_foreachScreenElem(vc, do_lasso_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
-static void do_lasso_select_meshobject__doSelectVert(
- void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
+static void do_lasso_select_meshobject__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
{
LassoSelectUserData *data = userData;
@@ -716,9 +710,7 @@ static void do_lasso_select_meshobject__doSelectVert(
SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
-static void do_lasso_select_paintvert(
- const EvaluationContext *eval_ctx,
- ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
+static void do_lasso_select_paintvert(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
Object *ob = vc->obact;
@@ -749,8 +741,8 @@ static void do_lasso_select_paintvert(
ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d);
- meshobject_foreachScreenVert(
- eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ meshobject_foreachScreenVert(eval_ctx, vc, do_lasso_select_meshobject__doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+
}
if (select == false) {
@@ -758,9 +750,7 @@ static void do_lasso_select_paintvert(
}
paintvert_flush_flags(ob);
}
-static void do_lasso_select_paintface(
- const EvaluationContext *eval_ctx,
- ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
+static void do_lasso_select_paintface(const struct EvaluationContext *eval_ctx, ViewContext *vc, const int mcords[][2], short moves, bool extend, bool select)
{
Object *ob = vc->obact;
Mesh *me = ob->data;
@@ -826,20 +816,20 @@ static void view3d_lasso_select(
CTX_data_eval_ctx(C, &eval_ctx);
if (vc->obedit == NULL) { /* Object Mode */
- if (BKE_paint_select_face_test(ob, eval_ctx.object_mode)) {
+ if (BKE_paint_select_face_test(ob)) {
do_lasso_select_paintface(&eval_ctx, vc, mcords, moves, extend, select);
}
- else if (BKE_paint_select_vert_test(ob, eval_ctx.object_mode)) {
+ else if (BKE_paint_select_vert_test(ob)) {
do_lasso_select_paintvert(&eval_ctx, vc, mcords, moves, extend, select);
}
- else if (ob && (eval_ctx.object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) {
+ else if (ob && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) {
/* pass */
}
- else if (ob && (eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT)) {
+ else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
PE_lasso_select(C, mcords, moves, extend, select);
}
else {
- do_lasso_select_objects(&eval_ctx, vc, mcords, moves, extend, select);
+ do_lasso_select_objects(vc, mcords, moves, extend, select);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
}
}
@@ -1510,10 +1500,7 @@ static bool ed_object_select_pick(
}
}
}
- else if (ED_do_pose_selectbuffer(
- &eval_ctx, view_layer,
- basact, buffer, hits, extend, deselect, toggle, do_nearest))
- {
+ else if (ED_do_pose_selectbuffer(view_layer, basact, buffer, hits, extend, deselect, toggle, do_nearest)) {
/* then bone is found */
/* we make the armature selected:
@@ -1526,7 +1513,7 @@ static bool ed_object_select_pick(
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
- if (BASACT(view_layer) && (eval_ctx.object_mode & OB_MODE_WEIGHT_PAINT)) {
+ if (BASACT(view_layer) && (BASACT(view_layer)->object->mode & OB_MODE_WEIGHT_PAINT)) {
/* prevent activating */
basact = NULL;
}
@@ -1624,8 +1611,7 @@ bool edge_inside_circle(const float cent[2], float radius, const float screen_co
return (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < radius_squared);
}
-static void do_paintvert_box_select__doSelectVert(
- void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
+static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
{
BoxSelectUserData *data = userData;
@@ -1824,7 +1810,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, const
}
}
static int do_mesh_box_select(
- const EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend)
+ const struct EvaluationContext *eval_ctx, ViewContext *vc, rcti *rect, bool select, bool extend)
{
BoxSelectUserData data;
ToolSettings *ts = vc->scene->toolsettings;
@@ -1878,7 +1864,7 @@ static int do_mesh_box_select(
}
static int do_meta_box_select(
- const EvaluationContext *eval_ctx, ViewContext *vc,
+ const struct EvaluationContext *eval_ctx, ViewContext *vc,
const rcti *rect, bool select, bool extend)
{
MetaBall *mb = (MetaBall *)vc->obedit->data;
@@ -1914,7 +1900,7 @@ static int do_meta_box_select(
}
static int do_armature_box_select(
- const EvaluationContext *eval_ctx, ViewContext *vc,
+ const struct EvaluationContext *eval_ctx, ViewContext *vc,
const rcti *rect, bool select, bool extend)
{
bArmature *arm = vc->obedit->data;
@@ -2023,7 +2009,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
CTX_data_eval_ctx(C, &eval_ctx);
- if ((ob) && (eval_ctx.object_mode & OB_MODE_POSE))
+ if ((ob) && (ob->mode & OB_MODE_POSE))
bone_only = 1;
else
bone_only = 0;
@@ -2178,16 +2164,16 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
}
}
else { /* no editmode, unified for bones and objects */
- if (vc.obact && eval_ctx.object_mode & OB_MODE_SCULPT) {
+ if (vc.obact && vc.obact->mode & OB_MODE_SCULPT) {
ret = ED_sculpt_mask_box_select(C, &vc, &rect, select, extend);
}
- else if (vc.obact && BKE_paint_select_face_test(vc.obact, eval_ctx.object_mode)) {
+ else if (vc.obact && BKE_paint_select_face_test(vc.obact)) {
ret = do_paintface_box_select(&eval_ctx, &vc, &rect, select, extend);
}
- else if (vc.obact && BKE_paint_select_vert_test(vc.obact, eval_ctx.object_mode)) {
+ else if (vc.obact && BKE_paint_select_vert_test(vc.obact)) {
ret = do_paintvert_box_select(&eval_ctx, &vc, &rect, select, extend);
}
- else if (vc.obact && eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) {
+ else if (vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) {
ret = PE_border_select(C, &rect, select, extend);
}
else { /* object mode with none active */
@@ -2273,7 +2259,6 @@ static bool ed_wpaint_vertex_select_pick(
static int view3d_select_exec(bContext *C, wmOperator *op)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
bool extend = RNA_boolean_get(op->ptr, "extend");
@@ -2285,9 +2270,9 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
* or paint-select to allow pose bone select with vert/face select */
bool object = (RNA_boolean_get(op->ptr, "object") &&
(obedit ||
- BKE_paint_select_elem_test(obact, workspace->object_mode) ||
+ BKE_paint_select_elem_test(obact) ||
/* so its possible to select bones in weightpaint mode (LMB select) */
- (obact && (workspace->object_mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact))));
+ (obact && (obact->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact))));
bool retval = false;
int location[2];
@@ -2321,11 +2306,11 @@ static int view3d_select_exec(bContext *C, wmOperator *op)
retval = ED_curve_editfont_select_pick(C, location, extend, deselect, toggle);
}
- else if (obact && workspace->object_mode & OB_MODE_PARTICLE_EDIT)
+ else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
return PE_mouse_particles(C, location, extend, deselect, toggle);
- else if (obact && BKE_paint_select_face_test(obact, workspace->object_mode))
+ else if (obact && BKE_paint_select_face_test(obact))
retval = paintface_mouse_select(C, obact, location, extend, deselect, toggle);
- else if (BKE_paint_select_vert_test(obact, workspace->object_mode))
+ else if (BKE_paint_select_vert_test(obact))
retval = ed_wpaint_vertex_select_pick(C, location, extend, deselect, toggle, obact);
else
retval = ed_object_select_pick(C, location, extend, deselect, toggle, center, enumerate, object);
@@ -2432,9 +2417,7 @@ static void mesh_circle_doSelectFace(void *userData, BMFace *efa, const float sc
}
}
-static void mesh_circle_select(
- const EvaluationContext *eval_ctx,
- ViewContext *vc, const bool select, const int mval[2], float rad)
+static void mesh_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
{
ToolSettings *ts = vc->scene->toolsettings;
int bbsel;
@@ -2478,9 +2461,7 @@ static void mesh_circle_select(
EDBM_selectmode_flush(vc->em);
}
-static void paint_facesel_circle_select(
- const EvaluationContext *eval_ctx,
- ViewContext *vc, const bool select, const int mval[2], float rad)
+static void paint_facesel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
{
Object *ob = vc->obact;
Mesh *me = ob->data;
@@ -2496,8 +2477,7 @@ static void paint_facesel_circle_select(
}
}
-static void paint_vertsel_circle_select_doSelectVert(
- void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
+static void paint_vertsel_circle_select_doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index))
{
CircleSelectUserData *data = userData;
@@ -2505,8 +2485,7 @@ static void paint_vertsel_circle_select_doSelectVert(
SET_FLAG_FROM_TEST(mv->flag, data->select, SELECT);
}
}
-static void paint_vertsel_circle_select(
- const EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
+static void paint_vertsel_circle_select(const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
{
const bool use_zbuf = (vc->v3d->flag & V3D_ZBUF_SELECT) != 0;
Object *ob = vc->obact;
@@ -2529,8 +2508,7 @@ static void paint_vertsel_circle_select(
ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */
view3d_userdata_circleselect_init(&data, vc, select, mval, rad);
- meshobject_foreachScreenVert(
- eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
+ meshobject_foreachScreenVert(eval_ctx, vc, paint_vertsel_circle_select_doSelectVert, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
}
if (select != LEFTMOUSE) {
@@ -2788,7 +2766,7 @@ static void mball_circle_select(ViewContext *vc, const bool select, const int mv
/** Callbacks for circle selection in Editmode */
static void obedit_circle_select(
- const EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
+ const struct EvaluationContext *eval_ctx, ViewContext *vc, const bool select, const int mval[2], float rad)
{
switch (vc->obedit->type) {
case OB_MESH:
@@ -2843,48 +2821,53 @@ static bool object_circle_select(ViewContext *vc, const bool select, const int m
/* not a real operator, only for circle test */
static int view3d_circle_select_exec(bContext *C, wmOperator *op)
{
- ViewContext vc;
- ED_view3d_viewcontext_init(C, &vc);
- Object *obact = vc.obact;
- Object *obedit = vc.obedit;
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
+ Scene *scene = CTX_data_scene(C);
+ Object *obact = CTX_data_active_object(C);
const int radius = RNA_int_get(op->ptr, "radius");
const bool select = !RNA_boolean_get(op->ptr, "deselect");
const int mval[2] = {RNA_int_get(op->ptr, "x"),
RNA_int_get(op->ptr, "y")};
- if (obedit || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) ||
- (obact && (eval_ctx.object_mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) )
+ if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(obact) ||
+ (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) )
{
+ EvaluationContext eval_ctx;
+ ViewContext vc;
+
view3d_operator_needs_opengl(C);
+
+ CTX_data_eval_ctx(C, &eval_ctx);
+ ED_view3d_viewcontext_init(C, &vc);
if (CTX_data_edit_object(C)) {
obedit_circle_select(&eval_ctx, &vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
}
- else if (BKE_paint_select_face_test(obact, eval_ctx.object_mode)) {
+ else if (BKE_paint_select_face_test(obact)) {
paint_facesel_circle_select(&eval_ctx, &vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
}
- else if (BKE_paint_select_vert_test(obact, eval_ctx.object_mode)) {
+ else if (BKE_paint_select_vert_test(obact)) {
paint_vertsel_circle_select(&eval_ctx, &vc, select, mval, (float)radius);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
}
- else if (eval_ctx.object_mode & OB_MODE_POSE)
+ else if (obact->mode & OB_MODE_POSE)
pose_circle_select(&vc, select, mval, (float)radius);
else
return PE_circle_select(C, select, mval, (float)radius);
}
- else if (obact && eval_ctx.object_mode & OB_MODE_SCULPT) {
+ else if (obact && obact->mode & OB_MODE_SCULPT) {
return OPERATOR_CANCELLED;
}
else {
+ ViewContext vc;
+ ED_view3d_viewcontext_init(C, &vc);
+
if (object_circle_select(&vc, select, mval, (float)radius)) {
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc.scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
}
-
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 40dd2f0f428..1df29201bf6 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -113,7 +113,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
{
- if (eval_ctx.object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan;
bArmature *arm = ob->data;
@@ -272,7 +272,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global
ED_transverts_update_obedit(&tvs, obedit);
ED_transverts_free(&tvs);
}
- else if (obact && (eval_ctx.object_mode & OB_MODE_POSE)) {
+ else if (obact && (obact->mode & OB_MODE_POSE)) {
struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
bPoseChannel *pchan;
@@ -554,8 +554,6 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -601,7 +599,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3])
else {
Object *obact = CTX_data_active_object(C);
- if (obact && (eval_ctx.object_mode & OB_MODE_POSE)) {
+ if (obact && (obact->mode & OB_MODE_POSE)) {
bArmature *arm = obact->data;
bPoseChannel *pchan;
for (pchan = obact->pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -703,8 +701,7 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r
Object *ob = CTX_data_active_object(C);
if (ob) {
- const WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan = BKE_pose_channel_active(ob);
if (pchan) {
if (!select_only || (pchan->bone->flag & BONE_SELECTED)) {
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 4225ee8b425..1a547d07b80 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -918,7 +918,7 @@ int view3d_opengl_select(
ARegion *ar = vc->ar;
rcti rect;
int hits;
- const bool use_obedit_skip = (OBEDIT_FROM_EVAL_CTX(eval_ctx) != NULL) && (vc->obedit == NULL);
+ const bool use_obedit_skip = (OBEDIT_FROM_VIEW_LAYER(vc->view_layer) != NULL) && (vc->obedit == NULL);
const bool is_pick_select = (U.gpu_select_pick_deph != 0);
const bool do_passes = (
(is_pick_select == false) &&
@@ -1016,7 +1016,7 @@ int view3d_opengl_select(
.gpu_select_mode = gpu_select_mode,
};
DRW_draw_select_loop(
- graph, ar, v3d, eval_ctx->object_mode,
+ graph, ar, v3d,
use_obedit_skip, use_nearest, &rect,
drw_select_loop_pass, &drw_select_loop_user_data);
hits = drw_select_loop_user_data.hits;
@@ -1104,13 +1104,11 @@ int ED_view3d_view_layer_set(int lay, const int *values, int *active)
static ListBase queue_back;
static void game_engine_save_state(bContext *C, wmWindow *win)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *obact = CTX_data_active_object(C);
glPushAttrib(GL_ALL_ATTRIB_BITS);
- if (obact && eval_ctx.object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
GPU_paint_set_mipmap(1);
}
@@ -1121,11 +1119,9 @@ static void game_engine_save_state(bContext *C, wmWindow *win)
static void game_engine_restore_state(bContext *C, wmWindow *win)
{
- EvaluationContext eval_ctx;
- CTX_data_eval_ctx(C, &eval_ctx);
Object *obact = CTX_data_active_object(C);
- if (obact && eval_ctx.object_mode & OB_MODE_TEXTURE_PAINT) {
+ if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
GPU_paint_set_mipmap(0);
}
/* check because closing win can set to NULL */
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index b198918b698..fe05207e645 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -655,7 +655,7 @@ void restoreBones(TransInfo *t);
#define MANIPULATOR_AXIS_LINE_WIDTH 2.0f
/* return 0 when no gimbal for selection */
-bool gimbal_axis(struct Object *ob, float gmat[3][3], const eObjectMode object_mode);
+bool gimbal_axis(struct Object *ob, float gmat[3][3]);
/*********************** TransData Creation and General Handling *********** */
void createTransData(struct bContext *C, TransInfo *t);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 3ccf65a8a69..2d7ff1eb523 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -998,7 +998,7 @@ static short pose_grab_with_ik(Object *ob)
Bone *bonec;
short tot_ik = 0;
- if ((ob == NULL) || (ob->pose == NULL))
+ if ((ob == NULL) || (ob->pose == NULL) || (ob->mode & OB_MODE_POSE) == 0)
return 0;
arm = ob->data;
@@ -2559,7 +2559,7 @@ static void createTransEditVerts(TransInfo *t)
/* detect CrazySpace [tm] */
if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1) != -1) {
int totleft = -1;
- if (modifiers_isCorrectableDeformed(&t->eval_ctx, t->scene, t->obedit)) {
+ if (modifiers_isCorrectableDeformed(t->scene, t->obedit)) {
/* check if we can use deform matrices for modifier from the
* start up to stack, they are more accurate than quats */
totleft = BKE_crazyspace_get_first_deform_matrices_editbmesh(&t->eval_ctx, t->scene, t->obedit, em, &defmats, &defcos);
@@ -6549,7 +6549,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
else if ((t->view_layer->basact) &&
(ob = t->view_layer->basact->object) &&
- (t->eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) &&
+ (ob->mode & OB_MODE_PARTICLE_EDIT) &&
PE_get_current(t->scene, ob))
{
/* do nothing */
@@ -8287,28 +8287,26 @@ void createTransData(bContext *C, TransInfo *t)
t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */
}
}
- else if (ob && (t->eval_ctx.object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
// XXX this is currently limited to active armature only...
// XXX active-layer checking isn't done as that should probably be checked through context instead
createTransPose(t, ob);
}
- else if (ob && (t->eval_ctx.object_mode & OB_MODE_WEIGHT_PAINT) && !(t->options & CTX_PAINT_CURVE)) {
+ else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && !(t->options & CTX_PAINT_CURVE)) {
/* important that ob_armature can be set even when its not selected [#23412]
* lines below just check is also visible */
Object *ob_armature = modifiers_isDeformedByArmature(ob);
- if (ob_armature) {
-// const bArmature *arm = ob_armature->data;
+ if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature);
if (base_arm) {
if (BASE_VISIBLE(base_arm)) {
createTransPose(t, ob_armature);
}
}
+
}
}
- else if (ob && (t->eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) &&
- PE_start_edit(PE_get_current(scene, ob)))
- {
+ else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
createTransParticleVerts(C, t);
t->flag |= T_POINTS;
@@ -8318,7 +8316,7 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
- else if (ob && (t->eval_ctx.object_mode & OB_MODE_ALL_PAINT)) {
+ else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
if ((t->options & CTX_PAINT_CURVE) && !ELEM(t->mode, TFM_SHEAR, TFM_SHRINKFATTEN)) {
t->flag |= T_POINTS | T_2D_EDIT;
createTransPaintCurveVerts(C, t);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index e051b401f87..b42e00a2bb4 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -901,7 +901,7 @@ static void recalcData_objects(TransInfo *t)
else
BKE_pose_where_is(&t->eval_ctx, t->scene, ob);
}
- else if (base && (t->eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) &&
+ else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) &&
PE_get_current(t->scene, base->object))
{
if (t->state != TRANS_CANCEL) {
@@ -1266,7 +1266,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
}
}
- if (ob && t->eval_ctx.object_mode & OB_MODE_ALL_PAINT) {
+ if (ob && ob->mode & OB_MODE_ALL_PAINT) {
Paint *p = BKE_paint_get_active_from_context(C);
if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
t->options |= CTX_PAINT_CURVE;
@@ -1815,7 +1815,7 @@ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
}
}
else if (t->options & CTX_PAINT_CURVE) {
- Paint *p = BKE_paint_get_active(t->scene, t->view_layer, t->eval_ctx.object_mode);
+ Paint *p = BKE_paint_get_active(t->scene, t->view_layer);
Brush *br = p->brush;
PaintCurve *pc = br->paint_curve;
copy_v3_v3(r_center, pc->points[pc->add_index - 1].bez.vec[1]);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index cb5b17b415e..8944817baca 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -520,9 +520,9 @@ static bool test_rotmode_euler(short rotmode)
return (ELEM(rotmode, ROT_MODE_AXISANGLE, ROT_MODE_QUAT)) ? 0 : 1;
}
-bool gimbal_axis(Object *ob, float gmat[3][3], const eObjectMode object_mode)
+bool gimbal_axis(Object *ob, float gmat[3][3])
{
- if (object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
bPoseChannel *pchan = BKE_pose_channel_active(ob);
if (pchan) {
@@ -591,7 +591,6 @@ static int calc_manipulator_stats(
const bContext *C, bool use_only_center,
struct TransformBounds *tbounds)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -629,7 +628,7 @@ static int calc_manipulator_stats(
case V3D_MANIP_GIMBAL:
{
float mat[3][3];
- if (gimbal_axis(ob, mat, workspace->object_mode)) {
+ if (gimbal_axis(ob, mat)) {
copy_m4_m3(rv3d->twmat, mat);
break;
}
@@ -638,7 +637,7 @@ static int calc_manipulator_stats(
}
case V3D_MANIP_NORMAL:
{
- if (obedit || workspace->object_mode & OB_MODE_POSE) {
+ if (obedit || ob->mode & OB_MODE_POSE) {
float mat[3][3];
ED_getTransformOrientationMatrix(C, mat, v3d->around);
copy_m4_m3(rv3d->twmat, mat);
@@ -649,7 +648,7 @@ static int calc_manipulator_stats(
}
case V3D_MANIP_LOCAL:
{
- if (workspace->object_mode & OB_MODE_POSE) {
+ if (ob->mode & OB_MODE_POSE) {
/* each bone moves on its own local axis, but to avoid confusion,
* use the active pones axis for display [#33575], this works as expected on a single bone
* and users who select many bones will understand whats going on and what local means
@@ -691,7 +690,7 @@ static int calc_manipulator_stats(
#ifdef USE_AXIS_BOUNDS
copy_m3_m4(tbounds->axis, rv3d->twmat);
- if (ob && workspace->object_mode & OB_MODE_EDIT) {
+ if (ob && ob->mode & OB_MODE_EDIT) {
float diff_mat[3][3];
copy_m3_m4(diff_mat, ob->obmat);
normalize_m3(diff_mat);
@@ -934,7 +933,7 @@ static int calc_manipulator_stats(
mul_m4_v3(obedit->obmat, tbounds->max);
}
}
- else if (ob && (workspace->object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bPoseChannel *pchan;
int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
bool ok = false;
@@ -972,10 +971,10 @@ static int calc_manipulator_stats(
mul_m4_v3(ob->obmat, tbounds->max);
}
}
- else if (ob && (workspace->object_mode & OB_MODE_ALL_PAINT)) {
+ else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
/* pass */
}
- else if (ob && workspace->object_mode & OB_MODE_PARTICLE_EDIT) {
+ else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
PTCacheEdit *edit = PE_get_current(scene, ob);
PTCacheEditPoint *point;
PTCacheEditKey *ek;
@@ -1065,13 +1064,12 @@ static void manipulator_prepare_mat(
case V3D_AROUND_CENTER_BOUNDS:
case V3D_AROUND_ACTIVE:
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
bGPdata *gpd = CTX_data_gpencil_data(C);
Object *ob = OBACT(view_layer);
- if (((v3d->around == V3D_AROUND_ACTIVE) && ((workspace->object_mode & OB_MODE_EDIT) == 0)) &&
+ if (((v3d->around == V3D_AROUND_ACTIVE) && (OBEDIT_FROM_OBACT(ob) == NULL)) &&
((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) &&
- (!(workspace->object_mode & OB_MODE_POSE)))
+ (!(ob->mode & OB_MODE_POSE)))
{
copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
}
@@ -1660,10 +1658,10 @@ static void WIDGETGROUP_xform_cage_draw_prepare(const bContext *C, wmManipulator
{
struct XFormCageWidgetGroup *xmgroup = mgroup->customdata;
wmManipulator *mpr = xmgroup->manipulator;
- const WorkSpace *workspace = CTX_wm_workspace(C);
+
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
- if (ob && workspace->object_mode & OB_MODE_EDIT) {
+ if (ob && ob->mode & OB_MODE_EDIT) {
copy_m4_m4(mpr->matrix_space, ob->obmat);
}
else {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index b39e5f286c0..7b3f91b81da 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -55,8 +55,6 @@
#include "BKE_screen.h"
#include "BKE_workspace.h"
-#include "DEG_depsgraph.h"
-
#include "BLT_translation.h"
#include "ED_armature.h"
@@ -298,7 +296,6 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports,
ts = createViewSpace(C, reports, name, overwrite);
}
else {
- const WorkSpace *workspace = CTX_wm_workspace(C);
Object *obedit = CTX_data_edit_object(C);
Object *ob = CTX_data_active_object(C);
if (obedit) {
@@ -309,7 +306,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports,
else if (obedit->type == OB_CURVE)
ts = createCurveSpace(C, reports, name, overwrite);
}
- else if (ob && (workspace->object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
ts = createBoneSpace(C, reports, name, overwrite);
}
else {
@@ -444,13 +441,13 @@ void initTransformOrientation(bContext *C, TransInfo *t)
case V3D_MANIP_GIMBAL:
unit_m3(t->spacemtx);
- if (ob && gimbal_axis(ob, t->spacemtx, t->eval_ctx.object_mode)) {
+ if (ob && gimbal_axis(ob, t->spacemtx)) {
BLI_strncpy(t->spacename, IFACE_("gimbal"), sizeof(t->spacename));
break;
}
ATTR_FALLTHROUGH; /* no gimbal fallthrough to normal */
case V3D_MANIP_NORMAL:
- if (obedit || (ob && t->eval_ctx.object_mode & OB_MODE_POSE)) {
+ if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
BLI_strncpy(t->spacename, IFACE_("normal"), sizeof(t->spacename));
ED_getTransformOrientationMatrix(C, t->spacemtx, t->around);
break;
@@ -581,7 +578,6 @@ static unsigned int bm_mesh_faces_select_get_n(BMesh *bm, BMVert **elems, const
int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3], const short around)
{
- const WorkSpace *workspace = CTX_wm_workspace(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *obedit = CTX_data_edit_object(C);
Base *base;
@@ -1012,7 +1008,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
mul_m3_v3(mat, plane);
}
}
- else if (ob && (workspace->object_mode & OB_MODE_POSE)) {
+ else if (ob && (ob->mode & OB_MODE_POSE)) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
float imat[3][3], mat[3][3];
@@ -1052,7 +1048,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
result = ORIENTATION_EDGE;
}
}
- else if (ob && (workspace->object_mode & (OB_MODE_ALL_PAINT | OB_MODE_PARTICLE_EDIT))) {
+ else if (ob && (ob->mode & (OB_MODE_ALL_PAINT | OB_MODE_PARTICLE_EDIT))) {
/* pass */
}
else {
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 9946f1ad546..ad913cd2336 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -544,7 +544,7 @@ static void initSnappingMode(TransInfo *t)
}
/* Particles edit mode*/
else if (t->tsnap.applySnap != NULL && // A snapping function actually exist
- (obedit == NULL && base_act && base_act->object && t->eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT))
+ (obedit == NULL && base_act && base_act->object && base_act->object->mode & OB_MODE_PARTICLE_EDIT))
{
t->tsnap.modeSelect = SNAP_ALL;
}
diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c
index 0020b0924bb..c336cd1d31e 100644
--- a/source/blender/editors/transform/transform_snap_object.c
+++ b/source/blender/editors/transform/transform_snap_object.c
@@ -821,7 +821,7 @@ static bool raycastObjects(
Object **r_ob, float r_obmat[4][4],
ListBase *r_hit_list)
{
- Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL;
+ Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(sctx->eval_ctx.view_layer) : NULL;
struct RaycastObjUserData data = {
.ray_start = ray_start,
@@ -2054,7 +2054,7 @@ static bool snapObjectsRay(
float r_loc[3], float r_no[3],
Object **r_ob, float r_obmat[4][4])
{
- Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL;
+ Object *obedit = use_object_edit_cage ? OBEDIT_FROM_VIEW_LAYER(sctx->eval_ctx.view_layer) : NULL;
struct SnapObjUserData data = {
.snapdata = snapdata,
@@ -2089,7 +2089,7 @@ SnapObjectContext *ED_transform_snap_object_context_create(
sctx->scene = scene;
DEG_evaluation_context_init_from_scene(
- &sctx->eval_ctx, scene, view_layer, engine_type, OB_MODE_OBJECT, DAG_EVAL_VIEWPORT);
+ &sctx->eval_ctx, scene, view_layer, engine_type, DAG_EVAL_VIEWPORT);
sctx->cache.object_map = BLI_ghash_ptr_new(__func__);
sctx->cache.mem_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c
index 5033d741c7b..b588aa8fb13 100644
--- a/source/blender/editors/undo/memfile_undo.c
+++ b/source/blender/editors/undo/memfile_undo.c
@@ -45,38 +45,13 @@
#include "undo_intern.h"
-/** Store workspace modes in undo steps, this may be removed if find a better way to handle. */
-#define USE_WORKSPACE_OBJECT_MODE_HACK
-
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
-#include "MEM_guardedalloc.h"
-#include "BLI_string.h"
-#include "BLI_listbase.h"
-#include "BKE_main.h"
-#include "DNA_workspace_types.h"
-#endif
-
-
/* -------------------------------------------------------------------- */
/** \name Implements ED Undo System
* \{ */
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
-typedef struct WorkSpaceData {
- struct WorkSpaceData *next, *prev;
- char name[MAX_ID_NAME - 2];
- eObjectMode object_mode, object_mode_restore;
- /* TODO, view_layer? */
-} WorkSpaceData;
-#endif /* USE_WORKSPACE_OBJECT_MODE_HACK */
-
typedef struct MemFileUndoStep {
UndoStep step;
MemFileUndoData *data;
-
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
- ListBase workspace_data;
-#endif
} MemFileUndoStep;
static bool memfile_undosys_poll(bContext *UNUSED(C))
@@ -101,18 +76,6 @@ static bool memfile_undosys_step_encode(struct bContext *C, UndoStep *us_p)
us->data = BKE_memfile_undo_encode(bmain, us_prev ? us_prev->data : NULL);
us->step.data_size = us->data->undo_size;
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
- {
- for (WorkSpace *workspace = bmain->workspaces.first; workspace != NULL; workspace = workspace->id.next) {
- WorkSpaceData *wsd = MEM_mallocN(sizeof(*wsd), __func__);
- BLI_strncpy(wsd->name, workspace->id.name + 2, sizeof(wsd->name));
- wsd->object_mode = workspace->object_mode;
- wsd->object_mode_restore = workspace->object_mode_restore;
- BLI_addtail(&us->workspace_data, wsd);
- }
- }
-#endif
-
return true;
}
@@ -127,19 +90,6 @@ static void memfile_undosys_step_decode(struct bContext *C, UndoStep *us_p, int
BKE_memfile_undo_decode(us->data, C);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
-
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
- {
- struct Main *bmain = CTX_data_main(C);
- for (WorkSpaceData *wsd = us->workspace_data.first; wsd != NULL; wsd = wsd->next) {
- WorkSpace *workspace = BLI_findstring(&bmain->workspaces, wsd->name, offsetof(ID, name) + 2);
- if (workspace) {
- workspace->object_mode = wsd->object_mode;
- workspace->object_mode_restore = wsd->object_mode_restore;
- }
- }
- }
-#endif
}
static void memfile_undosys_step_free(UndoStep *us_p)
@@ -155,10 +105,6 @@ static void memfile_undosys_step_free(UndoStep *us_p)
}
BKE_memfile_undo_free(us->data);
-
-#ifdef USE_WORKSPACE_OBJECT_MODE_HACK
- BLI_freelistN(&us->workspace_data);
-#endif
}
/* Export for ED_undo_sys. */
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 4bec0d9f114..d3a9c22bc73 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -42,7 +42,6 @@
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_packedFile_types.h"
-#include "DNA_workspace_types.h"
#include "BLI_utildefines.h"
#include "BLI_string.h"
@@ -75,8 +74,6 @@
#include "ED_space_api.h"
#include "ED_util.h"
-#include "DEG_depsgraph.h"
-
#include "GPU_immediate.h"
#include "UI_interface.h"
@@ -92,6 +89,7 @@
void ED_editors_init(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
if (wm->undo_stack == NULL) {
@@ -107,33 +105,22 @@ void ED_editors_init(bContext *C)
/* toggle on modes for objects that were saved with these enabled. for
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
- {
- wmWindow *win_orig = CTX_wm_window(C);
- CTX_wm_window_set(C, NULL);
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- Scene *scene = WM_window_get_active_scene(win);
- ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace);
- Object *obact = view_layer ? OBACT(view_layer) : NULL;
- eObjectMode object_mode = workspace->object_mode;
- workspace->object_mode = OB_MODE_OBJECT;
- if (view_layer && obact) {
- const ID *data = obact->data;
- if (!ELEM(object_mode, OB_MODE_OBJECT, OB_MODE_POSE)) {
- if (!ID_IS_LINKED(obact) && !(data && ID_IS_LINKED(data))) {
- CTX_wm_window_set(C, win);
- ED_object_mode_toggle(C, object_mode);
- CTX_wm_window_set(C, NULL);
- }
- }
- else if (object_mode == OB_MODE_POSE) {
- if (!ID_IS_LINKED(obact) && (obact->type == OB_ARMATURE)) {
- workspace->object_mode = object_mode;
- }
+ Object *obact = CTX_data_active_object(C);
+ if (obact != NULL) {
+ for (Object *ob = bmain->object.first; ob; ob = ob->id.next) {
+ int mode = ob->mode;
+
+ if (mode == OB_MODE_OBJECT) {
+ /* pass */
+ }
+ else {
+ ID *data = ob->data;
+ ob->mode = OB_MODE_OBJECT;
+ if ((ob == obact) && !ID_IS_LINKED(ob) && !(data && ID_IS_LINKED(data))) {
+ ED_object_mode_toggle(C, mode);
}
}
}
- CTX_wm_window_set(C, win_orig);
}
/* image editor paint mode */
@@ -195,16 +182,11 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
Object *ob;
Main *bmain = CTX_data_main(C);
- eObjectMode object_mode = WM_windows_object_mode_get(bmain->wm.first);
- if ((object_mode & (OB_MODE_SCULPT | OB_MODE_EDIT)) == 0) {
- return has_edited;
- }
-
/* loop through all data to find edit mode or object mode, because during
* exiting we might not have a context for edit object and multiple sculpt
* objects can exist at the same time */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (object_mode & OB_MODE_SCULPT) {
+ if (ob->mode & OB_MODE_SCULPT) {
/* Don't allow flushing while in the middle of a stroke (frees data in use).
* Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
if ((ob->sculpt && ob->sculpt->cache) == 0) {
@@ -223,7 +205,7 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
}
}
}
- else if (object_mode & OB_MODE_EDIT) {
+ else if (ob->mode & OB_MODE_EDIT) {
/* get editmode results */
has_edited = true;
ED_object_editmode_load(ob);
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index cb8aa9660cf..3fcc89d0973 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -1072,7 +1072,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
static void draw_uv_shadows_get(
- SpaceImage *sima, const EvaluationContext *eval_ctx, Object *ob, Object *obedit,
+ SpaceImage *sima, Object *ob, Object *obedit,
bool *show_shadow, bool *show_texpaint)
{
*show_shadow = *show_texpaint = false;
@@ -1086,18 +1086,18 @@ static void draw_uv_shadows_get(
*show_shadow = EDBM_uv_check(em);
}
- *show_texpaint = (ob && ob->type == OB_MESH && eval_ctx->object_mode == OB_MODE_TEXTURE_PAINT);
+ *show_texpaint = (ob && ob->type == OB_MESH && ob->mode == OB_MODE_TEXTURE_PAINT);
}
void ED_uvedit_draw_main(
- SpaceImage *sima, const EvaluationContext *eval_ctx,
+ SpaceImage *sima,
ARegion *ar, Scene *scene, ViewLayer *view_layer, Object *obedit, Object *obact, Depsgraph *depsgraph)
{
ToolSettings *toolsettings = scene->toolsettings;
bool show_uvedit, show_uvshadow, show_texpaint_uvshadow;
show_uvedit = ED_space_image_show_uvedit(sima, obedit);
- draw_uv_shadows_get(sima, eval_ctx, obact, obedit, &show_uvshadow, &show_texpaint_uvshadow);
+ draw_uv_shadows_get(sima, obact, obedit, &show_uvshadow, &show_texpaint_uvshadow);
if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
if (show_uvshadow)