diff options
Diffstat (limited to 'source/blender/bmesh/tools')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_collapse.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index d734d9b6ae1..a081a1b70e4 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -256,10 +256,6 @@ static void bm_decim_build_edge_cost_single( { float cost; - if (eheap_table[BM_elem_index_get(e)]) { - BLI_heap_remove(eheap, eheap_table[BM_elem_index_get(e)]); - } - if (UNLIKELY(vweights && ((vweights[BM_elem_index_get(e->v1)] == 0.0f) || (vweights[BM_elem_index_get(e->v2)] == 0.0f)))) @@ -341,10 +337,18 @@ static void bm_decim_build_edge_cost_single( } } - eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, cost, e); + if (eheap_table[BM_elem_index_get(e)]) { + BLI_heap_reinsert(eheap, eheap_table[BM_elem_index_get(e)], cost); + } + else { + eheap_table[BM_elem_index_get(e)] = BLI_heap_insert(eheap, cost, e); + } return; clear: + if (eheap_table[BM_elem_index_get(e)]) { + BLI_heap_remove(eheap, eheap_table[BM_elem_index_get(e)]); + } eheap_table[BM_elem_index_get(e)] = NULL; } |