[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56458] trunk/blender/source/blender: Fix 2D painting gave squares rather than a disk for the "Max" curve falloff shape.

Brecht Van Lommel brechtvanlommel at pandora.be
Wed May 1 21:50:38 CEST 2013


Revision: 56458
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56458
Author:   blendix
Date:     2013-05-01 19:50:37 +0000 (Wed, 01 May 2013)
Log Message:
-----------
Fix 2D painting gave squares rather than a disk for the "Max" curve falloff shape.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-05-01 19:07:32 UTC (rev 56457)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-05-01 19:50:37 UTC (rev 56458)
@@ -845,7 +845,7 @@
 				xy[1] = y + yoff;
 
 				if (fill == BRUSH_IMBUF_MASK) {
-					alpha_f = alpha * BKE_brush_curve_strength(brush, len_v2(xy), radius);
+					alpha_f = alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius);
 
 					dst[0] = crgb[0];
 					dst[1] = crgb[1];
@@ -1067,15 +1067,17 @@
 /* Uses the brush curve control to find a strength value between 0 and 1 */
 float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len)
 {
+	float strength;
+
 	if (p >= len) return 0;
 	else p = p / len;
 
 	curvemapping_initialize(br->curve);
-	p = curvemapping_evaluateF(br->curve, 0, p);
+	strength = curvemapping_evaluateF(br->curve, 0, p);
 
-	if (p < 0.0f) p = 0.0f;
-	else if (p > 1.0f) p = 1.0f;
-	return p;
+	CLAMP(strength, 0.0f, 1.0f);
+
+	return strength;
 }
 /* same as above but can return negative values if the curve enables
  * used for sculpt only */

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2013-05-01 19:07:32 UTC (rev 56457)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_cursor.c	2013-05-01 19:50:37 UTC (rev 56458)
@@ -377,10 +377,8 @@
 				len = sqrtf(x * x + y * y);
 
 				if (len <= 1) {
-					float avg = BKE_brush_curve_strength(br, len, 1.0f);  /* Falloff curve */
+					float avg = BKE_brush_curve_strength_clamp(br, len, 1.0f);  /* Falloff curve */
 
-					/* clamp to avoid precision overflow */
-					CLAMP(avg, 0.0f, 1.0f);
 					buffer[index] = 255 - (GLubyte)(255 * avg);
 
 				}




More information about the Bf-blender-cvs mailing list