[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48572] branches/soc-2012-bratwurst/source /blender/editors/sculpt_paint: Fix rake overlay for image editor

Antony Riakiotakis kalast at gmail.com
Wed Jul 4 01:18:52 CEST 2012


Revision: 48572
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48572
Author:   psy-fi
Date:     2012-07-03 23:18:49 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
Fix rake overlay for image editor

Modified Paths:
--------------
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.c
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.h
    branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.c	2012-07-03 22:58:43 UTC (rev 48571)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.c	2012-07-03 23:18:49 UTC (rev 48572)
@@ -338,7 +338,7 @@
 		if(brush->flag & BRUSH_RANDOM_ROTATION)
 			special_rotation = BLI_frand()*2*M_PI;
 		else if(brush->flag & BRUSH_RAKE) {
-			paint_calculate_rake_rotation(ups, pos);
+			paint_calculate_rake_rotation(ups, painter->areamousepos);
 			special_rotation = ups->last_angle;
 		}
 
@@ -403,7 +403,7 @@
 		painter->accumdistance += len;
 
 		if(brush->flag & BRUSH_RAKE) {
-			paint_calculate_rake_rotation(ups, pos);
+			paint_calculate_rake_rotation(ups, painter->areamousepos);
 			special_rotation = ups->last_angle;
 		} else if(brush->flag & BRUSH_RANDOM_ROTATION)
 			special_rotation = BLI_frand()*2*M_PI;

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.h	2012-07-03 22:58:43 UTC (rev 48571)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_2D.h	2012-07-03 23:18:49 UTC (rev 48572)
@@ -52,7 +52,7 @@
 	struct Scene *scene;
 	struct Brush *brush;
 
-	float lastmousepos[2];  /* mouse position of last paint call */
+	float lastmousepos[2];  /* mouse position of last paint call. May be area space or image space, depending texture or image paint */
 
 	float accumdistance;    /* accumulated distance of brush since last paint op */
 	float lastpaintpos[2];  /* position of last paint op */
@@ -70,6 +70,8 @@
 	float startjitter;
 	float startspacing;
 
+	float areamousepos[2]; /* guaranteed to hold the mouse position */
+
 	BrushPainterCache cache;
 };
 

Modified: branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c	2012-07-03 22:58:43 UTC (rev 48571)
+++ branches/soc-2012-bratwurst/source/blender/editors/sculpt_paint/paint_image.c	2012-07-03 23:18:49 UTC (rev 48572)
@@ -105,6 +105,7 @@
 #include "GPU_extensions.h"
 
 #include "paint_intern.h"
+#include "paint_2D.h"
 
 /* Defines and Structs */
 
@@ -4128,6 +4129,9 @@
 	pos[0] = (float)(mval_i[0]);
 	pos[1] = (float)(mval_i[1]);
 
+	painter->areamousepos[0] = (float)(mval_i[0]);
+	painter->areamousepos[1] = (float)(mval_i[1]);
+
 	// we may want to use this later 
 	// BKE_brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0);
 	
@@ -4639,6 +4643,9 @@
 		s->uv[1] = newuv[1];
 	}
 	else {
+		painter->areamousepos[0] = (float)(mval[0]);
+		painter->areamousepos[1] = (float)(mval[1]);
+
 		UI_view2d_region_to_view(s->v2d, mval[0], mval[1], &newuv[0], &newuv[1]);
 		redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, newuv,
 		                                    time, 1, pressure);




More information about the Bf-blender-cvs mailing list