[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57100] trunk/blender/source/blender/ editors/mesh/editface.c: improve topology mirror, increase chance of finding unique match.

Campbell Barton ideasman42 at gmail.com
Wed May 29 03:21:56 CEST 2013


Revision: 57100
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57100
Author:   campbellbarton
Date:     2013-05-29 01:21:49 +0000 (Wed, 29 May 2013)
Log Message:
-----------
improve topology mirror, increase chance of finding unique match.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editface.c

Modified: trunk/blender/source/blender/editors/mesh/editface.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editface.c	2013-05-29 00:00:24 UTC (rev 57099)
+++ trunk/blender/source/blender/editors/mesh/editface.c	2013-05-29 01:21:49 UTC (rev 57100)
@@ -733,7 +733,7 @@
 /* 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 @@
 	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 @@
 
 		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 @@
 		}
 		/* 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 */




More information about the Bf-blender-cvs mailing list