[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36161] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix #26932: When I enable multires, and start sculpting, some parts of the mesh just disappears.

Sergey Sharybin g.ulairi at gmail.com
Thu Apr 14 17:53:34 CEST 2011


Revision: 36161
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36161
Author:   nazgul
Date:     2011-04-14 15:53:33 +0000 (Thu, 14 Apr 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-04-14 15:48:12 UTC (rev 36160)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2011-04-14 15:53:33 UTC (rev 36161)
@@ -306,7 +306,23 @@
 		}
 	}
 	
-	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 @@
 
 		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);
 		}




More information about the Bf-blender-cvs mailing list