diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_select.c | 22 |
2 files changed, 20 insertions, 3 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 708682cd04f..5f525bf913c 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -191,6 +191,7 @@ enum { SEQ_SELECT_LR_MOUSE, SEQ_SELECT_LR_LEFT, SEQ_SELECT_LR_RIGHT, + SEQ_SELECT_LR_UNDER_PLAYHEAD, }; /* Defines used internally. */ 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; |