diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-09 14:14:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-09 14:14:39 +0300 |
commit | 5db950e860b2f64078cfc8cf00cb4f430b8a1baf (patch) | |
tree | b9a734351e0cfa849c3c136e4fc6f26276c7c5c0 /source/blender/editors/space_view3d/view3d_select.c | |
parent | 25074be697cb5726328aa5d064a60788c1da6aeb (diff) |
Cleanup: use workspace for object_mode when possible
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 36 |
1 files changed, 17 insertions, 19 deletions
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); } |