[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11726] trunk/blender/source/blender/src: * Change to the working of the left mouse select preference

Matt Ebb matt at mke3.net
Mon Aug 20 03:32:55 CEST 2007


Revision: 11726
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11726
Author:   broken
Date:     2007-08-20 03:32:15 +0200 (Mon, 20 Aug 2007)

Log Message:
-----------
* Change to the working of the left mouse select preference 

Previously, the implementation of this was quite awkward, with
the preference swapping mouse buttons globally, rather than just 
selection, as is advertised on the pref. This had the effect of 
changing the painting in sculpt/texture paint/weight paint/etc to 
the left mouse button. This was totally silly, since when using a 
tablet, left mouse select is the sane way to go, but it meant 
that every time you wanted to sculpt or paint, you had to switch 
the mouse buttons around so you could actually use the tablet as 
normal.

This commit fixes that, and makes the preference do just what it 
says, use left mouse for selection (i.e. in object/edit mode) and 
only that.

Modified Paths:
--------------
    trunk/blender/source/blender/src/sculptmode.c
    trunk/blender/source/blender/src/space.c
    trunk/blender/source/blender/src/vpaint.c

Modified: trunk/blender/source/blender/src/sculptmode.c
===================================================================
--- trunk/blender/source/blender/src/sculptmode.c	2007-08-20 01:02:12 UTC (rev 11725)
+++ trunk/blender/source/blender/src/sculptmode.c	2007-08-20 01:32:15 UTC (rev 11726)
@@ -1700,8 +1700,7 @@
 	mvalo[0]= mouse[0];
 	mvalo[1]= mouse[1];
 
-	if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
-	else mousebut = L_MOUSE;
+	mousebut = L_MOUSE;
 
 	/* If modifier_calculations is true, then extra time must be spent
 	   updating the mesh. This takes a *lot* longer, so it's worth

Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c	2007-08-20 01:02:12 UTC (rev 11725)
+++ trunk/blender/source/blender/src/space.c	2007-08-20 01:32:15 UTC (rev 11726)
@@ -1131,7 +1131,7 @@
 	Object *ob= OBACT;	/* do not change! */
 	float *curs;
 	int doredraw= 0, pupval;
-	unsigned short event= evt->event, origevent= evt->event;
+	unsigned short event= evt->event;
 	short val= evt->val;
 	char ascii= evt->ascii;
 	
@@ -1148,8 +1148,15 @@
 		
 		/* swap mouse buttons based on user preference */
 		if (U.flag & USER_LMOUSESELECT) {
-			if (event==LEFTMOUSE) event = RIGHTMOUSE;
-			else if (event==RIGHTMOUSE) event = LEFTMOUSE;
+			/* only swap mouse button for selection, in modes where it is relevant.
+			 * painting/sculpting stays on LEFTMOUSE */
+			if (   !((G.f & G_SCULPTMODE) || (G.f & G_WEIGHTPAINT) ||
+				(G.f & G_VERTEXPAINT) || (G.f & G_TEXTUREPAINT)) ||
+				(G.obedit) )
+			{			
+				if (event==LEFTMOUSE) event = RIGHTMOUSE;
+				else if (event==RIGHTMOUSE) event = LEFTMOUSE;
+			}
 		}
 
 		if(!mouse_in_header(sa)) {
@@ -1538,7 +1545,7 @@
 					vertex_paint();
 				}
 				else if (G.f & G_TEXTUREPAINT) {
-					imagepaint_paint(origevent==LEFTMOUSE? L_MOUSE: R_MOUSE, 1);
+					imagepaint_paint(L_MOUSE, 1);
 				}
 				break;
 			case MIDDLEMOUSE:
@@ -4739,7 +4746,7 @@
 static void winqreadimagespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
 {
 	SpaceImage *sima= spacedata;
-	unsigned short event= evt->event, origevent= evt->event;
+	unsigned short event= evt->event;
 	short val= evt->val;
 	
 	if(val==0) return;
@@ -4761,10 +4768,10 @@
 				scrarea_queue_winredraw(sa);
 				break;
 			case LEFTMOUSE:
-				imagepaint_paint(origevent==LEFTMOUSE? L_MOUSE: R_MOUSE, 0);
+				imagepaint_paint(L_MOUSE, 0);
 				break;
 			case RIGHTMOUSE:
-				imagepaint_pick(origevent==LEFTMOUSE? L_MOUSE: R_MOUSE);
+				imagepaint_pick(R_MOUSE);
 				break;
 		}
 	}

Modified: trunk/blender/source/blender/src/vpaint.c
===================================================================
--- trunk/blender/source/blender/src/vpaint.c	2007-08-20 01:02:12 UTC (rev 11725)
+++ trunk/blender/source/blender/src/vpaint.c	2007-08-20 01:32:15 UTC (rev 11726)
@@ -1089,7 +1089,7 @@
 	float vpimat[3][3];
 	int *indexar, index, totindex, alpha, totw;
 	int vgroup_mirror= -1;
-	short mval[2], mvalo[2], firsttime=1, mousebut;
+	short mval[2], mvalo[2], firsttime=1;
 
 	if((G.f & G_WEIGHTPAINT)==0) return;
 	if(G.obedit) return;
@@ -1162,9 +1162,6 @@
 	mvalo[0]= mval[0];
 	mvalo[1]= mval[1];
 	
-	if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
-	else mousebut = L_MOUSE;
-	
 	/* if mirror painting, find the other group */
 	if(Gwp.flag & VP_MIRROR_X) {
 		bDeformGroup *defgroup= BLI_findlink(&ob->defbase, ob->actdef-1);
@@ -1190,7 +1187,7 @@
 		}
 	}
 	
-	while (get_mbut() & mousebut) {
+	while (get_mbut() & L_MOUSE) {
 		getmouseco_areawin(mval);
 		
 		if(firsttime || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {
@@ -1362,7 +1359,7 @@
 	float vpimat[3][3];
 	unsigned int paintcol=0, *mcol, *mcolorig, fcol1, fcol2;
 	int *indexar, index, alpha, totindex;
-	short mval[2], mvalo[2], firsttime=1, mousebut;
+	short mval[2], mvalo[2], firsttime=1;
 	
 	if((G.f & G_VERTEXPAINT)==0) return;
 	if(G.obedit) return;
@@ -1405,10 +1402,7 @@
 	mvalo[0]= mval[0];
 	mvalo[1]= mval[1];
 	
-	if (U.flag & USER_LMOUSESELECT) mousebut = R_MOUSE;
-	else mousebut = L_MOUSE;
-	
-	while (get_mbut() & mousebut) {
+	while (get_mbut() & L_MOUSE) {
 		getmouseco_areawin(mval);
 		
 		if(firsttime || mval[0]!=mvalo[0] || mval[1]!=mvalo[1]) {





More information about the Bf-blender-cvs mailing list