[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48655] branches/soc-2012-bratwurst/source /blender/editors/sculpt_paint/paint_cursor.c: More fixes for brush overlay.

Antony Riakiotakis kalast at gmail.com
Thu Jul 5 18:41:19 CEST 2012


Revision: 48655
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48655
Author:   psy-fi
Date:     2012-07-05 16:41:19 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
More fixes for brush overlay.

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c	2012-07-05 16:22:01 UTC (rev 48654)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_cursor.c	2012-07-05 16:41:19 UTC (rev 48655)
@@ -152,7 +152,8 @@
 	        ((snap.BKE_brush_size_get != BKE_brush_size_get(vc->scene, br)) ||
 	        !br->curve ||
 	        br->curve->changed_timestamp != curve_changed_timestamp ||
-	        br->mtex.brush_map_mode != snap.brush_map_mode);
+	        br->mtex.brush_map_mode != snap.brush_map_mode ||
+	        !overlay_texture_curve);
 
 	if (refresh || refresh_curve) {
 		int s = BKE_brush_size_get(vc->scene, br);
@@ -487,13 +488,14 @@
  * have on brush strength */
 /* TODO: sculpt only for now */
 static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush,
-                                     ViewContext *vc, int x, int y, float zoomx, float zoomy)
+                                     ViewContext *vc, int x, int y, float zoomx, float zoomy, int in_uv_editor)
 {
 	rctf quad;
 
 	/* check for overlay mode */
 	if (!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
-	    !(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED)))
+	    !(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED)) ||
+	    (brush->flag & BRUSH_FIXED_TEX && in_uv_editor))
 	{
 		return;
 	}
@@ -556,8 +558,10 @@
 			}
 		}
 		else {
-			const int radius = BKE_brush_size_get(vc->scene, brush);
+			int radius = BKE_brush_size_get(vc->scene, brush);
 
+			radius *= MAX2(zoomx, zoomy);
+
 			quad.xmin = x - radius;
 			quad.ymin = y - radius;
 			quad.xmax = x + radius;
@@ -677,10 +681,14 @@
 			brush->mtex.brush_map_mode = MTEX_MAP_MODE_VIEW;
 	}
 
-	if(in_uv_editor)
+	if(in_uv_editor) {
 		brush->mtex.brush_map_mode = MTEX_MAP_MODE_VIEW;
 
+		if(brush->flag & BRUSH_FIXED_TEX)
+			brush->mtex.brush_map_mode = MTEX_MAP_MODE_TILED;
+	}
 
+
 	/* can't use stroke vc here because this will be called during
 	 * mouse over too, not just during a stroke */
 	view3d_set_viewcontext(C, &vc);
@@ -692,7 +700,7 @@
 		 *  TODO) */
 	paint_calculate_rake_rotation(ups, translation);
 
-	print_v2("mouse"__FILE__, translation);
+	//print_v2("mouse"__FILE__, translation);
 
 	if(!in_uv_editor) {
 		/* test if brush is over the mesh. sculpt only for now */
@@ -716,7 +724,7 @@
 #undef PX_SIZE_FADE_MIN
 	}
 	/* draw overlay */
-	paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, zoomy);
+	paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, zoomy, in_uv_editor);
 
 	if (BKE_brush_use_locked_size(scene, brush) && !in_uv_editor) {
 		BKE_brush_size_set(scene, brush, pixel_radius);




More information about the Bf-blender-cvs mailing list