[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29811] branches/soc-2010-jwilkins: * For some brushes instead of add/ subtract the two modes of the brush are named more clearly

Jason Wilkins Jason.A.Wilkins at gmail.com
Wed Jun 30 05:53:57 CEST 2010


Revision: 29811
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29811
Author:   jwilkins
Date:     2010-06-30 05:53:41 +0200 (Wed, 30 Jun 2010)

Log Message:
-----------
* For some brushes instead of add/subtract the two modes of the brush are named more clearly
* Improvements to the spacing and arrangement of the sculpt ui
* alignment error in UserDef.h (I'm NOT stupid!)
* Adjusted the strength of several brushes when adaptive strength is used, some tools were getting too much attenuation.
* Adjusted the strength of several brushes when used in their inverted modes, some are too strong inverted.

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/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-30 03:19:28 UTC (rev 29810)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-06-30 03:53:41 UTC (rev 29811)
@@ -544,16 +544,21 @@
         # Sculpt Mode #
 
         elif context.sculpt_object and brush:
+            edit = context.user_preferences.edit
+
             col = layout.column()
+
+
+
             col.separator()
 
             row = col.row(align=True)
+
             if brush.lock_brush_size:
                 row.prop(brush, "lock_brush_size", toggle=True, text="", icon='LOCKED')
             else:
                 row.prop(brush, "lock_brush_size", toggle=True, text="", icon='UNLOCKED')
 
-            edit = context.user_preferences.edit
             if brush.lock_brush_size:
                 row.prop(brush, "unprojected_radius", text="Radius", slider=True)
             else:
@@ -562,53 +567,110 @@
                 else:
                     row.prop(brush, "size", text="Radius", slider=True)
 
-            if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK', 'THUMB'):
-                row.prop(brush, "use_size_pressure", toggle=True, text="Size")
+            row.prop(brush, "use_size_pressure", toggle=True, text="")
 
-            if brush.sculpt_tool in ('SNAKE_HOOK', 'THUMB'):
-                row.prop(brush, "use_strength_pressure", toggle=True, text="Strength")
 
-            if brush.sculpt_tool not in ('GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'):
-                row.prop(brush, "use_size_pressure", toggle=True, text="")
 
+            if brush.sculpt_tool not in ('THUMB', 'SNAKE_HOOK', 'GRAB', 'ROTATE'):
+                col.separator()
+
                 #row = col.row(align=True)
                 #row.prop(edit, "use_unified_radius_and_strength")
+
+
+                row = col.row(align=True)
+
+                if brush.use_space:
+                    if brush.use_space_atten:
+                        row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
+                    else:
+                        row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
+
                 if edit.use_unified_radius_and_strength:
-                    row = col.row(align=True)
                     row.prop(edit, "sculpt_paint_strength", slider=True)
-
                 else:
-                    row = col.row(align=True)
                     row.prop(brush, "strength", slider=True)
+
                 row.prop(brush, "use_strength_pressure", text="")
-                row = col.row(align=True)
+
+
+                row = col.row()
                 row.prop(brush, "strength_multiplier", slider=True)
 
-                # XXX - TODO
-                #row = col.row(align=True)
-                #row.prop(brush, "jitter", slider=True)
-                #row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+            elif brush.sculpt_tool in ('THUMB', 'SNAKE_HOOK'):
+                col.separator()
 
+                row = col.row()
+                row.prop(brush, "use_strength_pressure", toggle=True, text="Strength Pressure")
+
+
+
+            # XXX - TODO
+            #col.separator()
+            #row = col.row(align=True)
+            #row.prop(brush, "jitter", slider=True)
+            #row.prop(brush, "use_jitter_pressure", toggle=True, text="")
+
+
             if brush.sculpt_tool not in ('SMOOTH'):
+                col.separator()
+
                 row = col.row(align=True)
                 row.prop(brush, "autosmooth_factor", slider=True)
 
+
+
             if brush.sculpt_tool in ('GRAB', 'SNAKE_HOOK'):
+                col.separator()
+
                 row = col.row(align=True)
                 row.prop(brush, "normal_weight", slider=True)
 
+
+
             if brush.sculpt_tool in ('CLAY', 'WAX', 'FLATTEN', 'FILL', 'SCRAPE'):
+                col.separator()
+
                 row = col.row(align=True)
                 row.prop(brush, "plane_offset", slider=True)
                 row.prop(brush, "use_offset_pressure", text="")
 
-            if brush.sculpt_tool in ('DRAW', 'PINCH', 'CREASE', 'INFLATE', 'LAYER', 'FILL', 'SCRAPE', 'CLAY', 'WAX', 'GRAB'):
+
+
+            if brush.sculpt_tool in ('DRAW', 'CREASE', 'LAYER', 'CLAY', 'WAX'):
+                col.separator()
                 col.row().prop(brush, "direction", expand=True)
+            elif brush.sculpt_tool in ('FLATTEN'):
+                col.separator()
+                col.row().prop(brush, "flatten_contrast", expand=True)
+            elif brush.sculpt_tool in ('FILL'):
+                col.separator()
+                col.row().prop(brush, "fill_deepen", expand=True)
+            elif brush.sculpt_tool in ('SCRAPE'):
+                col.separator()
+                col.row().prop(brush, "scrape_peaks", expand=True)
+            elif brush.sculpt_tool in ('GRAB'):
+                col.separator()
+                col.row().prop(brush, "grab_push", expand=True)
+            elif brush.sculpt_tool in ('INFLATE'):
+                col.separator()
+                col.row().prop(brush, "inflate_deflate", expand=True)
+            elif brush.sculpt_tool in ('PINCH'):
+                col.separator()
+                col.row().prop(brush, "pinch_magnify", expand=True)
 
-            if brush.sculpt_tool in ('DRAW', 'INFLATE', 'LAYER', 'CLAY', 'WAX'):
+
+
+            if brush.sculpt_tool in ('DRAW', 'CREASE', 'INFLATE', 'LAYER', 'CLAY', 'WAX'):
+                col.separator()
+
                 col.prop(brush, "use_accumulate")
 
+
+
             if brush.sculpt_tool == 'LAYER':
+                col.separator()
+
                 ob = context.sculpt_object
                 do_persistent = True
 
@@ -620,10 +682,6 @@
                 if do_persistent:
                     col.prop(brush, "use_persistent")
                     col.operator("sculpt.set_persistent_base")
-                        
-            if brush.use_dynamic_subdiv ==True:
-                col.prop(brush,"detail",slider=True)
-                col.prop(brush,"smoothness",slider=True)
 
         # Texture Paint Mode #
 
@@ -861,6 +919,11 @@
 
         col = layout.column()
         col.prop(brush,"use_dynamic_subdiv")
+
+        if brush.use_dynamic_subdiv ==True:
+            col.prop(brush,"detail",slider=True)
+            col.prop(brush,"smoothness",slider=True)
+
         col.prop(sculpt, "show_brush")
         if sculpt.show_brush:
             col.prop(sculpt, "show_brush_on_surface")

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-30 03:19:28 UTC (rev 29810)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c	2010-06-30 03:53:41 UTC (rev 29811)
@@ -611,40 +611,55 @@
 	switch(brush->sculpt_tool){
 		case SCULPT_TOOL_CLAY:
 		case SCULPT_TOOL_DRAW:
-		case SCULPT_TOOL_INFLATE:
 		case SCULPT_TOOL_WAX:
 		case SCULPT_TOOL_CREASE:
 		case SCULPT_TOOL_LAYER:
 			return alpha * flip * pressure * overlap;
 
+		case SCULPT_TOOL_INFLATE:
+			if (dir*invert*pen_flip > 0) {
+				return 0.250f * alpha * flip * pressure * overlap;
+			}
+			else {
+				return 0.125f * alpha * flip * pressure * overlap;
+			}
+
 		case SCULPT_TOOL_FILL:
 		case SCULPT_TOOL_SCRAPE:
 		case SCULPT_TOOL_FLATTEN:
-			if (dir*invert*pen_flip > 0)
+			if (dir*invert*pen_flip > 0) {
+				overlap = (1+overlap) / 2;
 				return alpha * flip * pressure * overlap;
-			else
+			}
+			else {
 				/* reduce strength for DEEPEN, PEAKS, and CONTRAST */
-				return alpha * flip * pressure * overlap; 
+				return 0.5f * alpha * flip * pressure * overlap; 
+			}
 
 		case SCULPT_TOOL_SMOOTH:
 			return alpha * pressure * overlap;
 
 		case SCULPT_TOOL_PINCH:
-			return alpha * flip * pressure * overlap;
+			if (dir*invert*pen_flip > 0) {
+				return alpha * flip * pressure * overlap;
+			}
+			else {
+				return 0.25f * alpha * flip * pressure * overlap;
+			}
 
-		case SCULPT_TOOL_GRAB:
-			return flip > 0 ? 1.0f : -1.0f;
-
 		case SCULPT_TOOL_NUDGE:
+			overlap = (1+overlap) / 2;
 			return alpha * pressure * overlap;
 
 		case SCULPT_TOOL_THUMB:
-			return pressure;
+			return pressure / 4;
 
 		case SCULPT_TOOL_SNAKE_HOOK:
 			return pressure;
 
+		case SCULPT_TOOL_GRAB:
 		case SCULPT_TOOL_ROTATE:
+			/* rotate ignores strength */
 			return 1.0f;
 
 		default:
@@ -1158,17 +1173,20 @@
 				if(sculpt_brush_test(&test, co)) {
 					float fade = tex_strength(ss, brush, co, test.dist)*bstrength;
 					float *avg, val[3];
+					float n;
 
 					avg = tmpgrid[x + y*gridsize];
 
-					mul_v3_fl(avg, 1/16.0f);
+					n = 1/16.0f;
 
 					if(x == 0 || x == gridsize - 1)
-						mul_v3_fl(avg, 2.0f);
+						n *= 2;
 
 					if(y == 0 || y == gridsize - 1)
-						mul_v3_fl(avg, 2.0f);
+						n *= 2;
 
+					mul_v3_fl(avg, n);
+
 					sub_v3_v3v3(val, avg, co);
 					mul_v3_fl(val, fade);
 					add_v3_v3(val, co);
@@ -1215,7 +1233,7 @@
 	float offset[3], area_normal[3];
 	float bstrength= ss->cache->bstrength;
 	int n;
-	float p[3];
+	//float p[3];
 
 	calc_area_normal(sd, ss, area_normal, nodes, totnode);
 	
@@ -1270,36 +1288,34 @@
 	mul_v3_v3fl(offset, area_normal, ss->cache->radius);
 	mul_v3_v3(offset, ss->cache->scale);
 	mul_v3_fl(offset, bstrength);
+
 	/* we always want crease to pinch even when draw is negative also crease we want stronger than the draw effect*/
-	if (bstrength < 0)
-		flippedbstrength = -2.0*bstrength;
-	else
-		flippedbstrength =2.0*bstrength;
+	flippedbstrength = (bstrength < 0) ? -(2.0f/3.0f)*bstrength : (2.0f/3.0f)*bstrength;
 
 	/* threaded loop over nodes */
 #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
 	for(n=0; n<totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
-		
+
 		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)) {
 				/* offset vertex */
 				float fade = tex_strength(ss, brush, vd.co, test.dist);
 				float val[3];
-				
+
 				/* first we pinch */
 				sub_v3_v3v3(val, test.location, vd.co);
 				mul_v3_fl(val, fade*flippedbstrength);
 				symmetry_feather(sd, ss, vd.co, val);
 				add_v3_v3(val, vd.co);
-				
+
 				sculpt_clip(sd, ss, vd.co, val);
-				
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list