[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34257] trunk/blender/source/blender/ editors/sculpt_paint: Bugfix, own testing

Ton Roosendaal ton at blender.org
Tue Jan 11 13:36:50 CET 2011


Revision: 34257
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34257
Author:   ton
Date:     2011-01-11 12:36:49 +0000 (Tue, 11 Jan 2011)
Log Message:
-----------
Bugfix, own testing

When pressure was zero, a sculpt brush was still being executed
with step amount divided by zero, and thus entering eternal loop.

Maybe tablet-specific this but I wonder how this never got reported...

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2011-01-11 11:25:24 UTC (rev 34256)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2011-01-11 12:36:49 UTC (rev 34257)
@@ -769,14 +769,18 @@
 			float pressure;
 
 			pressure = event_tablet_data(event, NULL);
-			scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
-			mul_v2_fl(vec, scale);
+			if(pressure > FLT_EPSILON) {
+				scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
+				if(scale > FLT_EPSILON) {
+					mul_v2_fl(vec, scale);
 
-			steps = (int)(1.0f / scale);
+					steps = (int)(1.0f / scale);
 
-			for(i = 0; i < steps; ++i, ++cnt) {
-				add_v2_v2(mouse, vec);
-				paint_brush_stroke_add_step(C, op, event, mouse);
+					for(i = 0; i < steps; ++i, ++cnt) {
+						add_v2_v2(mouse, vec);
+						paint_brush_stroke_add_step(C, op, event, mouse);
+					}
+				}
 			}
 		}
 	}

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-01-11 11:25:24 UTC (rev 34256)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-01-11 12:36:49 UTC (rev 34257)
@@ -306,6 +306,7 @@
 {
 	test->radius_squared= ss->cache->radius_squared;
 	copy_v3_v3(test->location, ss->cache->location);
+	test->dist= 0.0f;	/* just for initialize */
 }
 
 static int sculpt_brush_test(SculptBrushTest *test, float co[3])




More information about the Bf-blender-cvs mailing list