Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_timetranslate.c
| Show All 34 Lines | |||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| #include "transform_data.h" | |||||
| #include "transform_mode.h" | #include "transform_mode.h" | ||||
| #include "transform_snap.h" | #include "transform_snap.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /* Transform (Animation Translation) */ | /* Transform (Animation Translation) */ | ||||
| /** \name Transform Animation Translation | /** \name Transform Animation Translation | ||||
| * \{ */ | * \{ */ | ||||
| Show All 36 Lines | static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR]) | ||||
| } | } | ||||
| } | } | ||||
| static void applyTimeTranslateValue(TransInfo *t, const float deltax) | static void applyTimeTranslateValue(TransInfo *t, const float deltax) | ||||
| { | { | ||||
| const short autosnap = getAnimEdit_SnapMode(t); | const short autosnap = getAnimEdit_SnapMode(t); | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | |||||
| TransData2D *td2d = tc->data_2d; | TransData2D *td2d = tc->data_2d; | ||||
| TransData *td = tc->data; | |||||
| /* It doesn't matter whether we apply to t->data or | /* It doesn't matter whether we apply to t->data or | ||||
| * t->data2d, but t->data2d is more convenient. */ | * t->data2d, but t->data2d is more convenient. */ | ||||
| for (int i = 0; i < tc->data_len; i++, td++, td2d++) { | for (int tdi = 0; tdi < tc->data_len; tdi++, td2d++) { | ||||
| /* It is assumed that td->extra is a pointer to the AnimData, | /* It is assumed that td->basic[tdi].extra is a pointer to the AnimData, | ||||
| * whose active action is where this keyframe comes from. | * whose active action is where this keyframe comes from. | ||||
| * (this is only valid when not in NLA) | * (this is only valid when not in NLA) | ||||
| * (also: masks and gpencil dont have animadata) | * (also: masks and gpencil dont have animadata) | ||||
| */ | */ | ||||
| AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; | AnimData *adt = (t->spacetype != SPACE_NLA) ? td->basic[tdi].extra : NULL; | ||||
| /* apply nearest snapping */ | /* apply nearest snapping */ | ||||
| *(td->val) = td->ival + deltax * td->factor; | *(td->special[tdi].val) = td->special[tdi].ival + deltax * td->prop[tdi].factor; | ||||
| doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap); | doAnimEdit_SnapFrame(t, td, tdi, td2d, adt, autosnap); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void applyTimeTranslate(TransInfo *t, const int mval[2]) | static void applyTimeTranslate(TransInfo *t, const int mval[2]) | ||||
| { | { | ||||
| View2D *v2d = (View2D *)t->view; | View2D *v2d = (View2D *)t->view; | ||||
| char str[UI_MAX_DRAW_STR]; | char str[UI_MAX_DRAW_STR]; | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||