[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39236] branches/soc-2011-onion/source/ blender/editors/sculpt_paint/paint_uv.c: account for aspect ratio

Antony Riakiotakis kalast at gmail.com
Tue Aug 9 23:04:52 CEST 2011


Revision: 39236
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39236
Author:   psy-fi
Date:     2011-08-09 21:04:52 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
account for aspect ratio

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	2011-08-09 20:33:35 UTC (rev 39235)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	2011-08-09 21:04:52 UTC (rev 39236)
@@ -110,13 +110,15 @@
 	SmoothBrushData *smoothbrushdata = (SmoothBrushData *)op->customdata;
 	SpaceImage *sima;
 	int width, height;
+	float aspectRatio;
 	Brush *brush = paint_brush(smoothbrushdata->uvpaint);
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 
 	radius = brush_size(brush);
 	sima = CTX_wm_space_image(C);
 	ED_space_image_size(sima, &width, &height);
-	radius /= (width > height)? width : height;
+	aspectRatio = width/(float)height;
+	radius /= width;
 	radius = radius*radius;
 
 	for(efa = em->faces.first; efa; efa= efa->next){
@@ -127,6 +129,7 @@
 		for(i = 0; i < nverts; i++){
 			float diff[2], dist;
 			sub_v2_v2v2(diff, mt->uv[i], co);
+			diff[1] /= aspectRatio;
 			if((dist = dot_v2v2(diff, diff)) <= radius){
 				float strength;
 				strength = brush_curve_strength(brush, dist, radius);




More information about the Bf-blender-cvs mailing list