[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30292] branches/soc-2010-jwilkins: * removed strength multiplier.

Jason Wilkins Jason.A.Wilkins at gmail.com
Wed Jul 14 08:27:32 CEST 2010


Revision: 30292
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30292
Author:   jwilkins
Date:     2010-07-14 08:27:31 +0200 (Wed, 14 Jul 2010)

Log Message:
-----------
* removed strength multiplier.  the limit on strength is a soft limit, the hard limit is 10
* moved variables used to draw brush from Brush to Sculpt, there only needs to be one copy of these at a time, not one set per brush
* bumped up sub file version number so any files saved can be differentiated from older files.  I expect this to be a vert short lived thing as the file version should jump with the upcoming 253 release
* removed 'duplicate brush' button and made the + button duplicate the current brush (or create a new brush if all are deleted)
* changed some defaults for new brushes
* do_versions and init_userdef_do_versions do some sanity checking and set defaults values new in this branch

Modified Paths:
--------------
    branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py
    branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_blender.h
    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/interface/resources.c
    branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
    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/makesdna/DNA_scene_types.h
    branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_brush.c
    branches/soc-2010-jwilkins/source/blender/makesrna/intern/rna_sculpt_paint.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-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/release/scripts/ui/space_view3d_toolbar.py	2010-07-14 06:27:31 UTC (rev 30292)
@@ -525,8 +525,6 @@
 
                 row.template_list(settings, "brushes", settings, "active_brush_index", rows=2, maxrows=defaultbrushes)
 
-            col.operator("brush.copy", text="Duplicate Brush")
-
         # Particle Mode #
 
         # XXX This needs a check if psys is editable.
@@ -604,8 +602,6 @@
                 row.prop(brush, "use_strength_pressure", text="")
 
 
-                row = col.row()
-                row.prop(brush, "strength_multiplier")
 
             if brush.sculpt_tool not in ('SMOOTH'):
                 col.separator()
@@ -895,13 +891,9 @@
         if context.sculpt_object:
             col.prop(brush, "sculpt_tool", expand=False, text="")
         elif context.texture_paint_object:
-            col.prop(brush, "imagepaint_tool", expand=True)
-            #col.prop_enum(settings, "tool", 'DRAW')
-            #col.prop_enum(settings, "tool", 'SOFTEN')
-            #col.prop_enum(settings, "tool", 'CLONE')
-            #col.prop_enum(settings, "tool", 'SMEAR')
+            col.prop(brush, "imagepaint_tool", expand=False, text="")
         elif context.vertex_paint_object or context.weight_paint_object:
-            col.prop(brush, "vertexpaint_tool", expand=True)
+            col.prop(brush, "vertexpaint_tool", expand=False, text="")
 
 
 class VIEW3D_PT_tools_brush_stroke(PaintPanel):

Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_blender.h	2010-07-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_blender.h	2010-07-14 06:27:31 UTC (rev 30292)
@@ -43,9 +43,9 @@
 struct ReportList;
 struct Scene;
 struct Main;
-	
+
 #define BLENDER_VERSION			252
-#define BLENDER_SUBVERSION		5
+#define BLENDER_SUBVERSION		6 // XXX: this shouldn't be merged with trunk, this is so Sculpt branch can detect old files
 
 #define BLENDER_MINVERSION		250
 #define BLENDER_MINSUBVERSION	0

Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-07-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c	2010-07-14 06:27:31 UTC (rev 30292)
@@ -71,57 +71,56 @@
 
 	/* BRUSH SCULPT TOOL SETTINGS */
 	brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */
-	brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */
-	brush->size= 50; /* radius of the brush in pixels */
+	brush->size= 35; /* radius of the brush in pixels */
 	brush->alpha= 0.5f; /* brush strength/intensity probably variable should be renamed? */
