[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37767] branches/soc-2011-onion/source/ blender/editors/uvedit/uvedit_ops.c: smart stitch - still a few corrections and GUI stuff.

Antony Riakiotakis kalast at gmail.com
Thu Jun 23 23:11:17 CEST 2011


Revision: 37767
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37767
Author:   psy-fi
Date:     2011-06-23 21:11:17 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
smart stitch - still a few corrections and GUI stuff. Key to select geometry will be space(subject to change, sorry when the feature is ready I'll post complete guide in the GSOC page)

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c

Modified: branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-06-23 20:46:06 UTC (rev 37766)
+++ branches/soc-2011-onion/source/blender/editors/uvedit/uvedit_ops.c	2011-06-23 21:11:17 UTC (rev 37767)
@@ -1209,8 +1209,15 @@
 	static char str[] = "%c V(ertices)  %c E(dges)  %c P(review)  %c L(imit)  %c S(nap)   Wheel(limit adjust): %f";
 	char msg[256];
 	ScrArea *sa= CTX_wm_area(C);
+	char mode = stitch_state->mode == VERT_STITCH;
+
 	if(sa) {
-		sprintf(msg, str, ' ', ' ', uv_get_stitch_previewer()->enabled?'*':' ', stitch_state->use_limit?'*':' ', ' ', stitch_state->limitDist);
+		sprintf(msg, str, (mode)? '*':' ',
+				(!mode)? '*':' ',
+				uv_get_stitch_previewer()->enabled?'*':' ',
+				stitch_state->use_limit?'*':' ',
+				' ',
+				stitch_state->limitDist);
 		ED_area_headerprint(sa, msg);
 	}
 }
@@ -1405,6 +1412,7 @@
 	stitch_state->use_limit = RNA_boolean_get(op->ptr, "use_limit");
 	stitch_state->limitDist = RNA_float_get(op->ptr, "limit");
 	stitch_state->em = em = BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	stitch_state->mode = VERT_STITCH;
 
 	EM_init_index_arrays(stitch_state->em, 0, 0, 1);
 	stitch_state->vmap = EM_make_uv_vert_map(stitch_state->em, 1, 0, NULL);
@@ -1750,7 +1758,7 @@
 		case PADPLUSKEY:
 		case WHEELUPMOUSE:
 			stitch_state->limitDist += 0.01;
-			//stitch_prepare_preview_data(stitch_state);
+			stitch_prepare_preview_data(stitch_state);
 			break;
 
 		/* Decrease limit */
@@ -1758,7 +1766,7 @@
 		case WHEELDOWNMOUSE:
 			stitch_state->limitDist -= 0.01;
 			stitch_state->limitDist = MAX2(0.01, stitch_state->limitDist);
-			//stitch_prepare_preview_data(stitch_state);
+			stitch_prepare_preview_data(stitch_state);
 			break;
 
 		/* Use Limit (Default off)*/
@@ -1766,16 +1774,27 @@
 			if(event->val == KM_PRESS){
 				stitch_state->use_limit = !stitch_state->use_limit;
 				break;
-			} else
-				return OPERATOR_RUNNING_MODAL;
+			}
+			return OPERATOR_RUNNING_MODAL;
 
 		/* Use Edge selection */
 		case EKEY:
+			if(event->val == KM_PRESS){
+				stitch_state->mode = EDGE_STITCH;
+				break;
+			}
 			return OPERATOR_RUNNING_MODAL;
 
 		/* Use vertex selection */
 		case VKEY:
 			if(event->val == KM_PRESS){
+				stitch_state->mode = VERT_STITCH;
+				break;
+			}
+			return OPERATOR_RUNNING_MODAL;
+
+		case SPACEKEY:
+			if(event->val == KM_PRESS){
 				/* add uv under mouse to processed uv's */
 				float co[2];
 				NearestHit hit;
@@ -1784,18 +1803,21 @@
 				Scene *scene= CTX_data_scene(C);
 
 				UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+				if(stitch_state->mode == VERT_STITCH)
 				find_nearest_uv_vert(scene, ima, stitch_state->em, co, NULL, &hit);
 				if(hit.efa)
 				{
 					/* Add vertex to selection and update the preview */
-					EditVert *vert = hit.efa->v1+hit.uv;
+					//EditVert *vert = hit.efa->v1+hit.uv;
 					MTFace *tface = hit.tf;
 					tface->flag |= TF_SEL_MASK(hit.uv);
 				}
 				stitch_prepare_preview_data(stitch_state);
+				break;
 			}
-			break;
+			return OPERATOR_RUNNING_MODAL;
 
+
 		/* turn preview on/off */
 		case PKEY:
 			if(event->val == KM_PRESS){




More information about the Bf-blender-cvs mailing list