[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45723] trunk/blender/source/blender/ editors/mesh/editmesh_rip.c: fix error in single vertex ripping where the edit-selection could be left on unselected verts or not set on the newly ripped vertex .

Campbell Barton ideasman42 at gmail.com
Tue Apr 17 20:36:29 CEST 2012


Revision: 45723
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45723
Author:   campbellbarton
Date:     2012-04-17 18:36:29 +0000 (Tue, 17 Apr 2012)
Log Message:
-----------
fix error in single vertex ripping where the edit-selection could be left on unselected verts or not set on the newly ripped vertex.

also some corrections to comments.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/editmesh_rip.c

Modified: trunk/blender/source/blender/editors/mesh/editmesh_rip.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_rip.c	2012-04-17 18:14:31 UTC (rev 45722)
+++ trunk/blender/source/blender/editors/mesh/editmesh_rip.c	2012-04-17 18:36:29 UTC (rev 45723)
@@ -134,7 +134,7 @@
  *     connected edge loops.
  *     The reason for using loops like this is because when the edges are split we don't which face user gets the newly
  *     created edge (its as good as random so we cant assume new edges will be on once side).
- *     After splitting walking along boundary loops is very simple and each has only edges from one side of another.
+ *     After splittingm, its very simple to walk along boundary loops since each only has one edge from a single side.
  * - The end loop pairs are stored in an array however to support multiple edge-selection-islands, so you can rip
  *   multiple selections at once.
  * - * Execute the split *
@@ -142,8 +142,7 @@
  * - Deselect the edge loop facing away.
  *
  * Limitation!
- * This currently works very poorly for edge selections that include junctions of 3+ split edges at one vertex.
- * It this wont work with intersecting edge islands (verts with more then 2 tagged edges)
+ * This currently works very poorly with intersecting edge islands (verts with more then 2 tagged edges)
  * This is nice to but for now not essential.
  *
  * - campbell.
@@ -196,14 +195,14 @@
 	BLI_array_declare(eloop_pairs);
 	EdgeLoopPair *lp;
 
-	/* untag all loops */
+	/* initialize loops with dummy invalid index values */
 	BM_ITER(f, &fiter, bm, BM_FACES_OF_MESH, NULL) {
 		BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
 			BM_elem_index_set(l, INVALID_UID);
 		}
 	}
 
-	/* build contiguous array */
+	/* set contiguous loops ordered 'uid' values for walking after split */
 	while (TRUE) {
 		int tot = 0;
 		BMIter eiter;
@@ -227,7 +226,7 @@
 
 		e_first = e;
 
-		/* initialize, avoid loop on loop */
+		/* initialize  */
 		v_step = e_first->v1;
 
 		uid_start = uid;
@@ -238,12 +237,14 @@
 			tot++;
 		}
 
-		/* always store the highest 'uid' edge */
+		/* this edges loops have the highest uid's, store this to walk down later */
 		e_last = e_step;
 
+		/* always store the highest 'uid' edge for the stride */
 		uid_end = uid - 1;
 		uid = uid_start - 1;
 
+		/* initialize */
 		v_step = e_first->v1;
 
 		while ((e = edbm_ripsel_edge_mark_step(bm, v_step, uid))) {
@@ -390,6 +391,8 @@
 			v = (BMVert *)ese.ele;
 		}
 		else {
+			ese.ele = NULL;
+
 			BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
 				if (BM_elem_flag_test(v, BM_ELEM_SELECT))
 					break;
@@ -436,6 +439,8 @@
 			bmesh_vert_separate(bm, v, &vout, &vout_len);
 
 			if (vout_len < 2) {
+				/* set selection back to avoid active-unselected vertex */
+				BM_elem_select_set(bm, v, TRUE);
 				/* should never happen */
 				BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
 				return OPERATOR_CANCELLED;
@@ -443,6 +448,10 @@
 			else {
 				int vi_best = 0;
 
+				if (ese.ele) {
+					EDBM_editselection_remove(em, &ese.ele->head);
+				}
+
 				dist = FLT_MAX;
 
 				for (i = 0; i < vout_len; i++) {
@@ -469,6 +478,10 @@
 				v = vout[vi_best];
 				BM_elem_select_set(bm, v, TRUE);
 
+				if (ese.ele) {
+					EDBM_editselection_store(em, &v->head);
+				}
+
 				/* splice all others back together */
 				if (vout_len > 2) {
 




More information about the Bf-blender-cvs mailing list