[Bf-blender-cvs] [ab2d1f61a8e] master: BMesh: use heap update for dissolve-decimate

Campbell Barton noreply at git.blender.org
Sun Oct 29 14:35:05 CET 2017


Commit: ab2d1f61a8e94650b8cb20a588b5c9ce27c13431
Author: Campbell Barton
Date:   Mon Oct 30 00:36:52 2017 +1100
Branches: master
https://developer.blender.org/rBab2d1f61a8e94650b8cb20a588b5c9ce27c13431

BMesh: use heap update for dissolve-decimate

===================================================================

M	source/blender/bmesh/tools/bmesh_decimate_dissolve.c

===================================================================

diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
index e2c36299ddf..72722eab4e6 100644
--- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
+++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c
@@ -342,8 +342,7 @@ void BM_mesh_decimate_dissolve_ex(
 						const int j = BM_elem_index_get(l_iter->e);
 						if (j != -1 && eheap_table[j]) {
 							const float cost = bm_edge_calc_dissolve_error(l_iter->e, delimit, &delimit_data);
-							BLI_heap_remove(eheap, eheap_table[j]);
-							eheap_table[j] = BLI_heap_insert(eheap, cost, l_iter->e);
+							BLI_heap_node_value_update(eheap, eheap_table[j], cost);
 						}
 					} while ((l_iter = l_iter->next) != l_first);
 				}
@@ -353,8 +352,7 @@ void BM_mesh_decimate_dissolve_ex(
 			}
 
 			if (UNLIKELY(f_new == NULL)) {
-				BLI_heap_remove(eheap, enode_top);
-				eheap_table[i] = BLI_heap_insert(eheap, COST_INVALID, e);
+				BLI_heap_node_value_update(eheap, enode_top, COST_INVALID);
 			}
 		}
 
@@ -475,8 +473,7 @@ void BM_mesh_decimate_dissolve_ex(
 						const int j = BM_elem_index_get(v_iter);
 						if (j != -1 && vheap_table[j]) {
 							const float cost = bm_vert_edge_face_angle(v_iter);
-							BLI_heap_remove(vheap, vheap_table[j]);
-							vheap_table[j] = BLI_heap_insert(vheap, cost, v_iter);
+							BLI_heap_node_value_update(vheap, vheap_table[j], cost);
 						}
 					}
 
@@ -497,8 +494,7 @@ void BM_mesh_decimate_dissolve_ex(
 								    (BLI_heap_node_value(vheap_table[j]) == COST_INVALID))
 								{
 									const float cost = bm_vert_edge_face_angle(l_cycle_iter->v);
-									BLI_heap_remove(vheap, vheap_table[j]);
-									vheap_table[j] = BLI_heap_insert(vheap, cost, l_cycle_iter->v);
+									BLI_heap_node_value_update(vheap, vheap_table[j], cost);
 								}
 							} while ((l_cycle_iter = l_cycle_iter->next) != l_cycle_first);
 
@@ -510,8 +506,7 @@ void BM_mesh_decimate_dissolve_ex(
 			}
 
 			if (UNLIKELY(e_new == NULL)) {
-				BLI_heap_remove(vheap, vnode_top);
-				vheap_table[i] = BLI_heap_insert(vheap, COST_INVALID, v);
+				BLI_heap_node_value_update(vheap, vnode_top, COST_INVALID);
 			}
 		}



More information about the Bf-blender-cvs mailing list