[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42981] branches/soc-2011-onion-uv-tools/ source/blender: -remove grab brush from uv sculpting.

Antony Riakiotakis kalast at gmail.com
Thu Dec 29 22:53:36 CET 2011


Revision: 42981
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42981
Author:   psy-fi
Date:     2011-12-29 21:53:29 +0000 (Thu, 29 Dec 2011)
Log Message:
-----------
-remove grab brush from uv sculpting.

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c
    branches/soc-2011-onion-uv-tools/source/blender/makesdna/DNA_scene_types.h
    branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c	2011-12-29 21:30:43 UTC (rev 42980)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_image.c	2011-12-29 21:53:29 UTC (rev 42981)
@@ -5244,7 +5244,7 @@
 	if(settings->use_uv_sculpt){
 		if(!settings->uvsculpt){
 			settings->uvsculpt = MEM_callocN(sizeof(*settings->uvsculpt), "UV Smooth paint");
-			settings->uv_sculpt_tool = UV_SCULPT_TOOL_GRAB;
+			settings->uv_sculpt_tool = UV_SCULPT_TOOL_RELAX;
 			settings->uv_sculpt_settings = UV_SCULPT_LOCK_BORDERS | UV_SCULPT_ALL_ISLANDS;
 			settings->uv_relax_method = UV_SCULPT_TOOL_RELAX_LAPLACIAN;
 		}

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2011-12-29 21:30:43 UTC (rev 42980)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/paint_ops.c	2011-12-29 21:53:29 UTC (rev 42981)
@@ -700,7 +700,6 @@
 	ed_keymap_paint_brush_size(keymap, "tool_settings.uv_sculpt.brush.size");
 	ed_keymap_paint_brush_radial_control(keymap, "uv_sculpt", 0);
 
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_sculpt_tool_set", GKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_SCULPT_TOOL_GRAB);
 	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_sculpt_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_SCULPT_TOOL_RELAX);
 	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_sculpt_tool_set", PKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_SCULPT_TOOL_PINCH);
 

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c	2011-12-29 21:30:43 UTC (rev 42980)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/sculpt_paint/sculpt_uv.c	2011-12-29 21:53:29 UTC (rev 42981)
@@ -86,27 +86,6 @@
 }UvEdge;
 
 
-typedef struct UVInitialStrokeElement{
-	/* index to unique uv */
-	int uv;
-	/* strength of brush on initial position */
-	float strength;
-	/* initial uv position */
-	float initial_uv[2];
-}UVInitialStrokeElement;
-
-typedef struct UVInitialStroke{
-	/* Initial Selection,for grab brushes for instance */
-	UVInitialStrokeElement *initialSelection;
-
-	/* total initially selected UVs*/
-	int totalInitialSelected;
-
-	/* initial mouse coordinates */
-	float init_coord[2];
-}UVInitialStroke;
-
-
 /* custom data for uv smoothing brush */
 typedef struct UvSculptData{
 	/* Contains the first of each set of coincident uvs.
@@ -123,9 +102,6 @@
 	/* Need I say more? */
 	int totalUvEdges;
 
-	/* data for initial stroke, used by tools like grab */
-	UVInitialStroke *initial_stroke;
-
 	/* Timer to be used for airbrush-type brush */
 	wmTimer *timer;
 
@@ -354,31 +330,6 @@
 		}
 	}
 
-	/*
-	 * Grab Tool
-	 */
-	else if(tool == UV_SCULPT_TOOL_GRAB){
-		int i;
-		float diff[2];
-		sub_v2_v2v2(diff, co, sculptdata->initial_stroke->init_coord);
-
-		for(i = 0; i < sculptdata->initial_stroke->totalInitialSelected; i++ ){
-			UvElement *element;
-			int uvindex = sculptdata->initial_stroke->initialSelection[i].uv;
-			float strength = sculptdata->initial_stroke->initialSelection[i].strength;
-			sculptdata->uv[uvindex].uv[0] = sculptdata->initial_stroke->initialSelection[i].initial_uv[0] + strength*diff[0];
-			sculptdata->uv[uvindex].uv[1] = sculptdata->initial_stroke->initialSelection[i].initial_uv[1] +  strength*diff[1];
-
-			for(element = sculptdata->uv[uvindex].element; element; element = element->next){
-				MTFace *mt;
-				if(element->separate && element != sculptdata->uv[uvindex].element)
-					break;
-				mt = CustomData_em_get(&em->fdata, element->face->data, CD_MTFACE);
-				copy_v2_v2(mt->uv[element->tfindex], sculptdata->uv[uvindex].uv);
-			}
-		}
-	}
-
 	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
@@ -399,12 +350,7 @@
 	if(data->uvedges){
 		MEM_freeN(data->uvedges);
 	}
-	if(data->initial_stroke){
-		if(data->initial_stroke->initialSelection){
-			MEM_freeN(data->initial_stroke->initialSelection);
-		}
-		MEM_freeN(data->initial_stroke);
-	}
+
 	MEM_freeN(data);
 	op->customdata = NULL;
 }
