[Bf-blender-cvs] [f6083b7] master: Fix (unreported) bad handling of brush's fill threshold value.

Bastien Montagne noreply at git.blender.org
Fri Nov 18 15:53:31 CET 2016


Commit: f6083b7bcd6901ae8d8452e34d1230afaa8da3fb
Author: Bastien Montagne
Date:   Fri Nov 18 15:32:50 2016 +0100
Branches: master
https://developer.blender.org/rBf6083b7bcd6901ae8d8452e34d1230afaa8da3fb

Fix (unreported) bad handling of brush's fill threshold value.

'1' threshold value would only allow to access a third of the basic
'color space' (from black to white, from 0.0 to 1.0 component values),
when you expect it to access the whole range.

Unfortunately, this needs a subversion bump to allow already defined
brushes to keep exact same behavior!

Also, did not change default value (0.2) for new brushes, think here
keeping current one makes more sense.

Thanks to @LucaRood for confirming the issue.

===================================================================

M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/editors/sculpt_paint/paint_image_2d.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index baf8510..4f4787f 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         278
-#define BLENDER_SUBVERSION      3
+#define BLENDER_SUBVERSION      4
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 8133d04..25d78b7 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1466,4 +1466,11 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 	}
+
+	if (!MAIN_VERSION_ATLEAST(main, 278, 4)) {
+		const float sqrt_3 = (float)M_SQRT3;
+		for (Brush *br = main->brush.first; br; br = br->id.next) {
+			br->fill_threshold /= sqrt_3;
+		}
+	}
 }
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index 9474a46..4f93c12 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -1489,7 +1489,8 @@ void paint_2d_bucket_fill(
 		float image_init[2];
 		int minx = ibuf->x, miny = ibuf->y, maxx = 0, maxy = 0;
 		float pixel_color[4];
-		float threshold_sq = br->fill_threshold * br->fill_threshold;
+		/* We are comparing to sum of three squared values (assumed in range [0,1]), so need to multiply... */
+		float threshold_sq = br->fill_threshold * br->fill_threshold * 3;
 
 		UI_view2d_region_to_view(s->v2d, mouse_init[0], mouse_init[1], &image_init[0], &image_init[1]);




More information about the Bf-blender-cvs mailing list