diff options
author | Richard Antalik <richardantalik@gmail.com> | 2021-06-29 21:12:19 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2021-06-29 21:30:31 +0300 |
commit | fba9cd019f21f29bad1a6f3713370c5172dbc97f (patch) | |
tree | 5c42ca8e6f4d2f7051088306e99676d7e8b47b7b /source/blender/editors/transform/transform_mode_edge_seq_slide.c | |
parent | ea43ae4194e293599997f1d0d47430b462b4fd7f (diff) |
VSE: Improved Snapping
Change snapping behavior to snap strip edges when they are close to snap point.
Default behavior is, that each transformed strip is snapped to any other strip.
Implement snapping controls in sequencer tool settings. These controls include:
- Snapping on/off
- Ability to snap to playhead and strip hold offset points
- Filter snap points by excluding sound or muted strips
- Control snapping distance
Snapping controls are placed in timeline header similar to 3D viewport
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D11646
Diffstat (limited to 'source/blender/editors/transform/transform_mode_edge_seq_slide.c')
-rw-r--r-- | source/blender/editors/transform/transform_mode_edge_seq_slide.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/editors/transform/transform_mode_edge_seq_slide.c b/source/blender/editors/transform/transform_mode_edge_seq_slide.c index 7e7b79c9f90..1b054696930 100644 --- a/source/blender/editors/transform/transform_mode_edge_seq_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_seq_slide.c @@ -23,8 +23,10 @@ #include <stdlib.h> +#include "MEM_guardedalloc.h" + +#include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_string.h" #include "BKE_context.h" #include "BKE_unit.h" @@ -37,6 +39,10 @@ #include "UI_interface.h" #include "UI_view2d.h" +#include "SEQ_iterator.h" +#include "SEQ_sequencer.h" +#include "SEQ_time.h" + #include "BLT_translation.h" #include "transform.h" @@ -102,13 +108,11 @@ static void applySeqSlideValue(TransInfo *t, const float val[2]) } } -static void applySeqSlide(TransInfo *t, const int mval[2]) +static void applySeqSlide(TransInfo *t, const int UNUSED(mval[2])) { char str[UI_MAX_DRAW_STR]; float values_final[3] = {0.0f}; - snapSequenceBounds(t, mval); - transform_convert_sequencer_channel_clamp(t); if (applyNumInput(&t->num, values_final)) { if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_AXIS0) { @@ -119,11 +123,14 @@ static void applySeqSlide(TransInfo *t, const int mval[2]) } } } - else if (t->con.mode & CON_APPLY) { - t->con.applyVec(t, NULL, NULL, t->values, values_final); - } else { copy_v2_v2(values_final, t->values); + applySnapping(t, values_final); + transform_convert_sequencer_channel_clamp(t, values_final); + + if (t->con.mode & CON_APPLY) { + t->con.applyVec(t, NULL, NULL, t->values, values_final); + } } values_final[0] = floorf(values_final[0] + 0.5f); @@ -164,4 +171,5 @@ void initSeqSlide(TransInfo *t) t->custom.mode.data = (void *)WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE); } } + /** \} */ |