diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-06-30 22:53:48 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-01 20:03:22 +0300 |
commit | 6358c7754c322919368aef9580bfa5b9a0fa0b60 (patch) | |
tree | e316385b97fc0d7bee0f593164523a2999e30c57 /source/blender/editors/sculpt_paint/sculpt_paint_color.c | |
parent | bf5a656ff6840bdaf911abf5692271845377e2d9 (diff) |
Cleanup: Add functions to check the first brush step and symmetry passes
This adds three functions to check the state of the stroke in the
StrokeCache, removing the references to first_time and
mirror_symmetry_pass from the code. This makes easier to understand what
each code path is doing inside of each tool.
Some tools were using mirror_symmetry_pass incorrectly, so this should
also fix unreported bugs with radial and tiling symmetry related to that.
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D8164
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_paint_color.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_paint_color.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c index 9b38def6b7b..5cf6a053382 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c @@ -247,8 +247,10 @@ void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode return; } - if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0) { - ss->cache->density_seed = BLI_hash_int_01(ss->cache->location[0] * 1000); + if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) { + if (SCULPT_stroke_is_first_brush_step(ss->cache)) { + ss->cache->density_seed = BLI_hash_int_01(ss->cache->location[0] * 1000); + } return; } @@ -444,7 +446,7 @@ void SCULPT_do_smear_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode const int totvert = SCULPT_vertex_count_get(ss); - if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0) { + if (SCULPT_stroke_is_first_brush_step(ss->cache)) { if (!ss->cache->prev_colors) { ss->cache->prev_colors = MEM_callocN(sizeof(float) * 4 * totvert, "prev colors"); for (int i = 0; i < totvert; i++) { |