[Bf-blender-cvs] [8e2a78dbcc7] soc-2016-pbvh-painting: Avoid redundant vert->loop->vert topology lookup

Campbell Barton noreply at git.blender.org
Wed Sep 27 07:37:36 CEST 2017


Commit: 8e2a78dbcc70849ecd08397495a9690ef1d7937d
Author: Campbell Barton
Date:   Wed Sep 27 14:56:28 2017 +1000
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB8e2a78dbcc70849ecd08397495a9690ef1d7937d

Avoid redundant vert->loop->vert topology lookup

This is only needed for vertex colors, vertices store their own weights,
so this is redundant.

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

M	source/blender/editors/sculpt_paint/paint_vertex.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 5265032ed58..78cef13b161 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2714,15 +2714,9 @@ static void do_wpaint_brush_calc_average_weight_cb_ex(
 
 				/* If the vertex is selected. */
 				if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) {
-					gmap->tot_loops_hit[n] += gmap->vert_to_loop[v_index].count;
-					/* if a vertex is within the brush region, then add it's weight to the total weight. */
-					for (int j = 0; j < gmap->vert_to_loop[v_index].count; j++) {
-						const int l_index = gmap->vert_to_loop[v_index].indices[j];
-
-						const MLoop *ml = &data->me->mloop[l_index];
-						const MDeformVert *dv = &data->me->dvert[ml->v];
-						weight += defvert_find_weight(dv, data->wpi->active.index);
-					}
+					gmap->tot_loops_hit[n] += 1;
+					const MDeformVert *dv = &data->me->dvert[v_index];
+					weight += defvert_find_weight(dv, data->wpi->active.index);
 				}
 			}
 		}



More information about the Bf-blender-cvs mailing list