-	
+	brush->autosmooth_factor= 0.0f;
+	brush->crease_pinch_factor= 2.0f/3.0f;
+	brush->sculpt_plane = SCULPT_DISP_DIR_VIEW;
+	brush->plane_offset= 0.0f; /* how far above or below the plane that is found by averaging the faces */
+	brush->plane_trim= 0.5f;
+	brush->clone.alpha= 0.5f;
+	brush->normal_weight= 0.0f;
+
 	/* BRUSH PAINT TOOL SETTINGS */
 	brush->rgb[0]= 1.0f; /* default rgb color of the brush when painting - white */
 	brush->rgb[1]= 1.0f;
 	brush->rgb[2]= 1.0f;
-	
-	
+
 	/* BRUSH STROKE SETTINGS */
-	brush->spacing= 12; /* how far each brush dot should be spaced as a percentage of brush diameter */
+	brush->flag |= (BRUSH_SPACE|BRUSH_SPACE_ATTEN);
+	brush->spacing= 10; /* how far each brush dot should be spaced as a percentage of brush diameter */
+
 	brush->smooth_stroke_radius= 75;
 	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.5f;
 
-	//brush->stroke_tool = STROKE_TOOL_FREEHAND;
-	brush->flag |= BRUSH_SPACE;
-	
 	/* BRUSH TEXTURE SETTINGS */
-	brush->texture_sample_bias = 0; /* value to added to texture samples */
+	default_mtex(&brush->mtex);
 
-	brush->autosmooth_factor = 0;
+	brush->texture_sample_bias= 0; /* value to added to texture samples */
 
-	brush->crease_pinch_factor = 2.0f/3.0f;
+	/* brush appearance  */
 
-	/* color of the 'on surface' brush */
-	brush->add_col[0] = 1.00; /* add mode color is red */
-	brush->add_col[1] = 0.39;
-	brush->add_col[2] = 0.39;
+	brush->image_icon= NULL;
 
-	brush->sub_col[0] = 0.39; /* subtract mode color is blue */
-	brush->sub_col[1] = 0.39;
-	brush->sub_col[2] = 1.00;
+	brush->add_col[0]= 1.00; /* add mode color is light red */
+	brush->add_col[1]= 0.39;
+	brush->add_col[2]= 0.39;
 
-	/* note we should have a smoothing color also */
-	
-	brush_curve_preset(brush, CURVE_PRESET_SMOOTH); /* the default alpha falloff curve */
-	
-	default_mtex(&brush->mtex);
+	brush->sub_col[0]= 0.39; /* subtract mode color is light blue */
+	brush->sub_col[1]= 0.39;
+	brush->sub_col[2]= 1.00;
 
+	 /* the default alpha falloff curve */
+	brush_curve_preset(brush, CURVE_PRESET_SMOOTH);
+
 	/* enable fake user by default */
 	brush->id.flag |= LIB_FAKEUSER;
 	brush_toggled_fake_user(brush);
-	
-	brush->image_icon = NULL;
 
-	brush->plane_trim = 0.5f;
-
 	return brush;
 }
 

