[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39224] branches/soc-2011-onion/source/ blender: smooth brush
Antony Riakiotakis
kalast at gmail.com
Tue Aug 9 20:06:32 CEST 2011
Revision: 39224
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39224
Author: psy-fi
Date: 2011-08-09 18:06:32 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
smooth brush
============
-test reference commit to make sure uvs affected as expected.
-small fix for math.h length function
Modified Paths:
--------------
branches/soc-2011-onion/source/blender/blenlib/BLI_math_vector.h
branches/soc-2011-onion/source/blender/blenlib/intern/math_vector_inline.c
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_math_vector.h 2011-08-09 17:51:32 UTC (rev 39223)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_math_vector.h 2011-08-09 18:06:32 UTC (rev 39224)
@@ -105,7 +105,7 @@
MINLINE float len_v2(const float a[2]);
MINLINE float len_v2v2(const float a[2], const float b[2]);
-MINLINE float len_squared_v2v2(const float a[3], const float b[3]);
+MINLINE float len_squared_v2v2(const float a[2], const float b[2]);
MINLINE float len_v3(const float a[3]);
MINLINE float len_v3v3(const float a[3], const float b[3]);
MINLINE float len_squared_v3v3(const float a[3], const float b[3]);
Modified: branches/soc-2011-onion/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/math_vector_inline.c 2011-08-09 17:51:32 UTC (rev 39223)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/math_vector_inline.c 2011-08-09 18:06:32 UTC (rev 39224)
@@ -377,7 +377,7 @@
return sqrtf(dot_v3v3(a, a));
}
-MINLINE float len_squared_v2v2(const float a[3], const float b[3])
+MINLINE float len_squared_v2v2(const float a[2], const float b[2])
{
float d[2];
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 17:51:32 UTC (rev 39223)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c 2011-08-09 18:06:32 UTC (rev 39224)
@@ -39,6 +39,7 @@
#include "BLI_utildefines.h"
#include "BLI_editVert.h"
+#include "BLI_math.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -54,6 +55,7 @@
#include "BKE_customdata.h"
#include "ED_screen.h"
+#include "ED_image.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -106,20 +108,27 @@
EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
EditFace *efa;
SmoothBrushData *smoothbrushdata = (SmoothBrushData *)op->customdata;
+ SpaceImage *sima;
+ int width, height;
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
radius = brush_size(paint_brush(smoothbrushdata->uvpaint));
- //ED_space_image_size(sima, &width, &height);
+ sima = CTX_wm_space_image(C);
+ ED_space_image_size(sima, &width, &height);
+ radius /= (width > height)? width : height;
+ radius = radius*radius;
for(efa = em->faces.first; efa; efa= efa->next){
int nverts, i;
MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
nverts = efa->v4 ? 4 : 3;
- for(i = 0; i < nverts; i++)
- {
- //if()
+ 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;
+ }
}
}
/* for tradition's sake */
More information about the Bf-blender-cvs
mailing list