diff options
Diffstat (limited to 'source/blender/editors/space_nla/nla_select.c')
-rw-r--r-- | source/blender/editors/space_nla/nla_select.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 8261397c940..e09e4417d5d 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -278,25 +278,28 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op) bAnimContext ac; rcti rect; short mode = 0, selectmode = 0; - int extend; + const bool select = !RNA_boolean_get(op->ptr, "deselect"); + const bool extend = RNA_boolean_get(op->ptr, "extend"); /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; /* clear all selection if not extending selection */ - extend = RNA_boolean_get(op->ptr, "extend"); - if (!extend) + if (!extend) { deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT); + } /* get settings from operator */ WM_operator_properties_border_to_rcti(op, &rect); - - if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT) + + if (select) { selectmode = SELECT_ADD; - else + } + else { selectmode = SELECT_SUBTRACT; - + } + /* selection 'mode' depends on whether borderselect 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 @@ -329,10 +332,10 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->description = "Use box selection to grab NLA-Strips"; /* api callbacks */ - ot->invoke = WM_border_select_invoke; + ot->invoke = WM_gesture_border_invoke; ot->exec = nlaedit_borderselect_exec; - ot->modal = WM_border_select_modal; - ot->cancel = WM_border_select_cancel; + ot->modal = WM_gesture_border_modal; + ot->cancel = WM_gesture_border_cancel; ot->poll = nlaop_poll_tweakmode_off; @@ -340,7 +343,7 @@ void NLA_OT_select_border(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* rna */ - WM_operator_properties_gesture_border(ot, 1); + WM_operator_properties_gesture_border_select(ot); RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", ""); } @@ -349,7 +352,7 @@ void NLA_OT_select_border(wmOperatorType *ot) /* Select keyframes left/right of the current frame indicator */ /* defines for left-right select tool */ -static EnumPropertyItem prop_nlaedit_leftright_select_types[] = { +static const EnumPropertyItem prop_nlaedit_leftright_select_types[] = { {NLAEDIT_LRSEL_TEST, "CHECK", 0, "Check if Select Left or Right", ""}, {NLAEDIT_LRSEL_LEFT, "LEFT", 0, "Before current frame", ""}, {NLAEDIT_LRSEL_RIGHT, "RIGHT", 0, "After current frame", ""}, @@ -441,7 +444,8 @@ static int nlaedit_select_leftright_exec(bContext *C, wmOperator *op) nlaedit_select_leftright(C, &ac, leftright, selectmode); /* set notifier that keyframe selection (and channels too) have changed */ - WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | ND_ANIMCHAN | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL); return OPERATOR_FINISHED; } |