Fix 37571: Knife Select should be disabled when no faces are selected

also check a similar case for bisect
This commit is contained in:
2013-11-26 09:44:08 +11:00
parent 02f90c0001
commit 84334bde01
4 changed files with 20 additions and 4 deletions

View File

@@ -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);

View File

@@ -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 */