[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29879] branches/soc-2010-jwilkins/source/ blender/editors/sculpt_paint/sculpt.c: * somehow I accidentally removed the new Blob brush from the last commits

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Jul 2 20:25:42 CEST 2010


Revision: 29879
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29879
Author:   jwilkins
Date:     2010-07-02 20:25:40 +0200 (Fri, 02 Jul 2010)

Log Message:
-----------
* somehow I accidentally removed the new Blob brush from the last commits

Modified Paths:
--------------
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-02 18:18:11 UTC (rev 29878)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-07-02 18:25:40 UTC (rev 29879)
@@ -613,6 +613,7 @@
 			return alpha * flip * pressure * overlap;
 
 		case SCULPT_TOOL_CREASE:
+		case SCULPT_TOOL_BLOB:
 			return alpha * flip * pressure * overlap;
 
 		case SCULPT_TOOL_INFLATE:
@@ -1289,7 +1290,7 @@
 	Brush *brush = paint_brush(&sd->paint);
 	float offset[3], area_normal[3];
 	float bstrength= ss->cache->bstrength;
-	float flippedbstrength;
+	float flippedbstrength, crease_correction;
 	int n;
 	
 	calc_area_normal(sd, ss, area_normal, nodes, totnode);
@@ -1297,11 +1298,20 @@
 	/* offset with as much as possible factored in already */
 	mul_v3_v3fl(offset, area_normal, ss->cache->radius);
 	mul_v3_v3(offset, ss->cache->scale);
-	mul_v3_fl(offset, bstrength*(1-brush->crease_pinch_factor));
+	mul_v3_fl(offset, bstrength);
+	
+	/* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
+	
+	if(brush->alpha > 0.0f)
+		crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor/(brush->alpha*brush->alpha);
+	else
+		crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor;
 
-	/* we always want crease to pinch even when draw is negative also crease we want stronger than the draw effect*/
-	flippedbstrength = (bstrength < 0) ? -brush->crease_pinch_factor*bstrength : brush->crease_pinch_factor*bstrength;
+	/* we always want crease to pinch or blob to relax even when draw is negative */
+	flippedbstrength = (bstrength < 0) ? -crease_correction*bstrength : crease_correction*bstrength;
 
+	if(brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f;
+
 	/* threaded loop over nodes */
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
 	for(n=0; n<totnode; n++) {
@@ -2335,6 +2345,9 @@
 		case SCULPT_TOOL_CREASE:
 			do_crease_brush(sd, ss, nodes, totnode);
 			break;
+		case SCULPT_TOOL_BLOB:
+			do_crease_brush(sd, ss, nodes, totnode);
+			break;
 		case SCULPT_TOOL_PINCH:
 			do_pinch_brush(sd, ss, nodes, totnode);
 			break;
@@ -2435,6 +2448,7 @@
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_CLAY:
 		case SCULPT_TOOL_CREASE:
+		case SCULPT_TOOL_BLOB:
 		case SCULPT_TOOL_FILL:
 		case SCULPT_TOOL_FLATTEN:
 		case SCULPT_TOOL_INFLATE:
@@ -2615,6 +2629,8 @@
 		return "Smooth Brush"; break;
 	case SCULPT_TOOL_CREASE:
 		return "Crease Brush"; break;
+	case SCULPT_TOOL_BLOB:
+		return "Blob Brush"; break;
 	case SCULPT_TOOL_PINCH:
 		return "Pinch Brush"; break;
 	case SCULPT_TOOL_INFLATE:
@@ -2831,7 +2847,7 @@
 		cache->original = 1;
 	}
 
-	if(ELEM6(brush->sculpt_tool, SCULPT_TOOL_DRAW,  SCULPT_TOOL_CREASE, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_WAX))
+	if(ELEM7(brush->sculpt_tool, SCULPT_TOOL_DRAW,  SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_WAX))
 		if(!(brush->flag & BRUSH_ACCUMULATE))
 			cache->original = 1;
 





More information about the Bf-blender-cvs mailing list