diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-01 18:13:14 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-01 18:13:14 +0400 |
commit | b09ac48d0f95c42848fb25973f23efba9bba6417 (patch) | |
tree | 3029a7627535c002ace80150f7d345db60ab2268 /source/blender/bmesh/intern | |
parent | 75a468f61eb9cd8523768a0d1b49af97ef55e196 (diff) |
Fix own error in BM_mesh_remap(), forgot to remap edge pointers in disk_links of edges, so wasn’t working at all with edges remapping!
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 31 |
1 files changed, 24 insertions, 7 deletions
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); + } } } |