[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57969] branches/soc-2013-paint/source/ blender/editors/sculpt_paint/paint_image_2d.c: Fix doing too many invalidations of brush image cache.

Antony Riakiotakis kalast at gmail.com
Wed Jul 3 21:21:20 CEST 2013


Revision: 57969
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57969
Author:   psy-fi
Date:     2013-07-03 19:21:19 +0000 (Wed, 03 Jul 2013)
Log Message:
-----------
Fix doing too many invalidations of brush image cache. Having separate
flags for mask/image helps here.

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-07-03 17:16:24 UTC (rev 57968)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_2d.c	2013-07-03 19:21:19 UTC (rev 57969)
@@ -610,6 +610,8 @@
 
 	if (painter->cache.is_maskbrush) {
 		bool renew_maxmask = false;
+		bool do_view_mask = false;
+		//bool do_partial_update_mask = false;
 		/* invalidate case for all mapping modes */
 		if (diameter != cache->lastsize ||
 		    alpha != cache->lastalpha)
@@ -617,23 +619,33 @@
 			renew_maxmask = true;
 		}
 		if (brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) {
-			do_view = true;
+			do_view_mask = true;
 			mask_rotation += ups->brush_rotation;
 		}
 		else if (brush->mask_mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM) {
-			do_random = true;
+			/* we need to force random to take new mask values into account */
+			if (!painter->cache.use_masking)
+				do_random = true;
 			renew_maxmask = true;
+			//do_partial_update_mask = false;
 		}
 		else {
-			do_partial_update = true;
+			/* we need to do partial update to take new mask values into account */
+			if (!painter->cache.use_masking)
+				do_partial_update = true;
+			//do_partial_update_mask = true;
 			renew_maxmask = true;
 		}
 		/* explicilty disable partial update even if it has been enabled above */
 		if (brush->mask_pressure) {
-			do_partial_update = false;
+			//do_partial_update_mask = false;
 			renew_maxmask = true;
 		}
 
+		if (do_view_mask) {
+			//do_partial_update_mask = false;
+		}
+
 		brush_painter_2d_tex_mapping(s, size, painter->startpaintpos, pos, mouse,
 		                             brush->mask_mtex.brush_map_mode, &painter->mask_mapping);
 		if (renew_maxmask) {
@@ -674,7 +686,7 @@
 		}
 
 		if (do_partial_update) {
-			/* do partial update of texture + recreate mask */
+			/* do partial update of texture */
 			brush_painter_imbuf_partial_update(painter, pos);
 		}
 		else {




More information about the Bf-blender-cvs mailing list