diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 09:52:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-23 09:52:52 +0300 |
commit | a6eb9a3e21894fad2605cf1e4ae228147be71857 (patch) | |
tree | 7509d90c2ae1207738bce87d933aca7ccb775631 /source/blender/editors | |
parent | dcf359b15a0bbc62af756182fa9c529c25c3ceb2 (diff) |
Tool System: uv lasso/box select options
These tools now support (new, add, subtract),
(xor, and) could be supported but are complicated by UV's sticky
selection modes.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 2d9995d3ccc..30c0bc741c2 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3185,7 +3185,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) BMIter iter, liter; MLoopUV *luv; rctf rectf; - bool pinned, select, extend; + bool pinned; const bool use_face_center = ( (ts->uv_flag & UV_SYNC_SELECTION) ? (ts->selectmode == SCE_SELECT_FACE) : @@ -3195,9 +3195,9 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rctf(op, &rectf); UI_view2d_region_to_view_rctf(&ar->v2d, &rectf, &rectf); - /* figure out what to select/deselect */ - select = !RNA_boolean_get(op->ptr, "deselect"); - extend = RNA_boolean_get(op->ptr, "extend"); + const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); + const bool select = (sel_op != SEL_OP_SUB); + pinned = RNA_boolean_get(op->ptr, "pinned"); bool changed_multi = false; @@ -3214,8 +3214,9 @@ static int uv_box_select_exec(bContext *C, wmOperator *op) const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); - if (!extend) + if (SEL_OP_USE_PRE_DESELECT(sel_op)) { uv_select_all_perform_multi(scene, ima, objects, objects_len, SEL_DESELECT); + } /* do actual selection */ if (use_face_center && !pinned) { @@ -3308,7 +3309,8 @@ static void UV_OT_select_box(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only"); - WM_operator_properties_gesture_box_select(ot); + WM_operator_properties_gesture_box(ot); + WM_operator_properties_select_operation_simple(ot); } /** \} */ @@ -3454,8 +3456,9 @@ static void UV_OT_select_circle(wmOperatorType *ot) /** \name Lasso Select Operator * \{ */ -static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short moves, - const bool select, const bool extend) +static bool do_lasso_select_mesh_uv( + bContext *C, const int mcords[][2], short moves, + const eSelectOp sel_op) { Depsgraph *depsgraph = CTX_data_depsgraph(C); SpaceImage *sima = CTX_wm_space_image(C); @@ -3468,7 +3471,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo (ts->uv_flag & UV_SYNC_SELECTION) ? (ts->selectmode == SCE_SELECT_FACE) : (ts->uv_selectmode == UV_SELECT_FACE)); - + const bool select = (sel_op != SEL_OP_SUB); BMIter iter, liter; @@ -3493,7 +3496,7 @@ static bool do_lasso_select_mesh_uv(bContext *C, const int mcords[][2], short mo const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); - if (!extend && select) { + if (SEL_OP_USE_PRE_DESELECT(sel_op)) { uv_select_all_perform_multi(scene, ima, objects, objects_len, SEL_DESELECT); } @@ -3567,13 +3570,8 @@ static int uv_lasso_select_exec(bContext *C, wmOperator *op) const int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot); if (mcords) { - bool select, extend; - bool changed; - - select = !RNA_boolean_get(op->ptr, "deselect"); - extend = RNA_boolean_get(op->ptr, "extend"); - changed = do_lasso_select_mesh_uv(C, mcords, mcords_tot, select, extend); - + const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); + bool changed = do_lasso_select_mesh_uv(C, mcords, mcords_tot, sel_op); MEM_freeN((void *)mcords); return changed ? OPERATOR_FINISHED : OPERATOR_CANCELLED; @@ -3598,7 +3596,8 @@ static void UV_OT_select_lasso(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - WM_operator_properties_gesture_lasso_select(ot); + WM_operator_properties_gesture_lasso(ot); + WM_operator_properties_select_operation_simple(ot); } /** \} */ |