Fix T94191: correct (time) translation headers not showing DeltaX
Caused by {rBb0d9e6797fb8} For the header (both Graph Editor case in general `headerTranslation` as well as `headerTimeTranslate`) we are interested in deltas values (not absolute values). Since culprit commit, `snapFrameTransform` was not working with deltas anymore, but we have to compensate for this. For the Graph Editor, this only worked "by accident" in rB7192e57d63a5, since `ival` is still zero at this point. So now, reacquire the delta right after the snap operation. Also use a more appropriate center value in the translate operator. Maniphest Tasks: T94191 Differential Revision: https://developer.blender.org/D13641
This commit is contained in:
parent
aa7105f759
commit
6db0919724
Notes:
blender-bot
2023-02-13 16:59:22 +01:00
Referenced by issue #94191, DeltaX does not show how many frames you are moving your keyframes Referenced by issue #93930, Dope Sheet shows absolute keyframe translation instead of delta Referenced by issue #93479, 3.0 Potential candidates for corrective releases
|
@ -62,27 +62,28 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR])
|
|||
float ival = TRANS_DATA_CONTAINER_FIRST_OK(t)->data->ival;
|
||||
float val = ival + t->values_final[0];
|
||||
|
||||
float snap_val = val;
|
||||
snapFrameTransform(t, autosnap, ival, val, &snap_val);
|
||||
snapFrameTransform(t, autosnap, ival, val, &val);
|
||||
float delta_x = val - ival;
|
||||
|
||||
if (ELEM(autosnap, SACTSNAP_SECOND, SACTSNAP_TSTEP)) {
|
||||
/* Convert to seconds. */
|
||||
const Scene *scene = t->scene;
|
||||
const double secf = FPS;
|
||||
snap_val /= secf;
|
||||
delta_x /= secf;
|
||||
val /= secf;
|
||||
}
|
||||
|
||||
if (autosnap == SACTSNAP_FRAME) {
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.2f (%.4f)", snap_val, val);
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.2f (%.4f)", delta_x, val);
|
||||
}
|
||||
else if (autosnap == SACTSNAP_SECOND) {
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.2f sec (%.4f)", snap_val, val);
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.2f sec (%.4f)", delta_x, val);
|
||||
}
|
||||
else if (autosnap == SACTSNAP_TSTEP) {
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f sec", snap_val);
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f sec", delta_x);
|
||||
}
|
||||
else {
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", snap_val);
|
||||
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", delta_x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,11 +225,12 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_
|
|||
if (t->spacetype == SPACE_GRAPH) {
|
||||
/* WORKAROUND:
|
||||
* Special case where snapping is done in #recalData.
|
||||
* Update the header based on the first element. */
|
||||
* Update the header based on the #center_local. */
|
||||
const short autosnap = getAnimEdit_SnapMode(t);
|
||||
float ival = TRANS_DATA_CONTAINER_FIRST_OK(t)->data->ival;
|
||||
float ival = TRANS_DATA_CONTAINER_FIRST_OK(t)->center_local[0];
|
||||
float val = ival + dvec[0];
|
||||
snapFrameTransform(t, autosnap, ival, val, &dvec[0]);
|
||||
snapFrameTransform(t, autosnap, ival, val, &val);
|
||||
dvec[0] = val - ival;
|
||||
}
|
||||
|
||||
if (t->con.mode & CON_APPLY) {
|
||||
|
|
Loading…
Reference in New Issue