diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 18:17:58 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 18:17:58 +0400 |
commit | 0e2487742ec333bf110738e95ad7d110942fc40a (patch) | |
tree | abbd82a01c8b99832d5fb3206964198058c06c23 /source/blender/editors/sculpt_paint | |
parent | 10474c324dcc0c66d55e5b86a683f47f23d7fd76 (diff) |
Fix sculpt getting slower as you paint a longer stroke. Partial redraw was
redrawing the whole area that was painted on from the start of the stroke,
should only do the last part.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 6c57296ae3a..a7bc58daf54 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -500,11 +500,26 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob) /*** BVH Tree ***/ +static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect) +{ + /* expand redraw rect with redraw rect from previous step to + * prevent partial-redraw issues caused by fast strokes. This is + * needed here (not in sculpt_flush_update) as it was before + * because redraw rectangle should be the same in both of + * optimized PBVH draw function and 3d view redraw (if not -- some + * mesh parts could disappear from screen (sergey) */ + SculptSession *ss = ob->sculpt; + + if (ss->cache) { + if (!BLI_rcti_is_empty(&ss->cache->previous_r)) + BLI_rcti_union(rect, &ss->cache->previous_r); + } +} + /* Get a screen-space rectangle of the modified area */ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, Object *ob, rcti *rect) { - SculptSession *ss; PBVH *pbvh = ob->sculpt->pbvh; float bb_min[3], bb_max[3]; @@ -524,17 +539,6 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, return 0; } - /* expand redraw rect with redraw rect from previous step to - * prevent partial-redraw issues caused by fast strokes. This is - * needed here (not in sculpt_flush_update) as it was before - * because redraw rectangle should be the same in both of - * optimized PBVH draw function and 3d view redraw (if not -- some - * mesh parts could disappear from screen (sergey) */ - ss = ob->sculpt; - if (ss->cache) { - if (!BLI_rcti_is_empty(&ss->cache->previous_r)) - BLI_rcti_union(rect, &ss->cache->previous_r); - } return 1; } @@ -546,6 +550,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, rcti rect; sculpt_get_redraw_rect(ar, rv3d, ob, &rect); + sculpt_extend_redraw_rect_previous(ob, &rect); paint_calc_redraw_planes(planes, ar, rv3d, ob, &rect); @@ -4223,6 +4228,8 @@ static void sculpt_flush_update(bContext *C) if (ss->cache) ss->cache->previous_r = r; + sculpt_extend_redraw_rect_previous(ob, &r); + r.xmin += ar->winrct.xmin + 1; r.xmax += ar->winrct.xmin - 1; r.ymin += ar->winrct.ymin + 1; |