diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-30 16:48:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-30 16:48:39 +0400 |
commit | de8dbe36a070fc2aae2cb5c88e3b0181773cb7bf (patch) | |
tree | 29bffe66788d75191a9f0656a257352b5ab6257b | |
parent | 658e72f47d6299b8009a04b8aa40ecf95f69bd96 (diff) |
execute bisect immediately (without starting modal input) if the plane is already set or if there is no 3d view available.
-rw-r--r-- | source/blender/editors/mesh/editmesh_bisect.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); |