diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-26 02:44:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-26 02:44:08 +0400 |
commit | 84334bde01dd2ed7913cbddeea966b2f0364a2b9 (patch) | |
tree | c22cd0076c2633dbb4f6811eeaf8b1855aa09c73 /source/blender/editors | |
parent | 02f90c000115d5d2ab330005e20d02419defe35a (diff) |
Fix 37571: Knife Select should be disabled when no faces are selected
also check a similar case for bisect
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_bisect.c | 10 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 7bc3ff3ab77..c3c4bda4178 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -36,6 +36,7 @@ #include "BKE_global.h" #include "BKE_context.h" #include "BKE_editmesh.h" +#include "BKE_report.h" #include "RNA_define.h" #include "RNA_access.h" @@ -110,8 +111,15 @@ static bool mesh_bisect_interactive_calc( static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); int ret; + if (em->bm->totedgesel == 0) { + BKE_report(op->reports, RPT_ERROR, "Selected edges/faces required"); + return OPERATOR_CANCELLED; + } + /* if the properties are set or there is no rv3d, * skip model and exec immediately */ @@ -129,8 +137,6 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event) wmGesture *gesture = op->customdata; BisectData *opdata; - Object *obedit = CTX_data_edit_object(C); - BMEditMesh *em = BKE_editmesh_from_object(obedit); opdata = MEM_mallocN(sizeof(BisectData), "inset_operator_data"); opdata->mesh_backup = EDBM_redo_state_store(em); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 6b99f53a5b8..ce8985591f2 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -50,6 +50,7 @@ #include "BKE_context.h" #include "BKE_editmesh.h" #include "BKE_editmesh_bvh.h" +#include "BKE_report.h" #include "BIF_gl.h" #include "BIF_glutil.h" /* for paint cursor */ @@ -2646,6 +2647,15 @@ static int knifetool_invoke(bContext *C, wmOperator *op, const wmEvent *event) KnifeTool_OpData *kcd; + if (only_select) { + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + if (em->bm->totfacesel == 0) { + BKE_report(op->reports, RPT_ERROR, "Selected faces required"); + return OPERATOR_CANCELLED; + } + } + view3d_operator_needs_opengl(C); /* alloc new customdata */ |