From 219e2f976d077c16c28d72a2f6763c01230c5bf8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Mar 2019 20:33:57 +1100 Subject: Tool System: use set/add/subtract for all box select operators --- source/blender/editors/space_nla/nla_select.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/space_nla/nla_select.c') diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 0c9cd069265..f326637f1cd 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -284,29 +284,21 @@ static int nlaedit_box_select_exec(bContext *C, wmOperator *op) { bAnimContext ac; rcti rect; - short mode = 0, selectmode = 0; - const bool select = !RNA_boolean_get(op->ptr, "deselect"); - const bool extend = RNA_boolean_get(op->ptr, "extend"); + short mode = 0; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - /* clear all selection if not extending selection */ - if (!extend) { + const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); + const int selectmode = (sel_op != SEL_OP_SUB) ? SELECT_ADD : SELECT_SUBTRACT; + if (SEL_OP_USE_PRE_DESELECT(sel_op)) { deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT); } /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); - if (select) { - selectmode = SELECT_ADD; - } - else { - selectmode = SELECT_SUBTRACT; - } - /* selection 'mode' depends on whether box_select region only matters on one axis */ if (RNA_boolean_get(op->ptr, "axis_range")) { /* mode depends on which axis of the range is larger to determine which axis to use @@ -349,10 +341,11 @@ void NLA_OT_select_box(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* rna */ - WM_operator_properties_gesture_box_select(ot); - + /* properties */ RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); + + WM_operator_properties_gesture_box(ot); + WM_operator_properties_select_operation_simple(ot); } /* ******************** Select Left/Right Operator ************************* */ -- cgit v1.2.3