diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-09 20:32:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-09 20:34:57 +0300 |
commit | a9b0390bff074a15f927c192fcb60b3264e655b9 (patch) | |
tree | 8bb6dc6233ad179b984f8880dceb31abda5bc763 | |
parent | 4e759d6735dc140f9ef389130aaaa1db73593296 (diff) |
Fix T45880: Texture Paint mask random angle fails
Random mask failed when the paint brush didn't have random angle enabled too.
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 6fa5f62177f..6dc1855401d 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(); |