[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39225] branches/soc-2011-onion/source/ blender/editors/sculpt_paint/paint_uv.c: smooth brush
Antony Riakiotakis
kalast at gmail.com
Tue Aug 9 20:23:41 CEST 2011
Revision: 39225
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39225
Author: psy-fi
Date: 2011-08-09 18:23:40 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
smooth brush
============
-test reference commit to make sure uvs affected as expected according to distance. This acts like a pinch brush and it is very fun to see :)
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 18:06:32 UTC (rev 39224)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c 2011-08-09 18:23:40 UTC (rev 39225)
@@ -110,10 +110,10 @@
SmoothBrushData *smoothbrushdata = (SmoothBrushData *)op->customdata;
SpaceImage *sima;
int width, height;
-
+ 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(paint_brush(smoothbrushdata->uvpaint));
+ radius = brush_size(brush);
sima = CTX_wm_space_image(C);
ED_space_image_size(sima, &width, &height);
radius /= (width > height)? width : height;
@@ -125,9 +125,14 @@
nverts = efa->v4 ? 4 : 3;
for(i = 0; i < nverts; i++){
- if(len_squared_v2v2(mt->uv[i], co) <= radius){
- mt->uv[i][0] += 0.1;
- mt->uv[i][1] += 0.1;
+ float diff[2], dist;
+ sub_v2_v2v2(diff, mt->uv[i], co);
+ if((dist = dot_v2v2(diff, diff)) <= radius){
+ float strength;
+ strength = brush_curve_strength(brush, dist, radius);
+ normalize_v2(diff);
+ mt->uv[i][0] -= strength*diff[0]*0.001;
+ mt->uv[i][1] -= strength*diff[1]*0.001;
}
}
}
More information about the Bf-blender-cvs
mailing list