diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-29 05:21:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-29 05:21:49 +0400 |
commit | 7c97a95911237d2164c317dc25eaecb71ea52a91 (patch) | |
tree | e5d669b42df9bcf0a4c86dc2bbadaf61c8297ad1 /source/blender/editors/mesh/editface.c | |
parent | 7325919323fbf3a032f2dd3761662f83d680b291 (diff) |
improve topology mirror, increase chance of finding unique match.
Diffstat (limited to 'source/blender/editors/mesh/editface.c')
-rw-r--r-- | source/blender/editors/mesh/editface.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index aa1d53367c2..a7afa3f108b 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -733,7 +733,7 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags) /* note, this is not the best place for the function to be but moved * here to for the purpose of syncing with bmesh */ -typedef int MirrTopoHash_t; +typedef unsigned int MirrTopoHash_t; typedef struct MirrTopoVert_t { MirrTopoHash_t hash; @@ -798,6 +798,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to MirrTopoHash_t *topo_hash = NULL; MirrTopoHash_t *topo_hash_prev = NULL; MirrTopoVert_t *topo_pairs; + MirrTopoHash_t topo_pass = 1; intptr_t *index_lookup; /* direct access to mesh_topo_store->index_lookup */ @@ -843,15 +844,15 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to if (em) { BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { - topo_hash[BM_elem_index_get(eed->v1)] += topo_hash_prev[BM_elem_index_get(eed->v2)]; - topo_hash[BM_elem_index_get(eed->v2)] += topo_hash_prev[BM_elem_index_get(eed->v1)]; + topo_hash[BM_elem_index_get(eed->v1)] += topo_hash_prev[BM_elem_index_get(eed->v2)] * topo_pass; + topo_hash[BM_elem_index_get(eed->v2)] += topo_hash_prev[BM_elem_index_get(eed->v1)] * topo_pass; } } else { for (a = 0, medge = me->medge; a < me->totedge; a++, medge++) { /* This can make really big numbers, wrapping around here is fine */ - topo_hash[medge->v1] += topo_hash_prev[medge->v2]; - topo_hash[medge->v2] += topo_hash_prev[medge->v1]; + topo_hash[medge->v1] += topo_hash_prev[medge->v2] * topo_pass; + topo_hash[medge->v2] += topo_hash_prev[medge->v1] * topo_pass; } } memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert); @@ -876,6 +877,8 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to } /* Copy the hash calculated this iter, so we can use them next time */ memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert); + + topo_pass++; } /* Hash/Index pairs are needed for sorting to find index pairs */ |