Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Antalik <richardantalik@gmail.com>2020-02-09 19:59:13 +0300
committerRichard Antalik <richardantalik@gmail.com>2020-02-09 19:59:13 +0300
commit5314161491d41461fe09c4774229481dde93e250 (patch)
treeaf529b82a8c31117c2bc68c728e7dcec812e8b86 /source/blender/editors/space_sequencer/sequencer_select.c
parentf780057d52c1e5b76cd2a5d8b7c577db2374c95c (diff)
VSE: Add option to select handles with box selection
Patch adds an "Handle" option to the `SEQUENCER_OT_box_select` operator, that allows to select the handles instead of whole strips. Feature is mapped to Alt key modifier A difference from the proposed design in T70730 is that covering the entire strip with the box actually selects both handles. Reviewed By: iss Differential Revision: https://developer.blender.org/D6372
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_select.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c52
1 files changed, 47 insertions, 5 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a5bb66ca65f..bf06fa768ca 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -1018,15 +1018,17 @@ void SEQUENCER_OT_select_side(wmOperatorType *ot)
static int sequencer_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
+ View2D *v2d = UI_view2d_fromcontext(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
+
if (ed == NULL) {
return OPERATOR_CANCELLED;
}
- View2D *v2d = UI_view2d_fromcontext(C);
-
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
+ const bool handles = RNA_boolean_get(op->ptr, "handles");
const bool select = (sel_op != SEL_OP_SUB);
+
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
ED_sequencer_deselect_all(scene);
}
@@ -1039,8 +1041,44 @@ static int sequencer_box_select_exec(bContext *C, wmOperator *op)
rctf rq;
seq_rectf(seq, &rq);
if (BLI_rctf_isect(&rq, &rectf, NULL)) {
- SET_FLAG_FROM_TEST(seq->flag, select, SELECT);
- recurs_sel_seq(seq);
+ if (handles) {
+ /* Get the handles draw size. */
+ float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
+ float handsize = sequence_handle_size_get_clamped(seq, pixelx) * 0.75f;
+
+ /* Right handle. */
+ if (rectf.xmax > (seq->enddisp - handsize)) {
+ if (select) {
+ seq->flag |= SELECT | SEQ_RIGHTSEL;
+ }
+ else {
+ /* Deselect the strip if it's left with no handles selected. */
+ if ((seq->flag & SEQ_RIGHTSEL) && ((seq->flag & SEQ_LEFTSEL) == 0)) {
+ seq->flag &= ~SELECT;
+ }
+ seq->flag &= ~SEQ_RIGHTSEL;
+ }
+ }
+ /* Left handle. */
+ if (rectf.xmin < (seq->startdisp + handsize)) {
+ if (select) {
+ seq->flag |= SELECT | SEQ_LEFTSEL;
+ }
+ else {
+ /* Deselect the strip if it's left with no handles selected. */
+ if ((seq->flag & SEQ_LEFTSEL) && ((seq->flag & SEQ_RIGHTSEL) == 0)) {
+ seq->flag &= ~SELECT;
+ }
+ seq->flag &= ~SEQ_LEFTSEL;
+ }
+ }
+ }
+
+ /* Regular box selection. */
+ else {
+ SET_FLAG_FROM_TEST(seq->flag, select, SELECT);
+ seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
+ }
}
}
@@ -1072,6 +1110,8 @@ static int sequencer_box_select_invoke(bContext *C, wmOperator *op, const wmEven
void SEQUENCER_OT_select_box(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name = "Box Select";
ot->idname = "SEQUENCER_OT_select_box";
@@ -1092,9 +1132,11 @@ void SEQUENCER_OT_select_box(wmOperatorType *ot)
WM_operator_properties_gesture_box(ot);
WM_operator_properties_select_operation_simple(ot);
- PropertyRNA *prop = RNA_def_boolean(
+ prop = RNA_def_boolean(
ot->srna, "tweak", 0, "Tweak", "Operator has been activated using a tweak event");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "handles", 0, "Select Handles", "Select the strips' handles");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/* ****** Selected Grouped ****** */