[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29376] branches/soc-2010-jwilkins: * Removed separate contrast brush.

Jason Wilkins Jason.A.Wilkins at gmail.com
Wed Jun 9 23:27:44 CEST 2010


Revision: 29376
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29376
Author:   jwilkins
Date:     2010-06-09 23:27:44 +0200 (Wed, 09 Jun 2010)

Log Message:
-----------
* Removed separate contrast brush.  The same effect can be gotten by inverting the flatten brush.
* correct rotation of textures; was CW when it should have been CCW
* corrected problem where when image texture was replaced with procedural and the tile overlay was not generated correctly
* there are now two brushes yank and grab that are currently identical.  yank will keep old behavior, grab will be changed

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.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-06-09 20:07:53 UTC (rev 29375)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-09 21:27:44 UTC (rev 29376)
@@ -569,7 +569,7 @@
                 #row.prop(brush, "jitter", slider=True)
                 #row.prop(brush, "use_jitter_pressure", toggle=True, text="")
 
-                if brush.sculpt_tool in ('CLAY', 'FLATTEN', 'FILL', 'SCRAPE', 'CONTRAST'):
+                if brush.sculpt_tool in ('CLAY', 'FLATTEN', 'FILL', 'SCRAPE'):
                     row = col.row(align=True)
                     row.prop(brush, "plane_offset", slider=True)
                     row.prop(brush, "use_offset_pressure", text="")
@@ -768,7 +768,7 @@
                 if brush.use_anchor:
                     layout.prop(brush, "edge_to_edge", "Edge To Edge")
             layout.prop(brush, "use_rake")
-            if brush.sculpt_tool in ('DRAW', 'LAYER', 'FLATTEN', 'CLAY', 'FILL', 'SCRAPE', 'CONTRAST'):
+            if brush.sculpt_tool in ('DRAW', 'LAYER', 'FLATTEN', 'CLAY', 'FILL', 'SCRAPE'):
                 layout.prop(brush, "use_original_normal")
                 if brush.use_original_normal:
                     col = layout.column()

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c	2010-06-09 20:07:53 UTC (rev 29375)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c	2010-06-09 21:27:44 UTC (rev 29376)
@@ -211,7 +211,7 @@
 	float xlim, ylim;
 
 	// XXX there has to be a better way to guess if a texture is procedural
-	int procedural = brush->mtex.tex && !brush->mtex.tex->ima;
+	int procedural = brush->mtex.tex && brush->mtex.tex->type != TEX_IMAGE;
 
 	if (brush->overlay_texture) glDeleteTextures(1, &brush->overlay_texture);
 
@@ -234,7 +234,7 @@
 			if (procedural) {
 				// largely duplicated from tex_strength
 
-				const float rotation = brush->mtex.rot;
+				const float rotation = -brush->mtex.rot;
 				float diameter = brush->size;
 
 				x = (float)i/width;
@@ -645,7 +645,7 @@
 
 				glScalef(inv_scale_x, inv_scale_y, 0);
 
-				glRotatef(brush->mtex.rot * 180.0f/M_PI, 0, 0, 1);
+				glRotatef(-brush->mtex.rot * 180.0f/M_PI, 0, 0, 1);
 
 				glScalef(viewport[2] / diameter, viewport[3] / diameter, 0);
 

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-09 20:07:53 UTC (rev 29375)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-09 21:27:44 UTC (rev 29376)
@@ -752,12 +752,9 @@
 		case SCULPT_TOOL_LAYER:
 		case SCULPT_TOOL_FILL:
 		case SCULPT_TOOL_SCRAPE:
+		case SCULPT_TOOL_FLATTEN:
 			return alpha * dir * flip * pressure * overlap;
 
-		case SCULPT_TOOL_FLATTEN:
-		case SCULPT_TOOL_CONTRAST:
-			return alpha * pressure * overlap;
-
 		case SCULPT_TOOL_SMOOTH:
 			return alpha * 4 * pressure * overlap;
 
@@ -794,10 +791,11 @@
 {
 	TexResult texres;
 	float co[3] = { u, v, 0 };
+
 	int hasrgb;
 	
 	memset(&texres, 0, sizeof(TexResult));
-	hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres);
+	hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 1, &texres);
 
 	if (hasrgb & TEX_RGB) texres.tin = (0.35*texres.tr + 0.45*texres.tg + 0.2*texres.tb);
 
@@ -859,7 +857,7 @@
 			  &jnk, &jnk, &jnk, &jnk);
 	}
 	else if(ss->texcache) {
-		float rotation = tex->rot;
+		float rotation = -tex->rot;
 		float x, y, point_2d[3];
 		float diameter;
 
@@ -1869,66 +1867,6 @@
 	}
 }
 
