[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56767] trunk/blender/source/blender/ editors: Fix sculpt getting slower as you paint a longer stroke.

Brecht Van Lommel brechtvanlommel at pandora.be
Mon May 13 16:17:58 CEST 2013


Revision: 56767
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56767
Author:   blendix
Date:     2013-05-13 14:17:58 +0000 (Mon, 13 May 2013)
Log Message:
-----------
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.

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

Modified: trunk/blender/source/blender/editors/screen/area.c
===================================================================
--- trunk/blender/source/blender/editors/screen/area.c	2013-05-13 13:45:45 UTC (rev 56766)
+++ trunk/blender/source/blender/editors/screen/area.c	2013-05-13 14:17:58 UTC (rev 56767)
@@ -458,7 +458,8 @@
 #if 0
 	glEnable(GL_BLEND);
 	glColor4f(drand48(), drand48(), drand48(), 0.1f);
-	glRectf(ar->drawrct.xmin - 1, ar->drawrct.ymin - 1, ar->drawrct.xmax + 1, ar->drawrct.ymax + 1);
+	glRectf(ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin,
+			ar->drawrct.xmax - ar->winrct.xmin, ar->drawrct.ymax - ar->winrct.ymin);
 	glDisable(GL_BLEND);
 #endif
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-05-13 13:45:45 UTC (rev 56766)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-05-13 14:17:58 UTC (rev 56767)
@@ -500,11 +500,26 @@
 
 /*** 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 @@
 		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 @@
 	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 @@
 			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;




More information about the Bf-blender-cvs mailing list