Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-08-28 06:12:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-28 06:20:05 +0300
commited066f231d886b3abe887068fbb4412e03348819 (patch)
tree847e83db1b3087571ec320242706a66a1a11e610 /source/blender/editors/mesh
parentf93b69c17a2e382a636f796ecf7256ba2e960138 (diff)
Cleanup: remove automerge BMesh operator
Move logic into EDBM_automerge since this is meant to run after transform and isn't a generic editing operation.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editmesh_automerge.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/editors/mesh/editmesh_automerge.c b/source/blender/editors/mesh/editmesh_automerge.c
index caf07051b00..57c8c0f7fa8 100644
--- a/source/blender/editors/mesh/editmesh_automerge.c
+++ b/source/blender/editors/mesh/editmesh_automerge.c
@@ -56,16 +56,32 @@
void EDBM_automerge(Scene *scene, Object *obedit, bool update, const char hflag)
{
- bool ok;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
+ BMesh *bm = em->bm;
+ int totvert_prev = bm->totvert;
- ok = BMO_op_callf(em->bm,
- BMO_FLAG_DEFAULTS,
- "automerge verts=%hv dist=%f",
- hflag,
- scene->toolsettings->doublimit);
+ BMOperator findop, weldop;
- if (LIKELY(ok) && update) {
+ /* Search for doubles among all vertices, but only merge non-VERT_KEEP
+ * vertices into VERT_KEEP vertices. */
+ BMO_op_initf(bm,
+ &findop,
+ BMO_FLAG_DEFAULTS,
+ "find_doubles verts=%av keep_verts=%Hv dist=%f",
+ hflag,
+ scene->toolsettings->doublimit);
+
+ BMO_op_exec(bm, &findop);
+
+ /* weld the vertices */
+ BMO_op_init(bm, &weldop, BMO_FLAG_DEFAULTS, "weld_verts");
+ BMO_slot_copy(&findop, slots_out, "targetmap.out", &weldop, slots_in, "targetmap");
+ BMO_op_exec(bm, &weldop);
+
+ BMO_op_finish(bm, &findop);
+ BMO_op_finish(bm, &weldop);
+
+ if ((totvert_prev != bm->totvert) && update) {
EDBM_update_generic(em, true, true);
}
}