[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39378] branches/soc-2011-onion/source/ blender/editors/sculpt_paint/paint_uv.c: uv paint brushes
Antony Riakiotakis
kalast at gmail.com
Sun Aug 14 02:22:11 CEST 2011
Revision: 39378
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39378
Author: psy-fi
Date: 2011-08-14 00:22:10 +0000 (Sun, 14 Aug 2011)
Log Message:
-----------
uv paint brushes
=================
-Re-enable pinch brush.
-Brush tool that operates is now based on GUI selection
Next to integrate: island isolation and edge pinning.
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-14 00:08:11 UTC (rev 39377)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c 2011-08-14 00:22:10 UTC (rev 39378)
@@ -334,6 +334,7 @@
ARegion *ar= CTX_wm_region(C);
EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
EditFace *efa;
+ unsigned int tool;
UvBrushData *brushdata = (UvBrushData *)op->customdata;
SpaceImage *sima;
int invert;
@@ -341,6 +342,7 @@
float aspectRatio;
float alpha;
Brush *brush = paint_brush(brushdata->uvpaint);
+ tool = CTX_data_scene(C)->toolsettings->uv_paint_tool;
invert = RNA_boolean_get(op->ptr, "invert")? -1 : 1;
alpha = brush_alpha(brush);//*invert;
@@ -353,32 +355,34 @@
radius /= width;
radius = radius*radius;
- //Implementation for uv pinching, temporarily disabled
- /*
- 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;
+ if(tool == UV_PAINT_TOOL_PINCH){
+ alpha *= invert;
+ 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++){
- 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 = alpha*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;
+ 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 = alpha*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;
+ }
}
}
}
- */
- HC_relaxation_iteration_uv(em, brushdata, co, alpha, radius, aspectRatio);
-// for(){
+ else if(tool == UV_PAINT_TOOL_RELAX){
+ unsigned int method = CTX_data_scene(C)->toolsettings->uv_relax_method;
+ if(method == UV_PAINT_TOOL_RELAX_HC){
+ HC_relaxation_iteration_uv(em, brushdata, co, alpha, radius, aspectRatio);
+ }
+ }
-// }
-
BKE_mesh_end_editmesh(obedit->data, em);
}
More information about the Bf-blender-cvs
mailing list