Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_edge_seq_slide.c
| Show All 29 Lines | |||||
| #include "BKE_unit.h" | #include "BKE_unit.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | |||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_convert.h" | |||||
| #include "transform_mode.h" | #include "transform_mode.h" | ||||
| #include "transform_snap.h" | #include "transform_snap.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Transform (Sequencer Slide) | /** \name Transform (Sequencer Slide) | ||||
| * \{ */ | * \{ */ | ||||
| static eRedrawFlag seq_slide_handleEvent(struct TransInfo *t, const wmEvent *event) | static eRedrawFlag seq_slide_handleEvent(struct TransInfo *t, const wmEvent *event) | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | for (i = 0; i < tc->data_len; i++, td++) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| madd_v2_v2v2fl(td->loc, td->iloc, val, td->factor); | madd_v2_v2v2fl(td->loc, td->iloc, val, td->factor); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void applyChannelBounds(TransInfo *t) | |||||
| { | |||||
| const int channel_offset = round_fl_to_int(t->values[1]); | |||||
| const int *selection_channel_range = transform_convert_sequencer_get_selection_channel_range(t); | |||||
| const int min_channel_after_transform = selection_channel_range[0] + channel_offset; | |||||
| const int max_channel_after_transform = selection_channel_range[1] + channel_offset; | |||||
| if (max_channel_after_transform > MAXSEQ) { | |||||
| t->values[1] -= max_channel_after_transform - MAXSEQ; | |||||
| } | |||||
| if (min_channel_after_transform < 1) { | |||||
| t->values[1] -= min_channel_after_transform - 1; | |||||
| } | |||||
| } | |||||
| static void applySeqSlide(TransInfo *t, const int mval[2]) | static void applySeqSlide(TransInfo *t, const int mval[2]) | ||||
| { | { | ||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| float values_final[3] = {0.0f}; | float values_final[3] = {0.0f}; | ||||
| snapSequenceBounds(t, mval); | snapSequenceBounds(t, mval); | ||||
| applyChannelBounds(t); | |||||
| if (applyNumInput(&t->num, values_final)) { | if (applyNumInput(&t->num, values_final)) { | ||||
| if (t->con.mode & CON_APPLY) { | if (t->con.mode & CON_APPLY) { | ||||
| if (t->con.mode & CON_AXIS0) { | if (t->con.mode & CON_AXIS0) { | ||||
| mul_v2_v2fl(values_final, t->spacemtx[0], values_final[0]); | mul_v2_v2fl(values_final, t->spacemtx[0], values_final[0]); | ||||
| } | } | ||||
| else { | else { | ||||
| mul_v2_v2fl(values_final, t->spacemtx[1], values_final[0]); | mul_v2_v2fl(values_final, t->spacemtx[1], values_final[0]); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines | |||||