[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29863] branches/soc-2010-jwilkins: this makes the crease factor and strength independent, also this adds blob , which is the inverse of creasing.
Tom Musgrove
LetterRip at gmail.com
Fri Jul 2 05:00:01 CEST 2010
Revision: 29863
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29863
Author: letterrip
Date: 2010-07-02 04:59:59 +0200 (Fri, 02 Jul 2010)
Log Message:
-----------
this makes the crease factor and strength independent, also this adds blob, which is the inverse of creasing. Has an interesting effect at low draw strengths
Modified Paths:
--------------
branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
Modified: branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-07-02 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py 2010-07-02 02:59:59 UTC (rev 29863)
@@ -630,7 +630,7 @@
- if brush.sculpt_tool in ('CREASE'):
+ if brush.sculpt_tool in ('CREASE', 'BLOB'):
col.separator()
row = col.row(align=True)
@@ -656,7 +656,7 @@
- if brush.sculpt_tool in ('DRAW', 'CREASE', 'LAYER', 'CLAY', 'WAX'):
+ if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'LAYER', 'CLAY', 'WAX'):
col.separator()
col.row().prop(brush, "direction", expand=True)
elif brush.sculpt_tool in ('FLATTEN'):
@@ -680,7 +680,7 @@
- if brush.sculpt_tool in ('DRAW', 'CREASE', 'INFLATE', 'LAYER', 'CLAY', 'WAX'):
+ if brush.sculpt_tool in ('DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY', 'WAX'):
col.separator()
col.prop(brush, "use_accumulate")
@@ -995,7 +995,7 @@
#col.active = brush.use_dynamic_subdiv
#col.prop(brush,"smoothness",slider=True)
- if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'WAX', 'PINCH', 'CREASE', 'FLATTEN'):
+ if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'WAX', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN'):
sub = col.column()
sub.label(text="Color:")
sub.prop(brush, "add_col", text="Add")
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-07-02 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-07-02 02:59:59 UTC (rev 29863)
@@ -86,10 +86,10 @@
/* BRUSH STROKE SETTINGS */
brush->spacing= 12; /* how far each brush dot should be spaced as a percentage of brush diameter */
brush->smooth_stroke_radius= 75;
- brush->smooth_stroke_factor= 0.9;
+ brush->smooth_stroke_factor= 0.9f;
brush->rate= 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */
brush->jitter= 0.0f;
- brush->clone.alpha= 0.5;
+ brush->clone.alpha= 0.5f;
//brush->stroke_tool = STROKE_TOOL_FREEHAND;
brush->flag |= BRUSH_SPACE;
Modified: branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c 2010-07-02 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c 2010-07-02 02:59:59 UTC (rev 29863)
@@ -10954,8 +10954,7 @@
brush->sub_col[2] = 1.00;
}
- if (brush->crease_pinch_factor == 0)
- brush->crease_pinch_factor = 2.0f/3.0f;
+ if (brush->crease_pinch_factor == 0) brush->crease_pinch_factor = 2.0f/3.0f;
}
}
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 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c 2010-07-02 02:59:59 UTC (rev 29863)
@@ -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:
@@ -1290,7 +1291,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);
@@ -1298,11 +1299,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++) {
@@ -2336,6 +2346,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;
@@ -2436,6 +2449,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:
@@ -2616,6 +2630,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:
@@ -2832,7 +2848,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;
Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-07-02 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h 2010-07-02 02:59:59 UTC (rev 29863)
@@ -140,13 +140,13 @@
#define BRUSH_RESTORE_MESH (1<<23)
#define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24)
-/* Brush stroke_style */
-//#define STROKE_TOOL_DOTS 1
-//#define STROKE_TOOL_SPACE 2
-//#define STROKE_TOOL_FREEHAND 3
-//#define STROKE_TOOL_SMOOTH 4
-//#define STROKE_TOOL_AIRBRUSH 5
-//#define STROKE_TOOL_ANCHORED 6
+/* Brush.stroke_style */
+#define STROKE_TOOL_SPACE 1
+#define STROKE_TOOL_AIRBRUSH 2
+#define STROKE_TOOL_ANCHORED 3
+#define STROKE_TOOL_DRAG 4
+//#define STROKE_TOOL_FREEHAND 5
+//#define STROKE_TOOL_SMOOTH 6
/* Brush.sculpt_tool */
#define SCULPT_TOOL_DRAW 1
@@ -165,6 +165,7 @@
#define SCULPT_TOOL_ROTATE 14
#define SCULPT_TOOL_WAX 15
#define SCULPT_TOOL_CREASE 16
+#define SCULPT_TOOL_BLOB 17
/* ImagePaintSettings.tool */
#define PAINT_TOOL_DRAW 0
Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c 2010-07-02 01:29:10 UTC (rev 29862)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c 2010-07-02 02:59:59 UTC (rev 29863)
@@ -114,6 +114,7 @@
{SCULPT_TOOL_DRAW, "DRAW", 0, "Draw", ""},
{SCULPT_TOOL_SMOOTH, "SMOOTH", 0, "Smooth", ""},
{SCULPT_TOOL_CREASE, "CREASE", 0, "Crease", ""},
+ {SCULPT_TOOL_BLOB, "BLOB", 0, "Blob", ""},
{SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", ""},
{SCULPT_TOOL_INFLATE, "INFLATE", 0, "Inflate", ""},
{SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", ""},
More information about the Bf-blender-cvs
mailing list