[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29287] branches/soc-2010-jwilkins: this adds a strength multiplier, which gives the end user greater control over the maximum strength.

Tom Musgrove LetterRip at gmail.com
Mon Jun 7 01:17:33 CEST 2010


Revision: 29287
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29287
Author:   letterrip
Date:     2010-06-07 01:17:32 +0200 (Mon, 07 Jun 2010)

Log Message:
-----------
this adds a strength multiplier, which gives the end user greater control over the maximum strength.  This might be removed later, but gives some room for end users to experiment with brush strengths to find sane defaults for the max brush strength for various brush types.

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    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-06-06 22:19:28 UTC (rev 29286)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-06 23:17:32 UTC (rev 29287)
@@ -567,6 +567,7 @@
                 row = col.row(align=True)
                 row.prop(brush, "strength", slider=True)
                 row.prop(brush, "use_strength_pressure", text="")
+                col.prop(brush, "strength_multiplier", slider=True)
 
                 # XXX - TODO
                 #row = col.row(align=True)

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-06 22:19:28 UTC (rev 29286)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-06 23:17:32 UTC (rev 29287)
@@ -734,10 +734,12 @@
 
 	/* Primary strength input; square it to make lower values more sensitive */
 	float alpha = brush->alpha * brush->alpha;
-
+	int strength_multiplier = brush->strength_multiplier;
 	float dir      = brush->flag & BRUSH_DIR_IN ? -1 : 1;
 	float pressure = brush->flag & BRUSH_ALPHA_PRESSURE ? cache->pressure : 1;
 	float flip     = cache->flip ? -1 : 1;
+
+	alpha *= (float)strength_multiplier;
 	//float overlap  = (brush->flag & BRUSH_SPACE && !(brush->flag & BRUSH_ANCHORED)) && (brush->spacing < 100.0f) ? 1 - circle_overlap_percent(brush->spacing/50.0f) : 1; // spacing is integer percentage of radius, divide by 50 to get normalized diameter
 	float overlap  = (brush->flag & BRUSH_SPACE_ATTEN && brush->flag & BRUSH_SPACE && !(brush->flag & BRUSH_ANCHORED)) && (brush->spacing < 100) ? (float)brush->spacing/100.0f : 1; // spacing is integer percentage of radius, divide by 50 to get normalized diameter
 

Modified: branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-06-06 22:19:28 UTC (rev 29286)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-06-06 23:17:32 UTC (rev 29287)
@@ -61,6 +61,7 @@
 	float smoothness;			/* dynamic subdivission smoothness*/
 	float jitter;				/* jitter the position of the brush */
 	int spacing;				/* spacing of paint operations */
+	int strength_multiplier;		/* increases the strength by a multiplier */
 	int smooth_stroke_radius;		/* turning radius (in pixels) for smooth stroke */
 	float smooth_stroke_factor;		/* higher values limit fast changes in the stroke direction */
 	float rate;					/* paint operations / second (airbrush) */
@@ -79,8 +80,6 @@
 	char stroke_tool;
 
 	float unprojected_radius;
-
-	int pad2;
 } Brush;
 
 /* Brush.flag */

Modified: branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-06-06 22:19:28 UTC (rev 29286)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-06-06 23:17:32 UTC (rev 29287)
@@ -256,6 +256,12 @@
 	RNA_def_property_ui_text(prop, "Strength", "The amount of pressure on the brush");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+	prop= RNA_def_property(srna, "strength_multiplier", PROP_INT, PROP_FACTOR);
+	RNA_def_property_int_sdna(prop, NULL, "strength_multiplier");
+	RNA_def_property_range(prop, 1, 10);
+	RNA_def_property_ui_text(prop, "Strength Multiplier", "A multiplier factor for the strength setting");
+	RNA_def_property_update(prop, 0, "rna_Brush_update");
+
 	prop= RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "plane_offset");
 	RNA_def_property_range(prop, -1.0f, 1.0f);





More information about the Bf-blender-cvs mailing list