-static void do_contrast_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
-{
-	Brush *brush = paint_brush(&sd->paint);
-
-	float bstrength = ss->cache->bstrength;
-	const float radius = ss->cache->radius;
-
-	float an[3];
-	float fc[3];
-	float offset = get_offset(sd, ss);
-
-	float displace;
-
-	int n;
-
-	float temp[3];
-
-	calc_area_normal_and_flatten_center(sd, ss, nodes, totnode, an, fc);
-
-	displace = radius*offset;
-
-	mul_v3_v3v3(temp, an, ss->cache->scale);
-	mul_v3_fl(temp, displace);
-	add_v3_v3(fc, temp);
-
-	for(n = 0; n < totnode; n++) {
-		PBVHVertexIter  vd;
-		SculptBrushTest test;
-
-		sculpt_undo_push_node(ss, nodes[n]);
-
-		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)) {
-				float intr[3];
-				float val[3];
-
-				const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist);
-
-				point_plane_project(intr, vd.co, an, fc);
-				sub_v3_v3v3(val, intr, vd.co);
-				mul_v3_fl(val, -fade);
-				symmetry_feather(sd, ss, vd.co, val);
-				add_v3_v3(val, vd.co);
-
-				sculpt_clip(sd, ss, vd.co, val);
-
-				if(vd.mvert) {
-					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
-					if(brush->flag & BRUSH_SUBDIV) vd.mvert->flag = 1; 
-				}
-			}
-		}
-		BLI_pbvh_vertex_iter_end;
-
-		BLI_pbvh_node_mark_update(nodes[n]);
-	}
-}
-
 static void do_fill_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
 {
 	Brush *brush = paint_brush(&sd->paint);
@@ -2118,9 +2056,6 @@
 		case SCULPT_TOOL_SCRAPE:
 			do_scrape_brush(sd, ss, nodes, totnode);
 			break;
-		case SCULPT_TOOL_CONTRAST:
-			do_contrast_brush(sd, ss, nodes, totnode);
-			break;
 		}
 	
 		/* copy the modified vertices from mesh to the active key */
@@ -2294,15 +2229,13 @@
 	case SCULPT_TOOL_LAYER:
 		return "Layer Brush"; break;
 	case SCULPT_TOOL_FLATTEN:
-                return "Flatten Brush"; break;
-        case SCULPT_TOOL_CLAY:
-                return "Clay Brush"; break;
-        case SCULPT_TOOL_FILL:
-                return "Fill Brush"; break;
-        case SCULPT_TOOL_SCRAPE:
-                return "Scrape Brush"; break;
-        case SCULPT_TOOL_CONTRAST:
-                return "Constrast Brush"; break;
+		return "Flatten Brush"; break;
+	case SCULPT_TOOL_CLAY:
+		return "Clay Brush"; break;
+	case SCULPT_TOOL_FILL:
+		return "Fill Brush"; break;
+	case SCULPT_TOOL_SCRAPE:
+		return "Scrape Brush"; break;
 	default:
 		return "Sculpting"; break;
 	}
@@ -2481,10 +2414,6 @@
 			cache->initial_radius = brush->unprojected_radius;
 		}
 
-	if (brush->sculpt_tool == SCULPT_TOOL_GRAB) {
-		cache->initial_radius *= 3;
-	}
-
 	if(brush->flag & BRUSH_SIZE_PRESSURE && !ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_YANK)) {
 		cache->pixel_radius *= cache->pressure;
 		cache->radius = cache->initial_radius * cache->pressure;

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-09 20:07:53 UTC (rev 29375)
+++ branches/soc-2010-jwilkins/source/blender/makesdna/DNA_brush_types.h	2010-06-09 21:27:44 UTC (rev 29376)
@@ -71,7 +71,7 @@
 	
 	int sculpt_direction;		/* the direction of movement for sculpt vertices */
 
-	float plane_offset;		/* offset for plane brushes (clay, flatten, fill, scrape, contrast) */
+	float plane_offset;		/* offset for plane brushes (clay, flatten, fill, scrape) */
 
 	char sculpt_tool;		/* active sculpt tool */
 	char vertexpaint_tool;		/* active vertex/weight paint tool/blend mode */
@@ -150,8 +150,7 @@
 #define SCULPT_TOOL_CLAY      8
 #define SCULPT_TOOL_FILL      9
 #define SCULPT_TOOL_SCRAPE   10
-#define SCULPT_TOOL_CONTRAST 11
-#define SCULPT_TOOL_YANK     12
+#define SCULPT_TOOL_YANK     11
 
 /* 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-06-09 20:07:53 UTC (rev 29375)
+++ branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c	2010-06-09 21:27:44 UTC (rev 29376)
@@ -109,7 +109,6 @@
 		{SCULPT_TOOL_CLAY, "CLAY", 0, "Clay", ""},
 		{SCULPT_TOOL_FILL, "FILL", 0, "Fill", ""},
 		{SCULPT_TOOL_SCRAPE, "SCRAPE", 0, "Scrape", ""},
-		{SCULPT_TOOL_CONTRAST, "CONTRAST", 0, "Contrast", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
 	//static EnumPropertyItem brush_stroke_tool_items[] = {





More information about the Bf-blender-cvs mailing list