diff options
Diffstat (limited to 'source/blender/editors')
19 files changed, 83 insertions, 60 deletions
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 5d5990b9a0a..d137e5f1c74 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -2683,8 +2683,10 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, } case ANIMTYPE_OBJECT: { +#if 0 bDopeSheet *ads = (bDopeSheet *)ac->data; Scene *sce = (Scene *)ads->source; +#endif ViewLayer *view_layer = ac->view_layer; Base *base = (Base *)ale->data; Object *ob = base->object; @@ -2723,7 +2725,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index, adt->flag |= ADT_UI_ACTIVE; /* ensure we exit editmode on whatever object was active before to avoid getting stuck there - T48747 */ - if (ob != sce->obedit) + if (ob != CTX_data_edit_object(C)) ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4b578ba389e..c3e92589791 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -5027,7 +5027,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) snap_context, SCE_SELECT_FACE, &(const struct SnapObjectParams){ - .snap_select = (vc.scene->obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL, + .snap_select = (vc.obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL, .use_object_edit_cage = false, }, mval, NULL, true, diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 062b9c94a1b..0d2514ec27e 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -788,7 +788,7 @@ static int curve_draw_exec(bContext *C, wmOperator *op) struct CurveDrawData *cdd = op->customdata; const CurvePaintSettings *cps = &cdd->vc.scene->toolsettings->curve_paint_settings; - Object *obedit = cdd->vc.scene->obedit; + Object *obedit = cdd->vc.obedit; Curve *cu = obedit->data; ListBase *nurblist = object_editcurve_get(obedit); diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index d2ae8bc3ce7..8d45c6af686 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -55,6 +55,7 @@ #include "DNA_space_types.h" #include "DNA_view3d_types.h" #include "DNA_gpencil_types.h" +#include "DNA_workspace_types.h" #include "BKE_collection.h" #include "BKE_context.h" @@ -1293,6 +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); /* 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! @@ -1301,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) && - (scene->obedit == NULL)); + ((workspace->object_mode & OB_MODE_EDIT) == 0)); } static int gp_convert_layer_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 18480d01ed7..8fa043499f8 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -148,6 +148,7 @@ void ED_screens_header_tools_menu_create(struct bContext *C, struct uiLayout bool ED_screen_stereo3d_required(const struct bScreen *screen, const struct Scene *scene); Scene *ED_screen_scene_find(const struct bScreen *screen, const struct wmWindowManager *wm); Scene *ED_screen_scene_find_with_window(const struct bScreen *screen, const struct wmWindowManager *wm, struct wmWindow **r_window); +struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm); void ED_screen_preview_render(const struct bScreen *screen, int size_x, int size_y, unsigned int *r_rect) ATTR_NONNULL(); /* workspaces */ diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index b71dd029bf2..795c7b6aa53 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -121,10 +121,9 @@ static void verttag_set_cb(BMVert *v, bool val, void *user_data_v) } static void mouse_mesh_shortest_path_vert( - Scene *scene, const struct PathSelectParams *op_params, + Scene *UNUSED(scene), Object *obedit, const struct PathSelectParams *op_params, BMVert *v_act, BMVert *v_dst) { - Object *obedit = scene->obedit; BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -280,11 +279,11 @@ static void edgetag_set_cb(BMEdge *e, bool val, void *user_data_v) } } -static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me) +static void edgetag_ensure_cd_flag(Mesh *me, const char edge_mode) { BMesh *bm = me->edit_btmesh->bm; - switch (scene->toolsettings->edge_mode) { + switch (edge_mode) { case EDGE_MODE_TAG_CREASE: BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE); break; @@ -307,10 +306,9 @@ static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me) /* since you want to create paths with multiple selects, it doesn't have extend option */ static void mouse_mesh_shortest_path_edge( - Scene *scene, const struct PathSelectParams *op_params, + Scene *scene, Object *obedit, const struct PathSelectParams *op_params, BMEdge *e_act, BMEdge *e_dst) { - Object *obedit = scene->obedit; BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -319,7 +317,7 @@ static void mouse_mesh_shortest_path_edge( Mesh *me = obedit->data; bool is_path_ordered = false; - edgetag_ensure_cd_flag(scene, obedit->data); + edgetag_ensure_cd_flag(obedit->data, op_params->edge_mode); if (e_act && (e_act != e_dst)) { if (op_params->use_fill) { @@ -377,7 +375,7 @@ static void mouse_mesh_shortest_path_edge( } else { const bool is_act = !edgetag_test_cb(e_dst, &user_data); - edgetag_ensure_cd_flag(scene, obedit->data); + edgetag_ensure_cd_flag(obedit->data, op_params->edge_mode); edgetag_set_cb(e_dst, is_act, &user_data); /* switch the edge option */ } @@ -452,10 +450,9 @@ static void facetag_set_cb(BMFace *f, bool val, void *user_data_v) } static void mouse_mesh_shortest_path_face( - Scene *scene, const struct PathSelectParams *op_params, + Scene *UNUSED(scene), Object *obedit, const struct PathSelectParams *op_params, BMFace *f_act, BMFace *f_dst) { - Object *obedit = scene->obedit; BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; @@ -547,7 +544,7 @@ static void mouse_mesh_shortest_path_face( /* Main Operator for vert/edge/face tag */ static bool edbm_shortest_path_pick_ex( - Scene *scene, const struct PathSelectParams *op_params, + Scene *scene, Object *obedit, const struct PathSelectParams *op_params, BMElem *ele_src, BMElem *ele_dst) { @@ -555,15 +552,15 @@ static bool edbm_shortest_path_pick_ex( /* pass */ } else if (ele_src->head.htype == BM_VERT) { - mouse_mesh_shortest_path_vert(scene, op_params, (BMVert *)ele_src, (BMVert *)ele_dst); + mouse_mesh_shortest_path_vert(scene, obedit, op_params, (BMVert *)ele_src, (BMVert *)ele_dst); return true; } else if (ele_src->head.htype == BM_EDGE) { - mouse_mesh_shortest_path_edge(scene, op_params, (BMEdge *)ele_src, (BMEdge *)ele_dst); + mouse_mesh_shortest_path_edge(scene, obedit, op_params, (BMEdge *)ele_src, (BMEdge *)ele_dst); return true; } else if (ele_src->head.htype == BM_FACE) { - mouse_mesh_shortest_path_face(scene, op_params, (BMFace *)ele_src, (BMFace *)ele_dst); + mouse_mesh_shortest_path_face(scene, obedit, op_params, (BMFace *)ele_src, (BMFace *)ele_dst); return true; } @@ -644,7 +641,7 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE op_params.track_active = track_active; op_params.edge_mode = vc.scene->toolsettings->edge_mode; - if (!edbm_shortest_path_pick_ex(vc.scene, &op_params, ele_src, ele_dst)) { + if (!edbm_shortest_path_pick_ex(vc.scene, vc.obedit, &op_params, ele_src, ele_dst)) { return OPERATOR_PASS_THROUGH; } @@ -681,7 +678,7 @@ static int edbm_shortest_path_pick_exec(bContext *C, wmOperator *op) op_params.track_active = true; op_params.edge_mode = scene->toolsettings->edge_mode; - if (!edbm_shortest_path_pick_ex(scene, &op_params, ele_src, ele_dst)) { + if (!edbm_shortest_path_pick_ex(scene, obedit, &op_params, ele_src, ele_dst)) { return OPERATOR_CANCELLED; } @@ -720,8 +717,8 @@ void MESH_OT_shortest_path_pick(wmOperatorType *ot) static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Object *ob = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(ob); + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; BMIter iter; BMEditSelection *ese_src, *ese_dst; @@ -773,7 +770,7 @@ static int edbm_shortest_path_select_exec(bContext *C, wmOperator *op) struct PathSelectParams op_params; path_select_params_from_op(op, &op_params); - edbm_shortest_path_pick_ex(scene, &op_params, ele_src, ele_dst); + edbm_shortest_path_pick_ex(scene, obedit, &op_params, ele_src, ele_dst); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 85b1c70fde3..64b6f5b8010 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -42,6 +42,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" +#include "DNA_workspace_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" @@ -275,6 +276,7 @@ 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); @@ -294,7 +296,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) bDeformGroup *dg, *odg; CustomData vdata, edata, fdata, ldata, pdata; - if (scene->obedit) { + if (workspace->object_mode & OB_MODE_EDIT) { BKE_report(op->reports, RPT_WARNING, "Cannot join while in edit mode"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 18c18f10c13..c4bad6f76c9 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1673,7 +1673,7 @@ static int convert_poll(bContext *C) Base *base_act = CTX_data_active_base(C); Object *obact = base_act ? base_act->object : NULL; - return (!ID_IS_LINKED(scene) && obact && scene->obedit != obact && + return (!ID_IS_LINKED(scene) && obact && (BKE_object_is_in_editmode(obact) == false) && (base_act->flag & BASE_SELECTED) && !ID_IS_LINKED(obact)); } @@ -2529,10 +2529,10 @@ static int join_poll(bContext *C) static int join_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); + const WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = CTX_data_active_object(C); - if (scene->obedit) { + if (workspace->object_mode & OB_MODE_EDIT) { BKE_report(op->reports, RPT_ERROR, "This data does not support joining in edit mode"); return OPERATOR_CANCELLED; } @@ -2583,10 +2583,10 @@ static int join_shapes_poll(bContext *C) static int join_shapes_exec(bContext *C, wmOperator *op) { - Scene *scene = CTX_data_scene(C); + const WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = CTX_data_active_object(C); - if (scene->obedit) { + if (workspace->object_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_edit.c b/source/blender/editors/object/object_edit.c index ca96e1c6798..a74af68ca7d 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -84,6 +84,7 @@ #include "BKE_modifier.h" #include "BKE_editmesh.h" #include "BKE_report.h" +#include "BKE_object.h" #include "BKE_workspace.h" #include "DEG_depsgraph.h" @@ -703,7 +704,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev if (!(ob = OBACT(view_layer))) return; - if (scene->obedit) { // XXX get from context + if (BKE_object_is_in_editmode(ob)) { /* obedit_copymenu(); */ return; } @@ -942,7 +943,7 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev DEG_relations_tag_update(bmain); } -static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer) +static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit) { Object *ob; short event; @@ -950,7 +951,7 @@ static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLaye if (!(ob = OBACT(view_layer))) return; - if (scene->obedit) { /* XXX get from context */ + if (obedit) { /* if (ob->type == OB_MESH) */ /* XXX mesh_copy_menu(); */ return; @@ -1367,7 +1368,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot) /* ********************** */ -static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer) +static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer, Object *obedit) { /* all selected objects with an image map: scale in image aspect */ Base *base; @@ -1377,7 +1378,7 @@ static void UNUSED_FUNCTION(image_aspect) (Scene *scene, ViewLayer *view_layer) float x, y, space; int a, b, done; - if (scene->obedit) return; // XXX get from context + if (obedit) return; if (ID_IS_LINKED(scene)) return; for (base = FIRSTBASE(view_layer); base; base = base->next) { diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 78554713f4d..9d1792e9f16 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -693,7 +693,7 @@ int ED_object_modifier_apply(ReportList *reports, const bContext *C, Scene *scen const WorkSpace *workspace = CTX_wm_workspace(C); int prev_mode; - if (scene->obedit) { + if (BKE_object_is_in_editmode(ob)) { BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in edit mode"); return 0; } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 8e410a3abbb..d4fd62c6dac 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -1444,8 +1444,10 @@ static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) job_update_flag |= PR_UPDATE_DATABASE; /* load editmesh */ - if (scene->obedit) - ED_object_editmode_load(scene->obedit); + Object *obedit = CTX_data_edit_object(C); + if (obedit) { + ED_object_editmode_load(obedit); + } } engine->update_flag = 0; diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index bb92ea35ad0..2a48ae46b12 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -92,8 +92,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult Scene *scene = WM_window_get_active_scene(win); WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook); ViewLayer *view_layer = BKE_view_layer_from_workspace_get(scene, workspace); - Object *obedit = scene->obedit; Object *obact = (view_layer && view_layer->basact) ? view_layer->basact->object : NULL; + Object *obedit = BKE_workspace_edit_object(workspace, scene); if (CTX_data_dir(member)) { CTX_data_dir_set(result, screen_context_dir); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 604a86a1519..0d9fc7c60e3 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1871,3 +1871,14 @@ Scene *ED_screen_scene_find(const bScreen *screen, const wmWindowManager *wm) { return ED_screen_scene_find_with_window(screen, wm, NULL); } + + +wmWindow *ED_screen_window_find(const bScreen *screen, const wmWindowManager *wm) +{ + for (wmWindow *win = wm->windows.first; win; win = win->next) { + if (WM_window_get_active_screen(win) == screen) { + return win; + } + } + return NULL; +} diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c index 4d70d82d5c6..51cd759b260 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_utils.c @@ -43,6 +43,7 @@ #include "BKE_modifier.h" #include "BKE_object_deform.h" #include "BKE_report.h" +#include "BKE_object.h" #include "WM_api.h" #include "WM_types.h" @@ -58,7 +59,6 @@ bool ED_wpaint_ensure_data( bContext *C, struct ReportList *reports, enum eWPaintFlag flag, struct WPaintVGroupIndex *vgroup_index) { - Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Mesh *me = BKE_mesh_from_object(ob); @@ -67,7 +67,7 @@ bool ED_wpaint_ensure_data( vgroup_index->mirror = -1; } - if (scene->obedit) { + if (BKE_object_is_in_editmode(ob)) { return false; } @@ -308,4 +308,4 @@ float ED_wpaint_blend_tool( } } -/** \} */
\ No newline at end of file +/** \} */ diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 118be88216e..800560c380c 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -54,6 +54,7 @@ #include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_editmesh.h" +#include "BKE_object.h" #include "ED_info.h" #include "ED_armature.h" @@ -374,15 +375,15 @@ 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(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode) +static void stats_update(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode) { SceneStats stats = {0}; Object *ob = (view_layer->basact) ? view_layer->basact->object : NULL; Base *base; - - if (scene->obedit) { + + if (obedit) { /* Edit Mode */ - stats_object_edit(scene->obedit, &stats); + stats_object_edit(ob, &stats); } else if (ob && (object_mode & OB_MODE_POSE)) { /* Pose Mode */ @@ -407,7 +408,7 @@ static void stats_update(Scene *scene, ViewLayer *view_layer, const eObjectMode *(view_layer->stats) = stats; } -static void stats_string(Scene *scene, ViewLayer *view_layer, const eObjectMode object_mode) +static void stats_string(ViewLayer *view_layer, Object *obedit, const eObjectMode object_mode) { #define MAX_INFO_MEM_LEN 64 SceneStats *stats = view_layer->stats; @@ -473,17 +474,17 @@ static void stats_string(Scene *scene, ViewLayer *view_layer, const eObjectMode ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr); - if (scene->obedit) { - if (BKE_keyblock_from_object(scene->obedit)) + if (obedit) { + if (BKE_keyblock_from_object(obedit)) ofs += BLI_strncpy_rlen(s + ofs, IFACE_("(Key) "), MAX_INFO_LEN - ofs); - if (scene->obedit->type == OB_MESH) { + if (obedit->type == OB_MESH) { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, IFACE_("Verts:%s/%s | Edges:%s/%s | Faces:%s/%s | Tris:%s"), stats_fmt.totvertsel, stats_fmt.totvert, stats_fmt.totedgesel, stats_fmt.totedge, stats_fmt.totfacesel, stats_fmt.totface, stats_fmt.tottri); } - else if (scene->obedit->type == OB_ARMATURE) { + else if (obedit->type == OB_ARMATURE) { ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, IFACE_("Verts:%s/%s | Bones:%s/%s"), stats_fmt.totvertsel, stats_fmt.totvert, stats_fmt.totbonesel, stats_fmt.totbone); } @@ -527,12 +528,16 @@ void ED_info_stats_clear(ViewLayer *view_layer) } } -const char *ED_info_stats_string(Scene *scene, WorkSpace *workspace, ViewLayer *view_layer) +const char *ED_info_stats_string(Scene *UNUSED(scene), WorkSpace *workspace, 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(scene, view_layer, workspace->object_mode); + stats_update(view_layer, obedit, workspace->object_mode); } - stats_string(scene, view_layer, workspace->object_mode); + stats_string(view_layer, obedit, workspace->object_mode); return view_layer->stats->infostr; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 3941ea85efd..73fd3f562be 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -915,10 +915,10 @@ static void view3d_main_region_listener( case ND_SELECT: { WM_manipulatormap_tag_refresh(mmap); - if (scene->obedit) { - Object *ob = scene->obedit; + Object *obedit = OBEDIT_FROM_WINDOW(wmn->window); + if (obedit) { /* TODO(sergey): Notifiers shouldn't really be doing DEG tags. */ - DEG_id_tag_update((ID *)ob->data, DEG_TAG_SELECT_UPDATE); + DEG_id_tag_update((ID *)obedit->data, DEG_TAG_SELECT_UPDATE); } ATTR_FALLTHROUGH; } diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index a21b3fd7e45..aeb2cd11e39 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -1614,7 +1614,7 @@ static void view3d_draw_objects( /* draw selected and editmode */ for (base = view_layer->object_bases.first; base; base = base->next) { if ((base->flag & BASE_VISIBLED) != 0) { - if ((base->object == scene->obedit) || (base->flag & BASE_SELECTED)) { + if (base->object == obedit || (base->flag & BASE_SELECTED)) { draw_object(eval_ctx, scene, view_layer, ar, v3d, base, 0); } } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 459727ad531..1839583015c 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1069,7 +1069,7 @@ static void manipulator_prepare_mat( bGPdata *gpd = CTX_data_gpencil_data(C); Object *ob = OBACT(view_layer); - if (((v3d->around == V3D_AROUND_ACTIVE) && (scene->obedit == NULL)) && + if (((v3d->around == V3D_AROUND_ACTIVE) && ((workspace->object_mode & OB_MODE_EDIT) == 0)) && ((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) && (!(workspace->object_mode & OB_MODE_POSE))) { diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 82da9991dda..14cd4bcc7ac 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -822,7 +822,7 @@ static bool raycastObjects( Object **r_ob, float r_obmat[4][4], ListBase *r_hit_list) { - Object *obedit = use_object_edit_cage ? sctx->scene->obedit : NULL; + Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL; struct RaycastObjUserData data = { .ray_start = ray_start, @@ -2060,7 +2060,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 ? sctx->scene->obedit : NULL; + Object *obedit = use_object_edit_cage ? OBEDIT_FROM_EVAL_CTX(&sctx->eval_ctx) : NULL; struct SnapObjUserData data = { .snapdata = snapdata, |