[Bf-blender-cvs] [13c78c0d277] soc-2016-pbvh-painting: Direction may be zero length even when not first-evaluated

Campbell Barton noreply at git.blender.org
Wed Apr 12 16:37:11 CEST 2017


Commit: 13c78c0d2776dabfb9471772e05ac57f794a45e7
Author: Campbell Barton
Date:   Wed Apr 12 23:40:28 2017 +1000
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB13c78c0d2776dabfb9471772e05ac57f794a45e7

Direction may be zero length even when not first-evaluated

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

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 25ebf257751..59d249e0de7 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2464,10 +2464,7 @@ static void do_wpaint_brush_smudge_task_cb_ex(
 	float brush_dir[3];
 
 	sub_v3_v3v3(brush_dir, cache->location, cache->last_location);
-	normalize_v3(brush_dir);
-
-	/* If the position from the last update is initialized... (smudge requires a direction) */
-	if (cache->is_last_valid) {
+	if (normalize_v3(brush_dir) != 0.0f) {
 		/* For each vertex */
 		PBVHVertexIter vd;
 		BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
@@ -2480,7 +2477,7 @@ static void do_wpaint_brush_smudge_task_cb_ex(
 				bool do_color = false;
 				const float view_dot = (vd.no) ? dot_vf3vs3(cache->sculpt_normal_symm, vd.no) : 1.0;
 
-				/* For grid based pbvh, take the vert whose loop cooresponds to the current grid. 
+				/* For grid based pbvh, take the vert whose loop cooresponds to the current grid.
 				 * Otherwise, take the current vert. */
 				int v_index;
 				float grid_alpha = 1.0;
@@ -3561,10 +3558,7 @@ static void do_vpaint_brush_smudge_task_cb_ex(
 	const bool use_face_sel = (data->me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
 
 	sub_v3_v3v3(brush_dir, cache->location, cache->last_location);
-	normalize_v3(brush_dir);
-
-	/* If the position from the last update is initialized... (can't smudge without a direction) */
-	if (cache->is_last_valid) {
+	if (normalize_v3(brush_dir) != 0.0f) {
 		/* For each vertex */
 		PBVHVertexIter vd;
 		BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)




More information about the Bf-blender-cvs mailing list