execute bisect immediately (without starting modal input) if the plane is already set or if there is no 3d view available.

This commit is contained in:
Campbell Barton
2013-08-30 12:48:39 +00:00
parent 658e72f47d
commit de8dbe36a0

View File

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