[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43251] branches/soc-2011-onion-uv-tools/ source/blender/editors/uvedit/uvedit_smart_stitch.c: Smart stitch now respects the user preference of mouse select left vs right

Antony Riakiotakis kalast at gmail.com
Tue Jan 10 01:31:26 CET 2012


Revision: 43251
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43251
Author:   psy-fi
Date:     2012-01-10 00:31:19 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
Smart stitch now respects the user preference of mouse select left vs right

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

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 23:53:35 UTC (rev 43250)
+++ branches/soc-2011-onion-uv-tools/source/blender/editors/uvedit/uvedit_smart_stitch.c	2012-01-10 00:31:19 UTC (rev 43251)
@@ -1260,7 +1260,29 @@
 	}
 }
 
+static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState *stitch_state){
+	/* add uv under mouse to processed uv's */
+	float co[2];
+	NearestHit hit;
+	ARegion *ar= CTX_wm_region(C);
+	Image *ima= CTX_data_edit_image(C);
 
+	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
+	ED_find_nearest_uv_vert(scene, ima, stitch_state->em, co, NULL, &hit);
+
+	if(hit.efa)
+	{
+		/* Add vertex to selection, deselect all common uv's of vert other
+		 * than selected and update the preview. This behavior was decided so that
+		 * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */
+
+		/* This works due to setting of tmp in find nearest uv vert */
+		UvElement *element = ED_get_uv_element(stitch_state->element_map, hit.efa, hit.uv);
+		stitch_select_uv(element, stitch_state, 0);
+
+	}
+}
+
 static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	StitchState *stitch_state;
@@ -1278,6 +1300,16 @@
 
 
 		case LEFTMOUSE:
+			if(event->shift && (U.flag & USER_LMOUSESELECT)){
+				if(event->val == KM_RELEASE){
+					stitch_select(C, scene, event, stitch_state);
+
+					if(!stitch_process_data(stitch_state, scene, 0)){
+						return stitch_cancel(C, op);
+					}
+				}
+				break;
+			}
 		case PADENTER:
 		case RETKEY:
 			if(stitch_process_data(stitch_state, scene, 1)){
@@ -1352,27 +1384,9 @@
 			if(!event->shift){
 					return stitch_cancel(C, op);
 			}
-			if(event->val == KM_RELEASE){
-				/* add uv under mouse to processed uv's */
-				float co[2];
-				NearestHit hit;
-				ARegion *ar= CTX_wm_region(C);
-				Image *ima= CTX_data_edit_image(C);
+			if(event->val == KM_RELEASE && !(U.flag & USER_LMOUSESELECT)){
+				stitch_select(C, scene, event, stitch_state);
 
-				UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
-				ED_find_nearest_uv_vert(scene, ima, stitch_state->em, co, NULL, &hit);
-
-				if(hit.efa)
-				{
-					/* Add vertex to selection, deselect all common uv's of vert other
-					 * than selected and update the preview. This behavior was decided so that
-					 * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */
-
-						/* This works due to setting of tmp in find nearest uv vert */
-						UvElement *element = ED_get_uv_element(stitch_state->element_map, hit.efa, hit.uv);
-						stitch_select_uv(element, stitch_state, 0);
-
-				}
 				if(!stitch_process_data(stitch_state, scene, 0)){
 					return stitch_cancel(C, op);
 				}




More information about the Bf-blender-cvs mailing list