[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43247] branches/soc-2011-onion-uv-tools/ source/blender/editors: Changes based on user feedback:

Antony Riakiotakis kalast at gmail.com
Mon Jan 9 22:45:19 CET 2012


Revision: 43247
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43247
Author:   psy-fi
Date:     2012-01-09 21:45:12 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Changes based on user feedback:

*Ctrl-E to mark seam
*Change default colours of smart stitch preview
*Alt+mousewheel adjust stitch limit to avoid conflict on MacOSX
*Add Mark Sharp to Seams from Islands operator

Modified Paths:
--------------
    branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
    branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c	2012-01-09 20:19:07 UTC (rev 43246)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/interface/resources.c	2012-01-09 21:45:12 UTC (rev 43247)
@@ -1709,12 +1709,12 @@
 	if (bmain->versionfile < 262){
 		bTheme *btheme;
 		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
-			SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
-			SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
+			SETCOLF(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
+			SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
+			SETCOLF(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
 			SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
 			SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
-			SETCOLF(btheme->tima.preview_stitch_active, 0.9, 0.9, 1.0, 0.2);
+			SETCOLF(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
 		}
 		U.high_bit_depth_tex = 0;
 	}

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c	2012-01-09 20:19:07 UTC (rev 43246)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_draw.c	2012-01-09 21:45:12 UTC (rev 43247)
@@ -885,8 +885,8 @@
 		UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
 		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
+//		UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
+//		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
 
 		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_quads);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -896,8 +896,8 @@
 		UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
 		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
+//		UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
+//		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
 
 		glDisable(GL_BLEND);
 

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2012-01-09 20:19:07 UTC (rev 43246)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_ops.c	2012-01-09 21:45:12 UTC (rev 43247)
@@ -3124,13 +3124,15 @@
 }
 
 
-static int seams_from_islands_exec(bContext *C, wmOperator *UNUSED(op))
+static int seams_from_islands_exec(bContext *C, wmOperator *op)
 {
 	UvVertMap *vmap;
 	Object *ob = CTX_data_edit_object(C);
 	EditMesh *em;
 	EditEdge *editedge;
 	float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT};
