Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-04-14 19:53:33 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-04-14 19:53:33 +0400
commit31bd41244759f7a348ecfedfa718548a81bd4fe3 (patch)
treeee651b2a5644857e087f0669b1de9347b6e695fa
parent5175d509ab66e965890a6851701c07841446eb4a (diff)
Fix #26932: When I enable multires, and start sculpting, some parts of the mesh just disappears.
Redraw issue was caused due to different redraw rectangles used for 3d view redraw and gathering PBVH nodes to be re-drawed. I moved redraw rect expansion with rect from previous step into sculpt_get_redraw_rect, so now redrawing works as it was planned some commits ago -- redraw everything to which is inside currect rectangle and rectangle from previous stroke step -- this still prevents artifact caused by fast strokes but mesh doesn't disappear. Brecht, Nicholas: it's the simpliest fix i could suggest atm. I've got some more ideas with additional node flags, but it looked more complicated for me and made code more difficult to understand. If you could see something better (like revert all this redraw fixes for fast strokes) please tell me.
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 1543cbedae9..ad1d55c336b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -306,7 +306,23 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
}
}
- return rect->xmin < rect->xmax && rect->ymin < rect->ymax;
+ if (rect->xmin < rect->xmax && rect->ymin < rect->ymax) {
+ /* 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
+ disapper from screen (sergey) */
+ SculptSession *ss = ob->sculpt;
+
+ if (ss->cache) {
+ if (!BLI_rcti_is_empty(&ss->cache->previous_r))
+ BLI_union_rcti(rect, &ss->cache->previous_r);
+ }
+
+ return 1;
+ }
+
+ return 0;
}
void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
@@ -3417,20 +3433,14 @@ static void sculpt_flush_update(bContext *C)
BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB, NULL);
if (sculpt_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) {
+ if (ss->cache)
+ ss->cache->previous_r= r;
+
r.xmin += ar->winrct.xmin + 1;
r.xmax += ar->winrct.xmin - 1;
r.ymin += ar->winrct.ymin + 1;
r.ymax += ar->winrct.ymin - 1;
- if (ss->cache) {
- rcti tmp = r;
-
- if (!BLI_rcti_is_empty(&ss->cache->previous_r))
- BLI_union_rcti(&r, &ss->cache->previous_r);
-
- ss->cache->previous_r= tmp;
- }
-
ss->partial_redraw = 1;
ED_region_tag_redraw_partial(ar, &r);
}