diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-08-14 03:28:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-08-14 18:48:55 +0300 |
commit | e88e80a6a0c8976ac2d245c274ca5a0388736743 (patch) | |
tree | 870bc13538dfb5b55d4063cdab0aa611573dde60 /source/blender/editors/mesh/editface.c | |
parent | d92d310b158d4b946aa8b811248b25e7a39f7a1a (diff) |
3D View boarder/lasso select tool options
Add tool options to control how select operates (add/sub/set/and/xor).
Note: edit mode armature select still needs to support all options,
this is complicated by how it handles partial end-point selection.
Diffstat (limited to 'source/blender/editors/mesh/editface.c')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index dde66b8aa13..6c126551228 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -46,6 +46,7 @@ #include "ED_mesh.h" #include "ED_screen.h" +#include "ED_select_utils.h" #include "ED_view3d.h" #include "WM_api.h" @@ -391,7 +392,7 @@ bool paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], b return true; } -int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool extend) +int do_paintface_box_select(ViewContext *vc, rcti *rect, int sel_op) { Object *ob = vc->obact; Mesh *me; @@ -412,7 +413,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten selar = MEM_callocN(me->totpoly + 1, "selar"); - if (extend == false && select) { + if (SEL_OP_USE_PRE_DESELECT(sel_op)) { paintface_deselect_all_visible(vc->obact, SEL_DESELECT, false); } @@ -439,13 +440,12 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten mpoly = me->mpoly; for (a = 1; a <= me->totpoly; a++, mpoly++) { - if (selar[a]) { - if (mpoly->flag & ME_HIDE) { - /* pass */ - } - else { - if (select) mpoly->flag |= ME_FACE_SEL; - else mpoly->flag &= ~ME_FACE_SEL; + if ((mpoly->flag & ME_HIDE) == 0) { + const bool is_select = mpoly->flag & ME_FACE_SEL; + const bool is_inside = (selar[a] != 0); + const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside); + if (sel_op_result != -1) { + SET_FLAG_FROM_TEST(mpoly->flag, sel_op_result, ME_FACE_SEL); } } } |