diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 16:40:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-26 16:42:47 +0400 |
commit | cf0120b18954471b112feddd1c2e18bb62625688 (patch) | |
tree | 9a1413071bc991d3e771dfb4850a01229b5c3fbc /source | |
parent | b5b1ce9d212208bbbf8342839e9c6edcf9e266c1 (diff) |
Fix for own regression: remove doubles deselected faces
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 189eafee6a1..43de430d8bd 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1893,6 +1893,16 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) const bool use_unselected = RNA_boolean_get(op->ptr, "use_unselected"); const int totvert_orig = em->bm->totvert; int count; + char htype_select; + + /* avoid loosing selection state (select -> tags) */ + if (em->selectmode & SCE_SELECT_VERTEX) htype_select = BM_VERT; + else if (em->selectmode & SCE_SELECT_EDGE) htype_select = BM_EDGE; + else htype_select = BM_FACE; + + /* store selection as tags */ + BM_mesh_elem_hflag_enable_test(em->bm, htype_select, BM_ELEM_TAG, true, true, BM_ELEM_SELECT); + if (use_unselected) { EDBM_op_init(em, &bmop, op, @@ -1923,6 +1933,10 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op) count = totvert_orig - em->bm->totvert; BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count); + /* restore selection from tags */ + BM_mesh_elem_hflag_enable_test(em->bm, htype_select, BM_ELEM_SELECT, true, true, BM_ELEM_TAG); + EDBM_selectmode_flush(em); + EDBM_update_generic(em, true, true); return OPERATOR_FINISHED; |