diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2019-09-29 01:47:39 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2019-09-30 15:37:19 +0300 |
commit | 6b419c18b05211fed48256318be81df35c02221f (patch) | |
tree | 0ef22a3e79829b67e51b7c51cb55c5b069a8c85c /source/blender/editors/sculpt_paint/paint_mask.c | |
parent | 91f6aa6a5759b5aa141bc92403ff3c7c21966dbf (diff) |
Sculpt: Only redraw nodes where the mask changed
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D5923
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_mask.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_mask.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index a849514ed68..7133936ff79 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -109,6 +109,7 @@ static void mask_flood_fill_task_cb(void *__restrict userdata, const PaintMaskFloodMode mode = data->mode; const float value = data->value; + bool redraw = false; PBVHVertexIter vi; @@ -116,13 +117,19 @@ static void mask_flood_fill_task_cb(void *__restrict userdata, BKE_pbvh_vertex_iter_begin(data->pbvh, node, vi, PBVH_ITER_UNIQUE) { + float prevmask = *vi.mask; mask_flood_fill_set_elem(vi.mask, mode, value); + if (prevmask != *vi.mask) { + redraw = true; + } } BKE_pbvh_vertex_iter_end; - BKE_pbvh_node_mark_redraw(node); - if (data->multires) { - BKE_pbvh_node_mark_normals_update(node); + if (redraw) { + BKE_pbvh_node_mark_redraw(node); + if (data->multires) { + BKE_pbvh_node_mark_normals_update(node); + } } } @@ -252,24 +259,32 @@ static void mask_box_select_task_cb(void *__restrict userdata, PBVHVertexIter vi; bool any_masked = false; + bool redraw = false; BKE_pbvh_vertex_iter_begin(data->pbvh, node, vi, PBVH_ITER_UNIQUE) { if (is_effected(clip_planes_final, vi.co)) { + float prevmask = *vi.mask; if (!any_masked) { any_masked = true; sculpt_undo_push_node(data->ob, node, SCULPT_UNDO_MASK); - BKE_pbvh_node_mark_redraw(node); if (data->multires) { BKE_pbvh_node_mark_normals_update(node); } } mask_flood_fill_set_elem(vi.mask, mode, value); + if (prevmask != *vi.mask) { + redraw = true; + } } } BKE_pbvh_vertex_iter_end; + + if (redraw) { + BKE_pbvh_node_mark_redraw(node); + } } bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select) |