Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-03-25 05:25:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-25 05:25:46 +0400
commit5e7372a7ce936cd2e348c6ff1704a39837d46907 (patch)
tree8e81c447a3f23eba11df74cbef6e3c477ceebdea /source/blender/editors
parent00e3aa529edfbd7b5693b15d9fb1d5e0c52ee336 (diff)
cancel face/edge creation operator if nothing is done (so it wont register or do an undo push)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index bf505daf919..feb65be098d 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1237,6 +1237,8 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
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 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
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 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
}
EDBM_update_generic(em, true, true);
-
+
return OPERATOR_FINISHED;
}