+	char mark_seams = RNA_boolean_get(op->ptr, "mark_seams");
+	char mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
 
 	em = BKE_mesh_get_editmesh(ob->data);
 	if(!EM_texFaceCheck(em)){
@@ -3143,77 +3145,81 @@
 	vmap = EM_make_uv_vert_map(em, 0, 0, limit);
 
 	for(editedge = em->edges.first; editedge; editedge = editedge->next){
-			/* flags to determine if we uv is separated from first editface match */
-			char separated1 = 0, separated2;
-			/* set to denote edge must be flagged as seam */
-			char faces_separated = 0;
-			/* flag to keep track if uv1 is disconnected from first editface match */
-			char v1coincident = 1;
-			/* For use with v1coincident. v1coincident will change only if we've had commonFaces */
-			int commonFaces = 0;
+		/* flags to determine if we uv is separated from first editface match */
+		char separated1 = 0, separated2;
+		/* set to denote edge must be flagged as seam */
+		char faces_separated = 0;
+		/* flag to keep track if uv1 is disconnected from first editface match */
+		char v1coincident = 1;
+		/* For use with v1coincident. v1coincident will change only if we've had commonFaces */
+		int commonFaces = 0;
 
-			EditFace *efa1, *efa2;
+		EditFace *efa1, *efa2;
 
-			UvMapVert *mv1, *mvinit1, *mv2, *mvinit2, *mviter;
-			/* mv2cache stores the first of the list of coincident uv's for later comparison
-			 * mv2sep holds the last separator and is copied to mv2cache when a hit is first found */
-			UvMapVert *mv2cache = NULL, *mv2sep = NULL;
+		UvMapVert *mv1, *mvinit1, *mv2, *mvinit2, *mviter;
+		/* mv2cache stores the first of the list of coincident uv's for later comparison
+		 * mv2sep holds the last separator and is copied to mv2cache when a hit is first found */
+		UvMapVert *mv2cache = NULL, *mv2sep = NULL;
 
-			mvinit1 = vmap->vert[editedge->v1->tmp.l];
+		mvinit1 = vmap->vert[editedge->v1->tmp.l];
 
-			editedge->seam = 0;
+		editedge->seam = 0;
 
-			for(mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next){
-				if(mv1->separate && commonFaces){
-					v1coincident = 0;
-				}
+		for(mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next){
+			if(mv1->separate && commonFaces){
+				v1coincident = 0;
+			}
 
-				separated2 = 0;
-				efa1 = EM_get_face_for_index(mv1->f);
-				mvinit2 = vmap->vert[editedge->v2->tmp.l];
+			separated2 = 0;
+			efa1 = EM_get_face_for_index(mv1->f);
+			mvinit2 = vmap->vert[editedge->v2->tmp.l];
 
-				for(mv2 = mvinit2; mv2; mv2 = mv2->next){
-					if(mv2->separate){
-						mv2sep = mv2;
-					}
+			for(mv2 = mvinit2; mv2; mv2 = mv2->next){
+				if(mv2->separate){
+					mv2sep = mv2;
+				}
 
-					efa2 = EM_get_face_for_index(mv2->f);
-					if(efa1 == efa2){
-						/* if v1 is not coincident no point in comparing */
-						if(v1coincident){
-							/* have we found previously anything? */
-							if(mv2cache){
-								/* flag seam unless proved to be coincident with previous hit */
-								separated2 = 1;
-								for(mviter = mv2cache; mviter; mviter = mviter->next){
-									if(mviter->separate && mviter != mv2cache)
-										break;
-									/* coincident with previous hit, do not flag seam */
-									if(mviter == mv2)
-										separated2 = 0;
-								}
+				efa2 = EM_get_face_for_index(mv2->f);
+				if(efa1 == efa2){
+					/* if v1 is not coincident no point in comparing */
+					if(v1coincident){
+						/* have we found previously anything? */
+						if(mv2cache){
+							/* flag seam unless proved to be coincident with previous hit */
+							separated2 = 1;
+							for(mviter = mv2cache; mviter; mviter = mviter->next){
+								if(mviter->separate && mviter != mv2cache)
+									break;
+								/* coincident with previous hit, do not flag seam */
+								if(mviter == mv2)
+									separated2 = 0;
 							}
-							/* First hit case, store the hit in the cache */
-							else {
-								mv2cache = mv2sep;
-								commonFaces = 1;
-							}
-						}else {
-							separated1 = 1;
 						}
-
-						if(separated1 || separated2){
-							faces_separated = 1;
-							break;
+						/* First hit case, store the hit in the cache */
+						else {
+							mv2cache = mv2sep;
+							commonFaces = 1;
 						}
+					}else {
+						separated1 = 1;
 					}
+
+					if(separated1 || separated2){
+						faces_separated = 1;
+						break;
+					}
 				}
 			}
+		}
 
-			if(faces_separated){
+		if(faces_separated){
+			if(mark_seams){
 				editedge->seam = 1;
 			}
-
+			if(mark_sharp){
+				editedge->sharp = 1;
+			}
+		}
 	}
 
 	EM_free_uv_vert_map(vmap);
@@ -3240,6 +3246,9 @@
 	/* api callbacks */
 	ot->exec= seams_from_islands_exec;
 	ot->poll= ED_operator_uvedit;
+
+	RNA_def_boolean(ot->srna, "mark_seams", 1, "Mark Seams", "Mark boundary edges as seams");
+	RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp");
 }
 
 static int mark_seam_uv_exec(bContext *C, wmOperator *op)
@@ -3337,7 +3346,7 @@
 	keymap->poll= ED_operator_uvedit_can_uv_sculpt;
 
 	/* Mark edge seam */
-	WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", YKEY, KM_PRESS, KM_CTRL, 0);
+	WM_keymap_add_item(keymap, "UV_OT_mark_seam_uv", EKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* pick selection */
 	WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);

Modified: branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c
===================================================================
--- branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c	2012-01-09 20:19:07 UTC (rev 43246)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c	2012-01-09 21:45:12 UTC (rev 43247)
@@ -224,7 +224,7 @@
 /* This function updates the header of the UV editor when the stitch tool updates its settings */
 static void stitch_update_header(StitchState *stitch_state, bContext *C)
 {
-	static char str[] = "(S)nap %s, (M)idpoints %s, (L)imit %.2f (Ctrl Wheel adjust) %s, Switch (I)sland, shift select vertices";
+	static char str[] = "(S)nap %s, (M)idpoints %s, (L)imit %.2f (Alt Wheel adjust) %s, Switch (I)sland, shift select vertices";
 
 	char msg[HEADER_LENGTH];
 	ScrArea *sa= CTX_wm_area(C);
@@ -1291,7 +1291,7 @@
 		/* Increase limit */
 		case PADPLUSKEY:
 		case WHEELUPMOUSE:
-			if(event->ctrl){
+			if(event->alt){
 				stitch_state->limit_dist += 0.01;
 				if(!stitch_process_data(stitch_state, scene, 0)){
 					return stitch_cancel(C, op);
@@ -1304,7 +1304,7 @@
 		/* Decrease limit */
 		case PADMINUS:
 		case WHEELDOWNMOUSE:
-			if(event->ctrl){
+			if(event->alt){
 				stitch_state->limit_dist -= 0.01;
 				stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist);
 				if(!stitch_process_data(stitch_state, scene, 0)){



More information about the Bf-blender-cvs mailing list