From b09ac48d0f95c42848fb25973f23efba9bba6417 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 1 May 2012 14:13:14 +0000 Subject: =?UTF-8?q?Fix=20own=20error=20in=20BM=5Fmesh=5Fremap(),=20forgot?= =?UTF-8?q?=20to=20remap=20edge=20pointers=20in=20disk=5Flinks=20of=20edge?= =?UTF-8?q?s,=20so=20wasn=E2=80=99t=20working=20at=20all=20with=20edges=20?= =?UTF-8?q?remapping!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/blender/bmesh/intern/bmesh_mesh.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'source/blender/bmesh') diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index bd6eb7ae149..cb66486cd9e 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -672,8 +672,8 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) 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 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) } } - /* 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); + } } } -- cgit v1.2.3