From de8dbe36a070fc2aae2cb5c88e3b0181773cb7bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 30 Aug 2013 12:48:39 +0000 Subject: execute bisect immediately (without starting modal input) if the plane is already set or if there is no 3d view available. --- source/blender/editors/mesh/editmesh_bisect.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index 79b49fa38da..6a751a500ba 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -50,7 +50,7 @@ #include "mesh_intern.h" /* own include */ - +static int mesh_bisect_exec(bContext *C, wmOperator *op); /* -------------------------------------------------------------------- */ /* Model Helpers */ @@ -94,6 +94,7 @@ static bool mesh_bisect_interactive_calc( /* cross both to get a normal */ cross_v3_v3v3(plane_no, co_a, co_b); + normalize_v3(plane_no); /* not needed but nicer for user */ /* point on plane, can use either start or endpoint */ ED_view3d_win_to_3d(ar, co_ref, co_a_ss, plane_co); @@ -110,6 +111,16 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event) { int ret; + /* if the properties are set or there is no rv3d, + * skip model and exec immediately */ + + if ((CTX_wm_region_view3d(C) == NULL) || + (RNA_struct_property_is_set(op->ptr, "plane_co") && + RNA_struct_property_is_set(op->ptr, "plane_no"))) + { + return mesh_bisect_exec(C, op); + } + ret = WM_gesture_straightline_invoke(C, op, event); if (ret & OPERATOR_RUNNING_MODAL) { View3D *v3d = CTX_wm_view3d(C); -- cgit v1.2.3