[Bf-blender-cvs] [a9b0390] master: Fix T45880: Texture Paint mask random angle fails

Campbell Barton noreply at git.blender.org
Wed Sep 9 19:40:19 CEST 2015


Commit: a9b0390bff074a15f927c192fcb60b3264e655b9
Author: Campbell Barton
Date:   Thu Sep 10 03:32:17 2015 +1000
Branches: master
https://developer.blender.org/rBa9b0390bff074a15f927c192fcb60b3264e655b9

Fix T45880: Texture Paint mask random angle fails

Random mask failed when the paint brush didn't have random angle enabled too.

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

M	source/blender/editors/sculpt_paint/paint_stroke.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 6fa5f62..6dc1855 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -224,6 +224,7 @@ static bool paint_brush_update(bContext *C,
 	bool location_sampled = false;
 	bool location_success = false;
 	bool do_random = false;
+	bool do_random_mask = false;
 	/* XXX: Use pressure value from first brush step for brushes which don't
 	 *      support strokes (grab, thumb). They depends on initial state and
 	 *      brush coord/pressure/etc.
@@ -271,9 +272,11 @@ static bool paint_brush_update(bContext *C,
 	}
 
 	if (paint_supports_dynamic_tex_coords(brush, mode)) {
-		if (((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) ||
-		     (brush->mtex.brush_map_mode == MTEX_MAP_MODE_AREA) ||
-		     (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)))
+
+		if (ELEM(brush->mtex.brush_map_mode,
+		         MTEX_MAP_MODE_VIEW,
+		         MTEX_MAP_MODE_AREA,
+		         MTEX_MAP_MODE_RANDOM))
 		{
 			do_random = true;
 		}
@@ -286,6 +289,15 @@ static bool paint_brush_update(bContext *C,
 
 		/* take care of mask texture, if any */
 		if (brush->mask_mtex.tex) {
+
+			if (ELEM(brush->mask_mtex.brush_map_mode,
+			         MTEX_MAP_MODE_VIEW,
+			         MTEX_MAP_MODE_AREA,
+			         MTEX_MAP_MODE_RANDOM))
+			{
+				do_random_mask = true;
+			}
+
 			if (brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)
 				BKE_brush_randomize_texture_coords(ups, true);
 			else {
@@ -357,7 +369,9 @@ static bool paint_brush_update(bContext *C,
 			ups->brush_rotation += -brush->mtex.random_angle / 2.0f +
 			                       brush->mtex.random_angle * BLI_frand();
 		}
+	}
 
+	if (do_random_mask) {
 		if (brush->mask_mtex.brush_angle_mode & MTEX_ANGLE_RANDOM) {
 			ups->brush_rotation_sec += -brush->mask_mtex.random_angle / 2.0f +
 			                           brush->mask_mtex.random_angle * BLI_frand();




More information about the Bf-blender-cvs mailing list