[Bf-blender-cvs] [13a4147] master: Dynamic Paint: Don't store duplicate adjacency links.

Alexander Gavrilov noreply at git.blender.org
Tue Sep 27 20:59:59 CEST 2016


Commit: 13a4147c17f82681c29fcc25cce86aff1702f2d1
Author: Alexander Gavrilov
Date:   Tue Sep 27 12:21:44 2016 +0300
Branches: master
https://developer.blender.org/rB13a4147c17f82681c29fcc25cce86aff1702f2d1

Dynamic Paint: Don't store duplicate adjacency links.

Duplicates can happen at UV seams in case of resolution mismatch
or other complications. It's better not to store them in case it
confuses some math later on.

Reviewers: mont29

Differential Revision: https://developer.blender.org/D2261

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

M	source/blender/blenkernel/intern/dynamicpaint.c

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

diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 2a01a7a..c739904 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -2673,6 +2673,7 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
 						const int index = tx + w * ty;
 
 						if (tempPoints[index].tri_index != -1) {
+							int start_pos = n_pos;
 							ed->n_index[final_index[index]] = n_pos;
 							ed->n_num[final_index[index]] = 0;
 
@@ -2681,10 +2682,20 @@ int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface, flo
 								const int n_target = dynamic_paint_find_neighbour_pixel(
 								                         &data, vert_to_looptri_map, w, h, tx, ty, i);
 
-								if (n_target >= 0) {
-									ed->n_target[n_pos] = final_index[n_target];
-									ed->n_num[final_index[index]]++;
-									n_pos++;
+								if (n_target >= 0 && n_target != index) {
+									bool duplicate = false;
+									for (int j = start_pos; j < n_pos; j++) {
+										if (ed->n_target[j] == final_index[n_target]) {
+											duplicate = true;
+											break;
+										}
+									}
+
+									if (!duplicate) {
+										ed->n_target[n_pos] = final_index[n_target];
+										ed->n_num[final_index[index]]++;
+										n_pos++;
+									}
 								}
 								else if (n_target == ON_MESH_EDGE || n_target == OUT_OF_TEXTURE) {
 									ed->flags[final_index[index]] |= ADJ_ON_MESH_EDGE;




More information about the Bf-blender-cvs mailing list