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_graph/graph_select.c | 30 ++++++++--------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'source/blender/editors/space_graph/graph_select.c') diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 3c3bd760a72..0ff36c407d7 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -339,31 +339,20 @@ static int graphkeys_box_select_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; rctf rect_fl; - short mode = 0, selectmode = 0; - bool incl_handles; - 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_graph_keys(&ac, 1, SELECT_SUBTRACT, true); - - /* get select mode - * - 'include_handles' from the operator specifies whether to include handles in the selection - */ - if (select) { - selectmode = SELECT_ADD; - } - else { - selectmode = SELECT_SUBTRACT; } - incl_handles = RNA_boolean_get(op->ptr, "include_handles"); + /* 'include_handles' from the operator specifies whether to include handles in the selection. */ + const bool incl_handles = RNA_boolean_get(op->ptr, "include_handles"); /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); @@ -412,11 +401,12 @@ void GRAPH_OT_select_box(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* rna */ - WM_operator_properties_gesture_box_select(ot); - + /* properties */ ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria"); + + WM_operator_properties_gesture_box(ot); + WM_operator_properties_select_operation_simple(ot); } -- cgit v1.2.3