@@ -626,66 +572,6 @@
 				}
 			}
 		}
-
-		/* Allocate initial selection for grab tool */
-		if(ts->uv_sculpt_tool == UV_SCULPT_TOOL_GRAB){
-			float radius, radius_root;
-			unsigned int tool;
-			UvSculptData *sculptdata = (UvSculptData *)op->customdata;
-			SpaceImage *sima;
-			int width, height;
-			float aspectRatio;
-			float alpha, zoomx, zoomy;
-			Brush *brush = paint_brush(sculptdata->uvsculpt);
-			tool = CTX_data_scene(C)->toolsettings->uv_sculpt_tool;
-
-			alpha = brush_alpha(brush);
-
-			radius = brush_size(brush);
-			sima = CTX_wm_space_image(C);
-			ED_space_image_size(sima, &width, &height);
-			ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
-
-			aspectRatio = width/(float)height;
-			radius /= (width*zoomx);
-			radius = radius*radius;
-			radius_root = sqrt(radius);
-
-			/* Allocate selection stack */
-			data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke");
-			if(!data->initial_stroke){
-				uv_sculpt_stroke_exit(C, op);
-			}
-			data->initial_stroke->initialSelection =  MEM_mallocN(sizeof(*data->initial_stroke->initialSelection)*data->totalUniqueUvs, "uv_sculpt_initial_selection");
-			if(!data->initial_stroke->initialSelection){
-				uv_sculpt_stroke_exit(C, op);
-			}
-
-			copy_v2_v2(data->initial_stroke->init_coord, co);
-
-			counter = 0;
-
-			for (i = 0; i < data->totalUniqueUvs; i++){
-				float dist, diff[2];
-				if(data->uv[i].flag & MARK_BOUNDARY){
-					continue;
-				}
-
-				sub_v2_v2v2(diff, data->uv[i].uv, co);
-				diff[1] /= aspectRatio;
-				if((dist = dot_v2v2(diff, diff)) <= radius){
-					float strength;
-					strength = alpha*brush_curve_strength(brush, sqrt(dist), radius_root);
-
-					data->initial_stroke->initialSelection[counter].uv = i;
-					data->initial_stroke->initialSelection[counter].strength = strength;
-					copy_v2_v2(data->initial_stroke->initialSelection[counter].initial_uv, data->uv[i].uv);
-					counter++;
-				}
-			}
-
-			data->initial_stroke->totalInitialSelected = counter;
-		}
 	}
 
 	return op->customdata;
@@ -748,7 +634,7 @@
 			uv_sculpt_stroke_apply(C, op, event, obedit);
 			break;
 		case TIMER:
-			if(event->customdata == data->timer && tool != UV_SCULPT_TOOL_GRAB)
+			if(event->customdata == data->timer)
 				uv_sculpt_stroke_apply(C, op, event, obedit);
 			break;
 		default:

Modified: branches/soc-2011-onion-uv-tools/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/makesdna/DNA_scene_types.h	2011-12-29 21:30:43 UTC (rev 42980)
+++ branches/soc-2011-onion-uv-tools/source/blender/makesdna/DNA_scene_types.h	2011-12-29 21:53:29 UTC (rev 42981)
@@ -640,7 +640,6 @@
 
 #define UV_SCULPT_TOOL_PINCH				1
 #define UV_SCULPT_TOOL_RELAX				2
-#define UV_SCULPT_TOOL_GRAB					3
 
 #define UV_SCULPT_TOOL_RELAX_LAPLACIAN	1
 #define UV_SCULPT_TOOL_RELAX_HC			2
@@ -901,29 +900,7 @@
 	float sculpt_paint_unified_alpha; /* unified strength of brush */
 } ToolSettings;
 
-/*
- * UVIsland Component, stores boundaries for uv island, possibly a list of faces too, though this would be
- */
-typedef struct UVIslandComponent {
-		float x_pos;
-		float y_pos;
-		float width;
-		float height;
-		/* Looks like a family reunion :p */
-		struct UVIslandComponent *brother;
-		struct UVIslandComponent *child;
-} UVIslandComponent;
 
-/**
- * Island Manager, holds the state necessary to use/display the island manager
- */
-typedef struct UVIslandManager {
-		UVIslandComponent *rootIsland;
-		int active;
-		int pad2;
-} UVIslandManager;
-
-
 typedef struct bStats {
 	/* scene totals for visible layers */
 	int totobj, totlamp, totobjsel, totcurve, totmesh, totarmature;

Modified: branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c	2011-12-29 21:30:43 UTC (rev 42980)
+++ branches/soc-2011-onion-uv-tools/source/blender/makesrna/intern/rna_scene.c	2011-12-29 21:53:29 UTC (rev 42981)
@@ -71,7 +71,6 @@
 EnumPropertyItem uv_sculpt_tool_items[] = {
 	{UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
 	{UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
-	{UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
 	{0, NULL, 0, NULL, NULL}};
 
 




More information about the Bf-blender-cvs mailing list