diff options
Diffstat (limited to 'source/blender/editors/space_view3d')
10 files changed, 65 insertions, 80 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8bbbc4ac489..7ad5f733f02 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -4321,7 +4321,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(eval_ctx, ob)) ? DRAW_FACE_SELECT : 0; + int draw_flags = (is_obact && BKE_paint_select_face_test(ob, eval_ctx->object_mode)) ? DRAW_FACE_SELECT : 0; if (!dm) return; @@ -4560,7 +4560,7 @@ static void draw_mesh_fancy( } } - if (is_obact && BKE_paint_select_vert_test(eval_ctx, ob)) { + if (is_obact && BKE_paint_select_vert_test(ob, eval_ctx->object_mode)) { const bool use_depth = (v3d->flag & V3D_ZBUF_SELECT) != 0; glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); @@ -4742,7 +4742,7 @@ static void draw_mesh_fancy_new(EvaluationContext *eval_ctx, Scene *scene, ViewL 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(eval_ctx, ob)) ? DRAW_FACE_SELECT : 0; + int draw_flags = (is_obact && BKE_paint_select_face_test(ob, eval_ctx->object_mode)) ? DRAW_FACE_SELECT : 0; if (!dm) return; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index e5259a2c583..2f2e0db8c7a 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1386,10 +1386,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) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + const WorkSpace *workspace = CTX_wm_workspace(C); /* if hidden but in edit mode, we still display, can happen with animation */ - if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (eval_ctx.object_mode & OB_MODE_EDIT)) { + if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (workspace->object_mode & OB_MODE_EDIT)) { CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, view_layer->basact); } } @@ -1399,11 +1398,10 @@ 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; - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); /* if hidden but in edit mode, we still display, can happen with animation */ - if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (eval_ctx.object_mode & OB_MODE_EDIT) != 0) { + if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (workspace->object_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 b87637ef081..bd62a4fc3bf 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -787,13 +787,12 @@ 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); - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); if (ob && (BKE_object_is_in_editmode_vgroup(ob) || - BKE_object_is_in_wpaint_select_vert(&eval_ctx, ob))) + BKE_object_is_in_wpaint_select_vert(ob, workspace->object_mode))) { MDeformVert *dvert_act = ED_mesh_active_dvert_get_only(ob); if (dvert_act) { @@ -1130,9 +1129,8 @@ static int view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)) static void view3d_panel_transform(const bContext *C, Panel *pa) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); 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); @@ -1157,7 +1155,7 @@ static void view3d_panel_transform(const bContext *C, Panel *pa) v3d_editvertex_buts(col, v3d, ob, lim); } } - else if (eval_ctx.object_mode & OB_MODE_POSE) { + else if (workspace->object_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 3ffbb67a492..7ce1978dca2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1422,7 +1422,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d) } } -static void draw_view_axis(RegionView3D *rv3d, rcti *rect) +static void draw_view_axis(RegionView3D *rv3d, const rcti *rect) { const float k = U.rvisize * U.pixelsize; /* axis size */ const int bright = - 20 * (10 - U.rvibright); /* axis alpha offset (rvibright has range 0-10) */ @@ -1689,7 +1689,7 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d) return name; } -static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) +static void draw_viewport_name(ARegion *ar, View3D *v3d, const rcti *rect) { RegionView3D *rv3d = ar->regiondata; const char *name = view3d_get_name(v3d, rv3d); @@ -1719,7 +1719,7 @@ static void draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) */ static void draw_selected_name( - const EvaluationContext *eval_ctx, Scene *scene, Object *ob, rcti *rect) + Scene *scene, Object *ob, const eObjectMode object_mode, const rcti *rect) { const int cfra = CFRA; const char *msg_pin = " (Pinned)"; @@ -1761,7 +1761,7 @@ static void draw_selected_name( s += BLI_strcpy_rlen(s, arm->act_edbone->name); } } - else if (eval_ctx->object_mode & OB_MODE_POSE) { + else if (object_mode & OB_MODE_POSE) { if (arm->act_bone) { if (arm->act_bone->layer & arm->layer) { @@ -1774,7 +1774,7 @@ 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 && eval_ctx->object_mode & OB_MODE_WEIGHT_PAINT) { + if (ob->type == OB_MESH && object_mode & OB_MODE_WEIGHT_PAINT) { Object *armobj = BKE_object_pose_armature_get(ob); if (armobj) { bArmature *arm = armobj->data; @@ -1833,8 +1833,6 @@ static void draw_selected_name( */ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); RegionView3D *rv3d = ar->regiondata; View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); @@ -1865,9 +1863,10 @@ 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(&eval_ctx, scene, ob, &rect); + draw_selected_name(scene, ob, workspace->object_mode, &rect); } #if 0 /* TODO */ if (grid_unit) { /* draw below the viewport name */ @@ -2365,19 +2364,19 @@ void VP_legacy_drawcursor( } } -void VP_legacy_draw_view_axis(RegionView3D *rv3d, rcti *rect) +void VP_legacy_draw_view_axis(RegionView3D *rv3d, const rcti *rect) { draw_view_axis(rv3d, rect); } -void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect) +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(const EvaluationContext *eval_ctx, Scene *scene, Object *ob, rcti *rect) +void VP_legacy_draw_selected_name(Scene *scene, Object *ob, eObjectMode object_mode, const rcti *rect) { - draw_selected_name(eval_ctx, scene, ob, rect); + draw_selected_name(scene, ob, object_mode, 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 5b7f7e78310..0b85ac47781 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -222,7 +222,7 @@ static void backdrawview3d( BLI_assert(ar->regiontype == RGN_TYPE_WINDOW); if (base && (eval_ctx->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) || - BKE_paint_select_face_test(eval_ctx, base->object))) + BKE_paint_select_face_test(base->object, eval_ctx->object_mode))) { /* do nothing */ } @@ -2074,7 +2074,7 @@ static void view3d_main_region_draw_info( if (U.uiflag & USER_DRAWVIEWINFO) { Object *ob = OBACT(view_layer); - VP_legacy_draw_selected_name(&eval_ctx, scene, ob, &rect); + VP_legacy_draw_selected_name(scene, ob, eval_ctx.object_mode, &rect); } } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 20eb65197e5..47778623561 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -244,24 +244,22 @@ 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}; - - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + 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 && (eval_ctx.object_mode & OB_MODE_ALL_PAINT) && + if (ob_act && (workspace->object_mode & OB_MODE_ALL_PAINT) && /* with weight-paint + pose-mode, fall through to using calculateTransformCenter */ - ((eval_ctx.object_mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob_act)) == 0) + ((workspace->object_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 (eval_ctx.object_mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) { + if (workspace->object_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); @@ -271,7 +269,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) } is_set = true; } - else if (ob_act && (eval_ctx.object_mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) { + else if (ob_act && (workspace->object_mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) { Curve *cu = ob_act->data; EditFont *ef = cu->editfont; int i; @@ -286,7 +284,7 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) is_set = true; } - else if (ob_act == NULL || eval_ctx.object_mode == OB_MODE_OBJECT) { + else if (ob_act == NULL || workspace->object_mode == OB_MODE_OBJECT) { /* object mode use boundbox centers */ Base *base; unsigned int tot = 0; @@ -2795,8 +2793,7 @@ 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) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + 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); @@ -2820,7 +2817,7 @@ static int viewselected_exec(bContext *C, wmOperator *op) ob = NULL; } - if (ob && (eval_ctx.object_mode & OB_MODE_WEIGHT_PAINT)) { + 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; @@ -2845,17 +2842,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 && (eval_ctx.object_mode & OB_MODE_POSE)) { + else if (ob && (workspace->object_mode & OB_MODE_POSE)) { ok = BKE_pose_minmax(ob, min, max, true, true); } - else if (BKE_paint_select_face_test(&eval_ctx, ob)) { + else if (BKE_paint_select_face_test(ob, workspace->object_mode)) { ok = paintface_minmax(ob, min, max); } - else if (ob && (eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT)) { + else if (ob && (workspace->object_mode & OB_MODE_PARTICLE_EDIT)) { ok = PE_minmax(scene, view_layer, min, max); } else if (ob && - (eval_ctx.object_mode & (OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) + (workspace->object_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); @@ -2962,15 +2959,13 @@ static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op)) Object *obact = CTX_data_active_object(C); if (v3d) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - ED_view3d_lock_clear(v3d); v3d->ob_centre = obact; /* can be NULL */ if (obact && obact->type == OB_ARMATURE) { - if (eval_ctx.object_mode & OB_MODE_POSE) { + const WorkSpace *workspace = CTX_wm_workspace(C); + if (workspace->object_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 b5de08c3d11..5f38cbddce0 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -276,8 +276,7 @@ void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C) void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + const WorkSpace *workspace = CTX_wm_workspace(C); bScreen *screen = CTX_wm_screen(C); ScrArea *sa = CTX_wm_area(C); View3D *v3d = sa->spacedata.first; @@ -292,7 +291,7 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) uiLayout *row; bool is_paint = ( ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) && - ELEM(eval_ctx.object_mode, + ELEM(workspace->object_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); @@ -307,18 +306,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(eval_ctx.object_mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) { + if (!ob || ELEM(workspace->object_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(eval_ctx.object_mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) { + if (!ELEM(workspace->object_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 (eval_ctx.object_mode & (OB_MODE_TEXTURE_PAINT)) { + if (workspace->object_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 16731336d00..0b913ad179d 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -379,10 +379,9 @@ extern bool view3d_camera_border_hack_test; void VP_legacy_drawcursor( const struct EvaluationContext *eval_ctx, Scene *scene, struct ViewLayer *view_layer, ARegion *ar, View3D *v3d); -void VP_legacy_draw_view_axis(RegionView3D *rv3d, rcti *rect); -void VP_legacy_draw_viewport_name(ARegion *ar, View3D *v3d, rcti *rect); -void VP_legacy_draw_selected_name( - const struct EvaluationContext *eval_ctx, Scene *scene, struct Object *ob, rcti *rect); +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_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 ce3c30d50e0..89a033236f1 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -252,16 +252,15 @@ static int view3d_selectable_data(bContext *C) return 0; if (ob) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); - if (eval_ctx.object_mode & OB_MODE_EDIT) { + const WorkSpace *workspace = CTX_wm_workspace(C); + if (workspace->object_mode & OB_MODE_EDIT) { if (ob->type == OB_FONT) { return 0; } } else { - if ((eval_ctx.object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) && - !BKE_paint_select_elem_test(&eval_ctx, ob)) + 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)) { return 0; } @@ -815,10 +814,10 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, CTX_data_eval_ctx(C, &eval_ctx); if (vc->obedit == NULL) { /* Object Mode */ - if (BKE_paint_select_face_test(&eval_ctx, ob)) { + if (BKE_paint_select_face_test(ob, eval_ctx.object_mode)) { do_lasso_select_paintface(&eval_ctx, vc, mcords, moves, extend, select); } - else if (BKE_paint_select_vert_test(&eval_ctx, ob)) { + else if (BKE_paint_select_vert_test(ob, eval_ctx.object_mode)) { 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))) { @@ -2216,10 +2215,10 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) if (vc.obact && eval_ctx.object_mode & OB_MODE_SCULPT) { ret = ED_sculpt_mask_box_select(C, &vc, &rect, select, extend); } - else if (vc.obact && BKE_paint_select_face_test(&eval_ctx, vc.obact)) { + else if (vc.obact && BKE_paint_select_face_test(vc.obact, eval_ctx.object_mode)) { ret = do_paintface_box_select(&eval_ctx, &vc, &rect, select, extend); } - else if (vc.obact && BKE_paint_select_vert_test(&eval_ctx, vc.obact)) { + else if (vc.obact && BKE_paint_select_vert_test(vc.obact, eval_ctx.object_mode)) { ret = do_paintvert_box_select(&eval_ctx, &vc, &rect, select, extend); } else if (vc.obact && eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) { @@ -2308,8 +2307,7 @@ static bool ed_wpaint_vertex_select_pick( static int view3d_select_exec(bContext *C, wmOperator *op) { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); + 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"); @@ -2321,9 +2319,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(&eval_ctx, obact) || + BKE_paint_select_elem_test(obact, workspace->object_mode) || /* so its possible to select bones in weightpaint mode (LMB select) */ - (obact && (eval_ctx.object_mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact)))); + (obact && (workspace->object_mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(obact)))); bool retval = false; int location[2]; @@ -2357,11 +2355,11 @@ static int view3d_select_exec(bContext *C, wmOperator *op) retval = ED_curve_editfont_select_pick(C, location, extend, deselect, toggle); } - else if (obact && eval_ctx.object_mode & OB_MODE_PARTICLE_EDIT) + else if (obact && workspace->object_mode & OB_MODE_PARTICLE_EDIT) return PE_mouse_particles(C, location, extend, deselect, toggle); - else if (obact && BKE_paint_select_face_test(&eval_ctx, obact)) + else if (obact && BKE_paint_select_face_test(obact, workspace->object_mode)) retval = paintface_mouse_select(C, obact, location, extend, deselect, toggle); - else if (BKE_paint_select_vert_test(&eval_ctx, obact)) + else if (BKE_paint_select_vert_test(obact, workspace->object_mode)) 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); @@ -2875,7 +2873,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) const int mval[2] = {RNA_int_get(op->ptr, "x"), RNA_int_get(op->ptr, "y")}; - if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(&eval_ctx, obact) || + if (CTX_data_edit_object(C) || BKE_paint_select_elem_test(obact, eval_ctx.object_mode) || (obact && (eval_ctx.object_mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) ) { ViewContext vc; @@ -2888,11 +2886,11 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) 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(&eval_ctx, obact)) { + else if (BKE_paint_select_face_test(obact, eval_ctx.object_mode)) { 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(&eval_ctx, obact)) { + else if (BKE_paint_select_vert_test(obact, eval_ctx.object_mode)) { paint_vertsel_circle_select(&eval_ctx, &vc, select, mval, (float)radius); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data); } diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index cee76925040..40dd2f0f428 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -700,12 +700,11 @@ static bool snap_calc_active_center(bContext *C, const bool select_only, float r } } else { - EvaluationContext eval_ctx; - CTX_data_eval_ctx(C, &eval_ctx); Object *ob = CTX_data_active_object(C); if (ob) { - if (eval_ctx.object_mode & OB_MODE_POSE) { + const WorkSpace *workspace = CTX_wm_workspace(C); + if (workspace->object_mode & OB_MODE_POSE) { bPoseChannel *pchan = BKE_pose_channel_active(ob); if (pchan) { if (!select_only || (pchan->bone->flag & BONE_SELECTED)) { |