diff options
Diffstat (limited to 'source/blender/editors/transform/transform_snap.c')
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 92c9c55ac64..4a2927ace00 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -59,6 +59,7 @@ #include "BKE_anim.h" /* for duplis */ #include "BKE_context.h" #include "BKE_editmesh.h" +#include "BKE_sequencer.h" #include "BKE_main.h" #include "BKE_tracking.h" @@ -2430,6 +2431,27 @@ void snapGridIncrement(TransInfo *t, float *val) snapGridIncrementAction(t, val, action); } +int snapSequenceBounds(TransInfo *t, const int mval[2]) +{ + float xmouse, ymouse; + int frame; + int mframe; + TransSeq *ts = t->customData; + /* reuse increment, strictly speaking could be another snap mode, but leave as is */ + if (!(t->modifiers & MOD_SNAP_INVERT)) + return 0; + + /* convert to frame range */ + UI_view2d_region_to_view(&t->ar->v2d, mval[0], mval[1], &xmouse, &ymouse); + mframe = iroundf(xmouse); + /* now find the closest sequence */ + frame = BKE_sequencer_find_next_prev_edit(t->scene, mframe, SEQ_SIDE_BOTH, true, false, true); + + if (!ts->snap_left) + frame = frame - (ts->max - ts->min); + + return frame; +} static void applyGridIncrement(TransInfo *t, float *val, int max_index, const float fac[3], GearsType action) { |