diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_mesh.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 25 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 39 |
3 files changed, 47 insertions, 19 deletions
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index e3d762dccfb..097ea477501 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -143,7 +143,7 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, /* editmesh_select.c */ void EDBM_select_mirrored(struct BMEditMesh *em, bool extend, int *r_totmirr, int *r_totfail); -void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update); +void EDBM_automerge(struct Scene *scene, struct Object *ob, bool update, const char hflag); bool EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); int EDBM_backbuf_check(unsigned int index); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index b0c76d23664..e14dd484ad3 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -119,26 +119,17 @@ void EDBM_select_mirrored(BMEditMesh *em, bool extend, *r_totfail = totfail; } -void EDBM_automerge(Scene *scene, Object *obedit, bool update) +void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag) { - - if ((scene->toolsettings->automerge) && - (obedit && obedit->type == OB_MESH)) - { - int ok; - BMEditMesh *em = BKE_editmesh_from_object(obedit); - - if (!em) { - return; - } + int ok; + BMEditMesh *em = BKE_editmesh_from_object(obedit); - ok = BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, - "automerge verts=%hv dist=%f", - BM_ELEM_SELECT, scene->toolsettings->doublimit); + ok = BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, + "automerge verts=%hv dist=%f", + hflag, scene->toolsettings->doublimit); - if (LIKELY(ok) && update) { - EDBM_update_generic(em, true, true); - } + if (LIKELY(ok) && update) { + EDBM_update_generic(em, true, true); } } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2b99405c749..d8f763c6a54 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5161,6 +5161,40 @@ static void special_aftertrans_update__mask(bContext *C, TransInfo *t) } } +static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) +{ + /* so automerge supports mirror */ + if ((t->scene->toolsettings->automerge) && + (t->obedit && t->obedit->type == OB_MESH)) + { + BMEditMesh *em = BKE_editmesh_from_object(t->obedit); + BMesh *bm = em->bm; + char hflag; + + if (t->flag & T_MIRROR) { + TransData *td; + int i; + + /* rather then adjusting the selection (which the user would notice) + * tag all mirrored verts, then automerge those */ + BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false); + + for (i = 0, td = t->data; i < t->total; i++, td++) { + if (td->extra) { + BM_elem_flag_enable((BMVert *)td->extra, BM_ELEM_TAG); + } + } + + hflag = BM_ELEM_SELECT | BM_ELEM_TAG; + } + else { + hflag = BM_ELEM_SELECT; + } + + EDBM_automerge(t->scene, t->obedit, true, hflag); + } +} + /* inserting keys, pointcache, redraw events... */ /* * note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell) @@ -5193,7 +5227,10 @@ void special_aftertrans_update(bContext *C, TransInfo *t) * during cleanup - psy-fi */ freeEdgeSlideTempFaces(sld); } - EDBM_automerge(t->scene, t->obedit, true); + + if (t->obedit->type == OB_MESH) { + special_aftertrans_update__mesh(C, t); + } } else { if (t->mode == TFM_EDGE_SLIDE) { |