Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.c
| Show First 20 Lines • Show All 8,771 Lines • ▼ Show 20 Lines | static void applyTimeTranslateValue(TransInfo *t, float value) | ||||
| float deltax, val /* , valprev */; | float deltax, val /* , valprev */; | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| TransData *td = tc->data; | TransData *td = tc->data; | ||||
| TransData2D *td2d = tc->data_2d; | TransData2D *td2d = tc->data_2d; | ||||
| /* 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 (i = 0; i < tc->data_len; i++, td++, td2d++) { | for (i = 0; i < tc->data_len; i++, td++, td2d++) { | ||||
| /* it is assumed that td->extra is a pointer to the AnimData, | /* It is assumed that td->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) | |||||
| */ | */ | ||||
| AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; | AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL; | ||||
| /* valprev = *td->val; */ /* UNUSED */ | /* valprev = *td->val; */ /* UNUSED */ | ||||
| /* check if any need to apply nla-mapping */ | /* check if any need to apply nla-mapping */ | ||||
| if (adt && (t->spacetype != SPACE_SEQ)) { | if (adt && (t->spacetype != SPACE_SEQ)) { | ||||
| deltax = value; | deltax = value; | ||||
| Show All 14 Lines | for (i = 0; i < tc->data_len; i++, td++, td2d++) { | ||||
| if (autosnap == SACTSNAP_TSTEP) { | if (autosnap == SACTSNAP_TSTEP) { | ||||
| val = (float)(floor(((double)deltax / secf) + 0.5) * secf); | val = (float)(floor(((double)deltax / secf) + 0.5) * secf); | ||||
| } | } | ||||
| else if (autosnap == SACTSNAP_STEP) { | else if (autosnap == SACTSNAP_STEP) { | ||||
| val = floorf(val + 0.5f); | val = floorf(val + 0.5f); | ||||
| } | } | ||||
| *(td->val) = td->ival + val; | *(td->val) = td->ival + val * td->factor; | ||||
| } | } | ||||
| /* apply nearest snapping */ | /* apply nearest snapping */ | ||||
| doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap); | doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 360 Lines • Show Last 20 Lines | |||||