[Bf-blender-cvs] [aa436eecd0d] soc-2016-pbvh-painting: Fix crash when use_group_restrict is disabled

Campbell Barton noreply at git.blender.org
Wed Apr 12 17:19:24 CEST 2017


Commit: aa436eecd0d426247f3eebdacc3dacd84b0631f9
Author: Campbell Barton
Date:   Thu Apr 13 01:20:02 2017 +1000
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rBaa436eecd0d426247f3eebdacc3dacd84b0631f9

Fix crash when use_group_restrict is disabled

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

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 531c4e4c6c7..26ec13e99a2 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2568,37 +2568,28 @@ static void do_wpaint_brush_draw_task_cb_ex(
 				if (view_dot > 0.0f) {
 					const float brush_fade = BKE_brush_curve_strength(brush, sqrtf(test.dist), cache->radius);
 					float final_alpha = view_dot * brush_fade * brush_strength * grid_alpha * brush_alpha_pressure;
-					float weight_curr;
 
 					/* Spray logic */
-					if (!(data->vp->flag & VP_SPRAY)) {
+					if ((data->vp->flag & VP_SPRAY) == 0) {
 						MDeformVert *dv = &data->me->dvert[v_index];
 						const MDeformWeight *dw;
 						dw = (data->vp->flag & VP_ONLYVGROUP) ?
 						        defvert_find_index(dv, data->wpi->active.index) :
 						        defvert_verify_index(dv, data->wpi->active.index);
-						weight_curr = dw->weight;
+						const float weight_curr = dw->weight;
 						if (ss->modes.vwpaint.max_weight[v_index] < 0) {
-							ss->modes.vwpaint.max_weight[v_index] = min_ff(brush_strength + dw->weight, 1.0f);
+							ss->modes.vwpaint.max_weight[v_index] = min_ff(brush_strength + weight_curr, 1.0f);
 						}
-						CLAMP(final_alpha, 0.0, ss->modes.vwpaint.max_weight[v_index] - dw->weight);
-					}
+						CLAMP(final_alpha, 0.0, ss->modes.vwpaint.max_weight[v_index] - weight_curr);
 
-					/* Splash Prevention */
-					switch (data->vp->flag) {
-						case VP_SPRAY:
-							if (weight_curr < ss->modes.vwpaint.max_weight[v_index]) {
-								do_weight_paint_vertex(
-								        data->vp, data->ob, data->wpi,
-								        v_index, final_alpha, paintweight);
-							}
-							break;
-						default:
-							do_weight_paint_vertex(
-							        data->vp, data->ob, data->wpi,
-							        v_index, final_alpha, paintweight);
-							break;
+						if (weight_curr >= ss->modes.vwpaint.max_weight[v_index]) {
+							continue;
+						}
 					}
+
+					do_weight_paint_vertex(
+					        data->vp, data->ob, data->wpi,
+					        v_index, final_alpha, paintweight);
 				}
 			}
 		}
@@ -2633,7 +2624,7 @@ static void do_wpaint_brush_calc_ave_weight_cb_ex(
 			const float view_dot = (vd.no) ? dot_vf3vs3(cache->sculpt_normal_symm, vd.no) : 1.0;
 			if (view_dot > 0.0 && BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) {
 				const int v_index = ccgdm ? data->me->mloop[vd.grid_indices[vd.g]].v : vd.vert_indices[vd.i];
-				const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
+				// const float grid_alpha = ccgdm ? 1.0f / vd.gridsize : 1.0f;
 				const char v_flag = data->me->mvert[v_index].flag;
 
 				/* If the vertex is selected. */




More information about the Bf-blender-cvs mailing list