[Bf-blender-cvs] [71564debf91] master: Fix T56074: Remove doubles creates holes

Campbell Barton noreply at git.blender.org
Fri Jul 27 02:55:24 CEST 2018


Commit: 71564debf919d9ac99387359e9a07195bf0d94ff
Author: Campbell Barton
Date:   Fri Jul 27 10:51:42 2018 +1000
Branches: master
https://developer.blender.org/rB71564debf919d9ac99387359e9a07195bf0d94ff

Fix T56074: Remove doubles creates holes

Own regression when moving remove-doubles to kd-tree
(seems to happen only in rare cases).

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

M	source/blender/blenlib/intern/BLI_kdtree.c

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

diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index 700000b7717..80a2957d907 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -774,7 +774,12 @@ int BLI_kdtree_calc_duplicates_fast(
 			if (ELEM(duplicates[index], -1, index)) {
 				p.search = index;
 				copy_v3_v3(p.search_co, tree->nodes[node_index].co);
+				int found_prev = found;
 				deduplicate_recursive(&p, tree->root);
+				if (found != found_prev) {
+					/* Prevent chains of doubles. */
+					duplicates[index] = index;
+				}
 			}
 		}
 		MEM_freeN(order);
@@ -786,7 +791,12 @@ int BLI_kdtree_calc_duplicates_fast(
 			if (ELEM(duplicates[index], -1, index)) {
 				p.search = index;
 				copy_v3_v3(p.search_co, tree->nodes[node_index].co);
+				int found_prev = found;
 				deduplicate_recursive(&p, tree->root);
+				if (found != found_prev) {
+					/* Prevent chains of doubles. */
+					duplicates[index] = index;
+				}
 			}
 		}
 	}



More information about the Bf-blender-cvs mailing list