diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-02 08:45:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-02 08:45:44 +0400 |
commit | 4253e52771c40b347ddc0d02586f2c405afa30d4 (patch) | |
tree | 6622130cff8600b4817af1983ab3f19bec536acb /source/blender/bmesh | |
parent | 56c127e721681f6978870218b28d8edf5287fbf7 (diff) |
fix [#30768] Project from View UV map tool includes hidden geometry r45323
select all could select hidden faces, now BM_mesh_elem_flag_enable/disable_all takes an argument to skip hidden elements.
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.c | 26 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.h | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_inset.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 2 |
4 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 2116acc337e..3117c74c1a7 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -762,7 +762,7 @@ void BM_select_history_validate(BMesh *bm) } } -void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag) +void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag, int respecthide) { const char iter_types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, @@ -778,7 +778,10 @@ void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag BM_select_history_clear(bm); } - if (htype == (BM_VERT | BM_EDGE | BM_FACE) && (hflag == BM_ELEM_SELECT)) { + if ((htype == (BM_VERT | BM_EDGE | BM_FACE)) && + (hflag == BM_ELEM_SELECT) && + (respecthide == FALSE)) + { /* fast path for deselect all, avoid topology loops * since we know all will be de-selected anyway. */ for (i = 0; i < 3; i++) { @@ -794,6 +797,11 @@ void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag if (htype & flag_types[i]) { ele = BM_iter_new(&iter, bm, iter_types[i], NULL); for ( ; ele; ele = BM_iter_step(&iter)) { + + if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) { + continue; + } + if (hflag & BM_ELEM_SELECT) { BM_elem_select_set(bm, ele, FALSE); } @@ -804,7 +812,7 @@ void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag } } -void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag) +void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag, int respecthide) { const char iter_types[3] = {BM_VERTS_OF_MESH, BM_EDGES_OF_MESH, @@ -812,6 +820,11 @@ void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag) const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE}; + /* use the nosel version when setting so under no + * condition may a hidden face become selected. + * Applying other flags to hidden faces is OK. */ + const char hflag_nosel = hflag & ~BM_ELEM_SELECT; + BMIter iter; BMElem *ele; int i; @@ -828,10 +841,15 @@ void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag) if (htype & flag_types[i]) { ele = BM_iter_new(&iter, bm, iter_types[i], NULL); for ( ; ele; ele = BM_iter_step(&iter)) { + + if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) { + continue; + } + if (hflag & BM_ELEM_SELECT) { BM_elem_select_set(bm, ele, TRUE); } - BM_elem_flag_enable(ele, hflag); + BM_elem_flag_enable(ele, hflag_nosel); } } } diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index a02931b0e88..fa078c74b2e 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -45,8 +45,8 @@ void BM_face_hide_set(BMesh *bm, BMFace *f, int hide); #define BM_elem_select_set(bm, ele, hide) _bm_elem_select_set(bm, &(ele)->head, hide) void _bm_elem_select_set(BMesh *bm, BMHeader *ele, int select); -void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag); -void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag); +void BM_mesh_elem_flag_enable_all(BMesh *bm, const char htype, const char hflag, int respecthide); +void BM_mesh_elem_flag_disable_all(BMesh *bm, const char htype, const char hflag, int respecthide); /* individual element select functions, BM_elem_select_set is a shortcut for these * that automatically detects which one to use*/ diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 4a426b40995..23255d1c514 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -119,11 +119,11 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op) int i, j, k; if (use_outset == FALSE) { - BM_mesh_elem_flag_disable_all(bm, BM_FACE, BM_ELEM_TAG); + BM_mesh_elem_flag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE); BMO_slot_buffer_hflag_enable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE); } else { - BM_mesh_elem_flag_enable_all(bm, BM_FACE, BM_ELEM_TAG); + BM_mesh_elem_flag_enable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE); BMO_slot_buffer_hflag_disable(bm, op, "faces", BM_FACE, BM_ELEM_TAG, FALSE); } diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 03f9fe04394..bcd9566ce98 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -1053,7 +1053,7 @@ void BM_mesh_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float s // int i; /* deselect input */ - BM_mesh_elem_flag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT); + BM_mesh_elem_flag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE); ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE|BM_VERT); for ( ; ele; ele = BMO_iter_step(&iter)) { |