[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47952] branches/soc-2012-bratwurst: revert brush size randomize commit, it interferes with other modes badly.

Antony Riakiotakis kalast at gmail.com
Fri Jun 15 14:49:54 CEST 2012


Revision: 47952
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47952
Author:   psy-fi
Date:     2012-06-15 12:49:48 +0000 (Fri, 15 Jun 2012)
Log Message:
-----------
revert brush size randomize commit, it interferes with other modes badly.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_brush.h
    branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2012-bratwurst/source/blender/makesdna/DNA_brush_types.h
    branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_brush.c

Modified: branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2012-06-15 12:49:48 UTC (rev 47952)
@@ -643,9 +643,6 @@
             self.prop_unified_size(row, context, brush, "use_pressure_size")
 
             row = col.row(align=True)
-            row.prop(brush, "random_size", slider=True)
-
-            row = col.row(align=True)
             self.prop_unified_strength(row, context, brush, "strength", text="Strength")
             self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 

Modified: branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_brush.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_brush.h	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/blenkernel/BKE_brush.h	2012-06-15 12:49:48 UTC (rev 47952)
@@ -91,7 +91,7 @@
 struct ImBuf *BKE_brush_gen_radial_control_imbuf(struct Brush *br);
 
 /* unified strength and size */
-int BKE_brush_size_nonrandomized_get(const struct Scene *scene, struct Brush *brush);
+
 int  BKE_brush_size_get(const struct Scene *scene, struct Brush *brush);
 void BKE_brush_size_set(struct Scene *scene, struct Brush *brush, int value);
 

Modified: branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/blenkernel/intern/brush.c	2012-06-15 12:49:48 UTC (rev 47952)
@@ -102,8 +102,6 @@
 	brush->rate = 0.1f; /* time delay between dots of paint or sculpting when doing airbrush mode */
 
 	brush->jitter = 0.0f;
-	brush->random_size = 0.0;
-	brush->random_size_cache = 1.0;
 
 	/* BRUSH TEXTURE SETTINGS */
 	default_mtex(&brush->mtex);
@@ -298,8 +296,6 @@
 	BR_TEST_FLAG(BRUSH_CUSTOM_ICON);
 
 	BR_TEST(jitter, f);
-	BR_TEST(random_size, f);
-	BR_TEST(random_size_cache, f);
 	BR_TEST(spacing, d);
 	BR_TEST(smooth_stroke_radius, d);
 	BR_TEST(smooth_stroke_factor, f);
@@ -489,14 +485,6 @@
 	return 0;
 }
 
-/* reset the random size cache to a random value, proportional to the size of the brush.
- * due to the many places BKE_brush_size_get is called it is not safe to generate a random
- * number for every call. Instead we will generate a random number before each stroke */
-void BKE_brush_randomize_size(Brush *brush)
-{
-	brush->random_size_cache = (1.0 - brush->random_size/2.0) + brush->random_size*BLI_frand();
-}
-
 /* Brush Sampling */
 void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread, float angle)
 {
@@ -669,20 +657,13 @@
 		brush->size = size;
 }
 
-int BKE_brush_size_nonrandomized_get(const Scene *scene, Brush *brush)
+int BKE_brush_size_get(const Scene *scene, Brush *brush)
 {
 	UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
 
 	return (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size;
 }
 
-int BKE_brush_size_get(const Scene *scene, Brush *brush)
-{
-	UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
-
-	return (ups->flag & UNIFIED_PAINT_SIZE) ? brush->random_size_cache*ups->size : brush->random_size_cache*brush->size;
-}
-
 int BKE_brush_use_locked_size(const Scene *scene, Brush *brush)
 {
 	const short us_flag = scene->toolsettings->unified_paint_settings.flag;
@@ -840,7 +821,7 @@
 	painter->firsttouch = 1;
 	painter->cache.lastsize = -1; /* force ibuf create in refresh */
 
-	painter->startsize = BKE_brush_size_nonrandomized_get(scene, brush);
+	painter->startsize = BKE_brush_size_get(scene, brush);
 	painter->startalpha = BKE_brush_alpha_get(scene, brush);
 	painter->startjitter = brush->jitter;
 	painter->startspacing = brush->spacing;
@@ -1135,8 +1116,6 @@
 	Brush *brush = painter->brush;
 	int totpaintops = 0;
 
-	BKE_brush_randomize_size(brush);
-
 	if (pressure == 0.0f) {
 		if (painter->lastpressure) // XXX - hack, operator misses
 			pressure = painter->lastpressure;

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c	2012-06-15 12:49:48 UTC (rev 47952)
@@ -2957,7 +2957,7 @@
 	
 	MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
 
-	const int diameter = 2 * BKE_brush_size_nonrandomized_get(ps->scene, ps->brush);
+	const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush);
 	
 	/* ---- end defines ---- */
 	
@@ -4871,7 +4871,7 @@
 	if (pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
 		pop->s.tool = PAINT_TOOL_DRAW;
 	pop->s.blend = brush->blend;
-	pop->orig_brush_size = BKE_brush_size_nonrandomized_get(scene, brush);
+	pop->orig_brush_size = BKE_brush_size_get(scene, brush);
 
 	if (pop->mode != PAINT_MODE_2D) {
 		Object *ob = OBACT;
@@ -5226,7 +5226,7 @@
 	if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
 		ToolSettings *ts;
 		float zoomx, zoomy;
-		const float size = (float)BKE_brush_size_nonrandomized_get(scene, brush);
+		const float size = (float)BKE_brush_size_get(scene, brush);
 		short use_zoom;
 		float pixel_size;
 		float alpha = 0.5f;

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_ops.c	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_ops.c	2012-06-15 12:49:48 UTC (rev 47952)
@@ -99,7 +99,7 @@
 	if (brush) {
 		// pixel radius
 		{
-			const int old_size = BKE_brush_size_nonrandomized_get(scene, brush);
+			const int old_size = BKE_brush_size_get(scene, brush);
 			int size = (int)(scalar * old_size);
 
 			if (old_size == size) {

Modified: branches/soc-2012-bratwurst/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesdna/DNA_brush_types.h	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/makesdna/DNA_brush_types.h	2012-06-15 12:49:48 UTC (rev 47952)
@@ -69,8 +69,6 @@
 	short ob_mode;      /* & with ob->mode to see if the brush is compatible, use for display only. */
 	float weight;       /* brush weight */
 	int size;           /* brush diameter */
-	float random_size;  /* randomize brush diameter */
-	float random_size_cache; /* cache the random size */
 	int flag;           /* general purpose flag */
 	float jitter;       /* jitter the position of the brush */
 	int spacing;        /* spacing of paint operations */

Modified: branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_brush.c	2012-06-15 12:29:33 UTC (rev 47951)
+++ branches/soc-2012-bratwurst/source/blender/makesrna/intern/rna_brush.c	2012-06-15 12:49:48 UTC (rev 47952)
@@ -618,12 +618,6 @@
 	RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop = RNA_def_property(srna, "random_size", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "random_size");
-	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Randomize Radius", "Radius of brush changes while painting");
-	RNA_def_property_update(prop, 0, "rna_Brush_update");
-
 	prop = RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "jitter");
 	RNA_def_property_range(prop, 0.0f, 1.0f);




More information about the Bf-blender-cvs mailing list