Modified: branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c	2010-07-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/source/blender/blenloader/intern/readfile.c	2010-07-14 06:27:31 UTC (rev 30292)
@@ -10957,37 +10957,78 @@
 	}
 
 	{
+		/* GSOC 2010 Sculpt - New settings for Brush */
+
 		Brush *brush;
 		for (brush= main->brush.first; brush; brush= brush->id.next) {
-			if (brush->texture_overlay_alpha == 0)
-				brush->texture_overlay_alpha = 33;
+			/* Sanity Check */
 
+			// infinite number of dabs
+			if (brush->spacing == 0)
+				brush->spacing = 10;
+
+			// will have no effect
+			if (brush->alpha == 0)
+				brush->alpha = 0.5f;
+
+			// bad radius
 			if (brush->unprojected_radius == 0)
 				brush->unprojected_radius = 0.125;
 
-			if (brush->add_col[0] == 0 &&
-			    brush->add_col[1] == 0 &&
-			    brush->add_col[2] == 0)
-			{
-				brush->add_col[0] = 1.00;
-				brush->add_col[1] = 0.39;
-				brush->add_col[2] = 0.39;
-			}
+			// unusable size
+			if (brush->size == 0)
+				brush->size = 35;
 
-			if (brush->sub_col[0] == 0 &&
-			    brush->sub_col[1] == 0 &&
-			    brush->sub_col[2] == 0)
-			{
-				brush->sub_col[0] = 0.39;
-				brush->sub_col[1] = 0.39;
-				brush->sub_col[2] = 1.00;
-			}
+			// can't see overlay
+			if (brush->texture_overlay_alpha == 0)
+				brush->texture_overlay_alpha = 33;
 
+			// same as draw brush
 			if (brush->crease_pinch_factor == 0)
 				brush->crease_pinch_factor = 2.0f/3.0f;
 
+			// will sculpt no vertexes
 			if (brush->plane_trim == 0)
 				brush->plane_trim = 0.5f;
+
+			// same as smooth stroke off
+			if (brush->smooth_stroke_radius == 0)
+				brush->smooth_stroke_radius= 75;
+
+			// will keep cursor in one spot
+			if (brush->smooth_stroke_radius == 1)
+				brush->smooth_stroke_factor= 0.9f;
+
+			// same as dots
+			if (brush->rate == 0)
+				brush->rate = 0.1f;
+
+			/* New Settings */
+			if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 6)) {
+				brush->flag |= BRUSH_SPACE_ATTEN; // explicitly enable adaptive space
+
+				// spacing was originally in pixels, convert it to percentage for new version
+				// size should not be zero due to sanity check above
+				brush->spacing = (int)(100*((float)brush->spacing) / ((float)brush->size));
+
+				if (brush->add_col[0] == 0 &&
+					brush->add_col[1] == 0 &&
+					brush->add_col[2] == 0)
+				{
+					brush->add_col[0] = 1.00;
+					brush->add_col[1] = 0.39;
+					brush->add_col[2] = 0.39;
+				}
+
+				if (brush->sub_col[0] == 0 &&
+					brush->sub_col[1] == 0 &&
+					brush->sub_col[2] == 0)
+				{
+					brush->sub_col[0] = 0.39;
+					brush->sub_col[1] = 0.39;
+					brush->sub_col[2] = 1.00;
+				}
+			}
 		}
 	}
 

Modified: branches/soc-2010-jwilkins/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/interface/resources.c	2010-07-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/source/blender/editors/interface/resources.c	2010-07-14 06:27:31 UTC (rev 30292)
@@ -1463,7 +1463,7 @@
 				SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
 		}
 	}
-	if (G.main->versionfile <= 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) {
+	if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) {
 		bTheme *btheme;
 		
 		/* interface_widgets.c */
@@ -1521,17 +1521,14 @@
 	/* this timer uses U */
 // XXX	reset_autosave();
 
-	/*  Sculpt Paint Unified Settings */
+	/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
 
 	if (U.sculpt_paint_unified_alpha == 0)
 		U.sculpt_paint_unified_alpha = 0.5f;
 
 	if (U.sculpt_paint_unified_unprojected_radius == 0) 
-		U.sculpt_paint_unified_unprojected_radius = 0.125f; // same as for brush do_version
+		U.sculpt_paint_unified_unprojected_radius = 0.125f;
 
 	if (U.sculpt_paint_unified_size == 0)
-		U.sculpt_paint_unified_size = 25;
+		U.sculpt_paint_unified_size = 35;
 }
-
-
-

Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c	2010-07-14 04:43:03 UTC (rev 30291)
+++ branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_ops.c	2010-07-14 06:27:31 UTC (rev 30292)
@@ -45,12 +45,16 @@
 static int brush_add_exec(bContext *C, wmOperator *op)
 {
 	/*int type = RNA_enum_get(op->ptr, "type");*/
-	Brush *br = NULL;
+	Paint *paint = paint_get_active(CTX_data_scene(C));
+	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+	Brush *br = paint_brush(paint);
 
-	br = add_brush("Brush");
+	if (br)
+		br = copy_brush(br);
+	else

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list