[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35189] trunk/blender: Fix #26158: The layer hight of the layer tool cannot longer be controled by the strength of the brush , as it was in 2.49

Sergey Sharybin g.ulairi at gmail.com
Fri Feb 25 17:54:10 CET 2011


Revision: 35189
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35189
Author:   nazgul
Date:     2011-02-25 16:54:09 +0000 (Fri, 25 Feb 2011)
Log Message:
-----------
Fix #26158: The layer hight of the layer tool cannot longer be controled by the strength of the brush, as it was in 2.49

Layer height used to be controlled with brush radius, quite confusing decision.
Added new property for brushes - height for adjusting affectable brush height
(it could be not only layer height in the future).

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/makesdna/DNA_brush_types.h
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2011-02-25 16:32:03 UTC (rev 35188)
+++ trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2011-02-25 16:54:09 UTC (rev 35189)
@@ -578,6 +578,10 @@
                 row.active = brush.use_plane_trim
                 row.prop(brush, "plane_trim", slider=True, text="Distance")
 
+            if brush.sculpt_tool == 'LAYER':
+                row = col.row()
+                row.prop(brush, "height", slider=True, text="Height")
+
             col.separator()
 
             row = col.row()

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-25 16:32:03 UTC (rev 35188)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2011-02-25 16:54:09 UTC (rev 35189)
@@ -11478,6 +11478,7 @@
 
 	{
 		bScreen *sc;
+		Brush *brush;
 		
 		/* redraws flag in SpaceTime has been moved to Screen level */
 		for (sc = main->screen.first; sc; sc= sc->id.next) {
@@ -11487,6 +11488,11 @@
 				sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
 			}
 		}
+
+		for (brush= main->brush.first; brush; brush= brush->id.next) {
+			if(brush->height == 0)
+				brush->height= 0.4;
+		}
 	}
 	
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-02-25 16:32:03 UTC (rev 35188)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-02-25 16:54:09 UTC (rev 35189)
@@ -1519,7 +1519,7 @@
 	Brush *brush = paint_brush(&sd->paint);
 	float bstrength= ss->cache->bstrength;
 	float area_normal[3], offset[3];
-	float lim= ss->cache->radius / 4;
+	float lim= brush->height;
 	int n;
 
 	if(bstrength < 0)
@@ -1552,15 +1552,15 @@
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
-				const float fade = bstrength*ss->cache->radius*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno);
+			if(sculpt_brush_test(&test, origco[vd.i])) {
+				const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, area_normal, vd.no, vd.fno);
 				float *disp= &layer_disp[vd.i];
 				float val[3];
 
 				*disp+= fade;
 
 				/* Don't let the displacement go past the limit */
-				if((lim < 0 && *disp < lim) || (lim > 0 && *disp > lim))
+				if((lim < 0 && *disp < lim) || (lim >= 0 && *disp > lim))
 					*disp = lim;
 
 				mul_v3_v3fl(val, offset, *disp);

Modified: trunk/blender/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_brush_types.h	2011-02-25 16:32:03 UTC (rev 35188)
+++ trunk/blender/source/blender/makesdna/DNA_brush_types.h	2011-02-25 16:54:09 UTC (rev 35189)
@@ -85,13 +85,14 @@
 	char sculpt_tool;		/* active sculpt tool */
 	char vertexpaint_tool;		/* active vertex/weight paint tool/blend mode */
 	char imagepaint_tool;		/* active image paint tool */
-	char pad3;
+	char pad3[5];
 
 	float autosmooth_factor;
 
 	float crease_pinch_factor;
 
 	float plane_trim;
+	float height;			/* affectable height of brush (layer height for layer tool, i.e.) */
 
 	float texture_sample_bias;
 	int   texture_overlay_alpha;

Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-02-25 16:32:03 UTC (rev 35188)
+++ trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-02-25 16:54:09 UTC (rev 35189)
@@ -493,6 +493,13 @@
 	RNA_def_property_ui_text(prop, "Plane Trim", "If a vertex is further from offset plane than this then it is not affected");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
+	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+	RNA_def_property_float_sdna(prop, NULL, "height");
+	RNA_def_property_float_default(prop, 0.5f);
+	RNA_def_property_range(prop, 0, 1.0f);
+	RNA_def_property_ui_text(prop, "Brush Height", "Affectable height of brush (layer height for layer tool, i.e.)");
+	RNA_def_property_update(prop, 0, "rna_Brush_update");
+
 	prop= RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "texture_sample_bias");
 	RNA_def_property_float_default(prop, 0);




More information about the Bf-blender-cvs mailing list