[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46155] trunk/blender/source/blender/bmesh /intern/bmesh_mesh.c: Fix own error in BM_mesh_remap(), forgot to remap edge pointers in disk_links of edges, so wasn?\226?\128? \153t working at all with edges remapping!

Bastien Montagne montagne29 at wanadoo.fr
Tue May 1 16:13:14 CEST 2012


Revision: 46155
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46155
Author:   mont29
Date:     2012-05-01 14:13:14 +0000 (Tue, 01 May 2012)
Log Message:
-----------
Fix own error in BM_mesh_remap(), forgot to remap edge pointers in disk_links of edges, so wasn?\226?\128?\153t working at all with edges remapping!

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c	2012-05-01 13:51:50 UTC (rev 46154)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_mesh.c	2012-05-01 14:13:14 UTC (rev 46155)
@@ -672,8 +672,8 @@
 			BMEdge *new_edp = edges_pool[*new_idx];
 			*new_edp = *ed;
 			BLI_ghash_insert(eptr_map, (void *)*edp, (void *)new_edp);
+/*			printf("mapping edge from %d to %d (%p/%p to %p)\n", i, *new_idx, *edp, edges_pool[i], new_edp);*/
 		}
-
 		bm->elem_index_dirty |= BM_EDGE;
 
 		MEM_freeN(edges_pool);
@@ -722,13 +722,30 @@
 		}
 	}
 
-	/* Edges' pointers, only vert pointers (as we don't mess with loops!)... */
-	if (vptr_map) {
+	/* Edges' pointers, only vert pointers (as we don't mess with loops!), and - ack! - edge pointers,
+	 * as we have to handle disklinks... */
+	if (vptr_map || eptr_map) {
 		BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) {
-/*			printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/
-/*			printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/
-			ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1);
-			ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2);
+			if (vptr_map) {
+/*				printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/
+/*				printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/
+				ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1);
+				ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2);
+			}
+			if (eptr_map) {
+/*				printf("Edge v1_disk_link prev: %p -> %p\n", ed->v1_disk_link.prev,*/
+/*				       BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.prev));*/
+/*				printf("Edge v1_disk_link next: %p -> %p\n", ed->v1_disk_link.next,*/
+/*				       BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.next));*/
+/*				printf("Edge v2_disk_link prev: %p -> %p\n", ed->v2_disk_link.prev,*/
+/*				       BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.prev));*/
+/*				printf("Edge v2_disk_link next: %p -> %p\n", ed->v2_disk_link.next,*/
+/*				       BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.next));*/
+				ed->v1_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.prev);
+				ed->v1_disk_link.next = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.next);
+				ed->v2_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.prev);
+				ed->v2_disk_link.next = BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.next);
+			}
 		}
 	}
 




More information about the Bf-blender-cvs mailing list