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:
authorPeter Fog <tintwotin>2020-06-01 05:14:54 +0300
committerRichard Antalik <richardantalik@gmail.com>2020-06-01 05:39:40 +0300
commit95e3356a2760fc90c161f2e1e21d3dd25734ce40 (patch)
tree716459f6b261febb27676c8a0210b476796c6773 /source/blender/editors/space_sequencer/sequencer_select.c
parentd0e028a78e1caacbe473ba3688f14d474c941005 (diff)
VSE: Add select under playhead, and shortcuts for left, right, under.
Add `UNDER` option for `left_right` property of `sequencer.select` operator. Add Equal as shortcut for select under playhead, and move Insert Gaps to backspace + ctrl. Add extend shortcut for left, right under options. The function is added to Select > Playhead menu. Reviewed By: ISS Differential Revision: https://developer.blender.org/D7679
Diffstat (limited to 'source/blender/editors/space_sequencer/sequencer_select.c')
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index c5472ed88e5..bf5d788464c 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -412,6 +412,7 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
ret_value = OPERATOR_FINISHED;
}
+ /* Select left, right or under playhead. */
else if (left_right != SEQ_SELECT_LR_NONE) {
/* Use different logic for this. */
float x;
@@ -421,19 +422,33 @@ static int sequencer_select_exec(bContext *C, wmOperator *op)
switch (left_right) {
case SEQ_SELECT_LR_MOUSE:
+ /* 10px margin around playhead to select under playhead with mouse. */
+ float margin = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask) * 10;
x = UI_view2d_region_to_view_x(v2d, mval[0]);
+ if (x >= CFRA - margin && x <= CFRA + margin) {
+ x = CFRA;
+ }
break;
case SEQ_SELECT_LR_LEFT:
x = CFRA - 1.0f;
break;
case SEQ_SELECT_LR_RIGHT:
+ x = CFRA + 1.0f;
+ break;
+ case SEQ_SELECT_LR_UNDER_PLAYHEAD:
default:
x = CFRA;
break;
}
SEQP_BEGIN (ed, seq) {
- if (((x < CFRA) && (seq->enddisp <= CFRA)) || ((x >= CFRA) && (seq->startdisp >= CFRA))) {
+ /* Select under playhead. */
+ if ((x == CFRA) && (seq->startdisp <= CFRA) && (seq->enddisp >= CFRA)) {
+ seq->flag = SELECT;
+ recurs_sel_seq(seq);
+ }
+ /* Select left or right. */
+ else if ((x < CFRA && seq->enddisp <= CFRA) || (x > CFRA && seq->startdisp >= CFRA)) {
seq->flag |= SELECT;
recurs_sel_seq(seq);
}
@@ -627,8 +642,9 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
static const EnumPropertyItem sequencer_select_left_right_types[] = {
{SEQ_SELECT_LR_NONE, "NONE", 0, "None", "Don't do left-right selection"},
{SEQ_SELECT_LR_MOUSE, "MOUSE", 0, "Mouse", "Use mouse position for selection"},
- {SEQ_SELECT_LR_LEFT, "LEFT", 0, "Left", "Select left"},
- {SEQ_SELECT_LR_RIGHT, "RIGHT", 0, "Right", "Select right"},
+ {SEQ_SELECT_LR_LEFT, "LEFT", 0, "Left", "Select to the left of the playhead"},
+ {SEQ_SELECT_LR_RIGHT, "RIGHT", 0, "Right", "Select to the right of the playhead"},
+ {SEQ_SELECT_LR_UNDER_PLAYHEAD, "UNDER", 0, "Under", "Select under the playhead"},
{0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;