[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40056] branches/bmesh/blender/source/ blender/editors/mesh/bmesh_tools.c: fix [#28534] Rotate Edge Vertices selection mode.

Campbell Barton ideasman42 at gmail.com
Fri Sep 9 06:09:36 CEST 2011


Revision: 40056
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40056
Author:   campbellbarton
Date:     2011-09-09 04:09:34 +0000 (Fri, 09 Sep 2011)
Log Message:
-----------
fix [#28534] Rotate Edge Vertices selection mode.
de-select other verts when rotating an edge, providing the initial edge was not between 2 selected faces.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c

Modified: branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2011-09-09 03:34:48 UTC (rev 40055)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c	2011-09-09 04:09:34 UTC (rev 40056)
@@ -1512,7 +1512,8 @@
 	BMOperator bmop;
 	BMEdge *eed;
 	BMIter iter;
-	int ccw = RNA_int_get(op->ptr, "direction") == 1; // direction == 2 when clockwise and ==1 for counter CW.
+	const int do_ccw = RNA_enum_get(op->ptr, "direction") == 1;
+	int do_deselect= FALSE; /* do we deselect */
 	
 	if (!(em->bm->totfacesel == 2 || em->bm->totedgesel == 1)) {
 		BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces");
@@ -1539,8 +1540,11 @@
 
 	if (!eed) {
 		BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
-			if (BM_TestHFlag(eed, BM_SELECT) && !BM_TestHFlag(eed, BM_HIDDEN))
+			if (BM_TestHFlag(eed, BM_SELECT) && !BM_TestHFlag(eed, BM_HIDDEN)) {
+				/* de-select the edge before */
+				do_deselect = TRUE;
 				break;
+			}
 		}
 	}
 
@@ -1548,9 +1552,14 @@
 	if (!eed)
 		return OPERATOR_CANCELLED;
 	
-	EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%d", eed, ccw);
+	EDBM_InitOpf(em, &bmop, op, "edgerotate edges=%e ccw=%d", eed, do_ccw);
+
+	/* avoid adding to the selection if we start off with only a selected edge,
+	 * we could also just deselect the single edge easily but use the BMO api
+	 * since it seems this is more 'correct' */
+	if(do_deselect) BMO_UnHeaderFlag_Buffer(em->bm, &bmop, "edges", BM_SELECT, BM_EDGE);
+
 	BMO_Exec_Op(em->bm, &bmop);
-
 	BMO_HeaderFlag_Buffer(em->bm, &bmop, "edgeout", BM_SELECT, BM_EDGE);
 
 	if (!EDBM_FinishOp(em, &bmop, op, 1))




More information about the Bf-blender-cvs mailing list