Fix keyframe rounding issue

This commit is contained in:
JannisX11 2021-02-16 23:30:33 +01:00
parent d1684d8fb3
commit 8c4e191e63
2 changed files with 10 additions and 8 deletions

View File

@ -816,7 +816,7 @@ class BoneAnimator extends GeneralAnimator {
}
return this;
}
fillValues(keyframe, values, allow_expression) {
fillValues(keyframe, values, allow_expression, round = true) {
if (values instanceof Array) {
keyframe.extend({
@ -840,12 +840,14 @@ class BoneAnimator extends GeneralAnimator {
var ref = this.interpolate(keyframe.channel, allow_expression)
Timeline.time = original_time;
if (ref) {
let e = 1e2
ref.forEach((r, i) => {
if (!isNaN(r)) {
ref[i] = Math.round(parseFloat(r)*e)/e
}
})
if (round) {
let e = keyframe.channel == 'scale' ? 1e4 : 1e2
ref.forEach((r, i) => {
if (!isNaN(r)) {
ref[i] = Math.round(parseFloat(r)*e)/e
}
})
}
keyframe.extend({
data_points: [{
x: ref[0],

View File

@ -652,7 +652,7 @@ BARS.defineActions(function() {
Timeline.selected.forEach((kf) => {
if (kf.animator.fillValues) {
Timeline.time = kf.time;
kf.animator.fillValues(kf, null, false);
kf.animator.fillValues(kf, null, false, false);
}
})
Timeline.time = time_before;