[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55560] trunk/blender/source/blender/ editors/mesh/editmesh_tools.c: cancel face/ edge creation operator if nothing is done ( so it wont register or do an undo push)

Campbell Barton ideasman42 at gmail.com
Mon Mar 25 02:25:48 CET 2013


Revision: 55560
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55560
Author:   campbellbarton
Date:     2013-03-25 01:25:46 +0000 (Mon, 25 Mar 2013)
Log Message:
-----------
cancel face/edge creation operator if nothing is done (so it wont register or do an undo push)

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

Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2013-03-25 01:11:16 UTC (rev 55559)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2013-03-25 01:25:46 UTC (rev 55560)
@@ -1237,6 +1237,8 @@
 	Object *obedit = CTX_data_edit_object(C);
 	BMEditMesh *em = BMEdit_FromObject(obedit);
 	const short use_smooth = edbm_add_edge_face__smooth_get(em->bm);
+	const int totedge_orig = em->bm->totedge;
+	const int totface_orig = em->bm->totface;
 	/* when this is used to dissolve we could avoid this, but checking isnt too slow */
 
 #ifdef USE_FACE_CREATE_SEL_EXTEND
@@ -1257,6 +1259,14 @@
 	
 	BMO_op_exec(em->bm, &bmop);
 
+	/* cancel if nothing was done */
+	if ((totedge_orig == em->bm->totedge) &&
+	    (totface_orig == em->bm->totface))
+	{
+		EDBM_op_finish(em, &bmop, op, true);
+		return OPERATOR_CANCELLED;
+	}
+
 #ifdef USE_FACE_CREATE_SEL_EXTEND
 	/* normally we would want to leave the new geometry selected,
 	 * but being able to press F many times to add geometry is too useful! */
@@ -1278,7 +1288,7 @@
 	}
 
 	EDBM_update_generic(em, true, true);
-	
+
 	return OPERATOR_FINISHED;
 }
 




More information about the Bf-blender-cvs mailing list