[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45884] trunk/blender/source/blender/ editors/mesh/editmesh_rip.c: minor changes to rip internals

Campbell Barton ideasman42 at gmail.com
Mon Apr 23 17:18:13 CEST 2012


Revision: 45884
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45884
Author:   campbellbarton
Date:     2012-04-23 15:18:12 +0000 (Mon, 23 Apr 2012)
Log Message:
-----------
minor changes to rip internals
- check if vertex ripping has no effect.
- no need to flush selection for vertex rip.

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-23 14:57:47 UTC (rev 45883)
+++ trunk/blender/source/blender/editors/mesh/editmesh_rip.c	2012-04-23 15:18:12 UTC (rev 45884)
@@ -372,6 +372,7 @@
 	BMLoop *l;
 	BMEdge *e, *e2;
 	BMVert *v, *ripvert = NULL;
+	const int totvert_orig = bm->totvert;
 	int i;
 	float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
 	float dist = FLT_MAX;
@@ -573,6 +574,11 @@
 		}
 	}
 
+	if (totvert_orig == bm->totvert) {
+		BKE_report(op->reports, RPT_ERROR, "No vertices could be ripped");
+		return OPERATOR_CANCELLED;
+	}
+
 	return OPERATOR_FINISHED;
 }
 
@@ -590,6 +596,7 @@
 	BMLoop *l;
 	BMEdge *e, *e2;
 	BMVert *v;
+	const int totedge_orig = bm->totedge;
 	int i;
 	float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
 
@@ -671,7 +678,13 @@
 	                            ar, projectMat, fmval);
 	MEM_freeN(eloop_pairs);
 
+	if (totedge_orig == bm->totedge) {
+		BKE_report(op->reports, RPT_ERROR, "No edges could be ripped");
+		return OPERATOR_CANCELLED;
+	}
 
+	EDBM_selectmode_flush(em);
+
 	return OPERATOR_FINISHED;
 }
 
@@ -684,7 +697,6 @@
 	BMIter iter;
 	BMEdge *e;
 	int singlesel = (bm->totvertsel == 1 && bm->totedgesel == 0 && bm->totfacesel == 0);
-	const int totedge_orig = bm->totedge;
 	int ret;
 
 	/* running in face mode hardly makes sense, so convert to region loop and rip */
@@ -724,13 +736,6 @@
 		return OPERATOR_CANCELLED;
 	}
 
-	EDBM_selectmode_flush(em);
-
-	if ((singlesel == FALSE) && (totedge_orig == bm->totedge)) {
-		BKE_report(op->reports, RPT_ERROR, "No edges could be ripped");
-		return OPERATOR_CANCELLED;
-	}
-
 	BLI_assert(singlesel ? (bm->totvertsel > 0) : (bm->totedgesel > 0));
 
 	if (bm->totvertsel == 0) {




More information about the Bf-blender-cvs mailing list