diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-13 17:55:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-13 17:55:04 +0300 |
commit | e7b380331735d566889a2e7c12fce55d7c4cf8ec (patch) | |
tree | fe6e4a4a45084e8aec5ce92dab459a9bd7d92bd8 /source/blender | |
parent | b16bf6da80e094cec38384ec5ca877559d1fa9bf (diff) |
Allow spin/screw to run outside 3D view
This lets scripts call them
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/mesh/editmesh_extrude.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index c4f2537eb59..a020fed0835 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -701,6 +701,11 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) angle = -angle; dupli = RNA_boolean_get(op->ptr, "dupli"); + if (is_zero_v3(axis)) { + BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis"); + return OPERATOR_CANCELLED; + } + /* keep the values in worldspace since we're passing the obmat */ if (!EDBM_op_init(em, &spinop, op, "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b", @@ -745,7 +750,7 @@ void MESH_OT_spin(wmOperatorType *ot) /* api callbacks */ ot->invoke = edbm_spin_invoke; ot->exec = edbm_spin_exec; - ot->poll = EDBM_view3d_poll; + ot->poll = ED_operator_editmesh; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -782,6 +787,11 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); + if (is_zero_v3(axis)) { + BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis"); + return OPERATOR_CANCELLED; + } + /* find two vertices with valence count == 1, more or less is wrong */ v1 = NULL; v2 = NULL; @@ -865,7 +875,7 @@ void MESH_OT_screw(wmOperatorType *ot) /* api callbacks */ ot->invoke = edbm_screw_invoke; ot->exec = edbm_screw_exec; - ot->poll = EDBM_view3d_poll; + ot->poll = ED_operator_editmesh; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |