Wes Library: Track editing issues

Hi @sgold

In Wes library the TrackEdit.simplify() does not take the floating point issue into consideration.

What about letting the user specify a tolerance to be used at this check? (or just use a default epsilon)

As an example, these are the scale values from a transform track I got from an animated Gltf model which can not be simplified by TrackEdit.simplify().

[(1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001), (1.0000001, 1.0, 1.0000001)]

,

[(0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999), (0.9999999, 0.9999998, 0.9999999)]
2 Likes

I’ll look into this issue. It should be an easy one for me to address.

2 Likes

Thank you. :slightly_smiling_face:

1 Like

I added a method (for the new animation system with JME v3.4) and cut a new release:

repositories {
    mavenCentral()
}
dependencies {
    compile 'com.github.stephengold:Wes:0.6.4+for34'
}

I hope it meets your need.

1 Like

Thanks, updated to the new version.

1 Like

Noticed a new issue.

With TrackEdit.truncate().

It always adds an extra keyframe to the end of the track, however, there should be an exception to this.

If the endTime equals the lastFrame time then it should just overwrite it and do not add a new frame, otherwise, the generated track will have repeated keyframes. (at the end frame and its previous frame).

My suggestion would be to change this

int newCount = 2 + lastFrame;

to something like

boolean overwriteLastFrame = oldTimes[lastFrame] == endTime;
int newCount = overwriteLastFrame ? 1 + lastFrame : 2 + lastFrame;

Edit:
and

to

int frameIndex = overwriteLastFrame ? lastFrame : lastFrame + 1;

Edit2:
And please let me know if you want me to submit a PR.

1 Like

Don’t need a PR, thanks, but a GitHub issue would be welcome.

Also, I’m curious what you’re using Wes for. Knowing this might help me plan future releases.

1 Like

I am using it within my asset conversion pipeline (powered by JmeConvert) to convert from gltf to j3o.

My current use-cases are:

  • Keyframe reduction

  • Splitting anim clips (some of the models I use have all animations in a single track which I need to split them and doing this in blender is a bit time consuming so I prefer to do it in a script)

1 Like

Submitted an issue

1 Like

Thanks. This is fixed in 0.6.5+for34.

1 Like

Since JME v3.4 allows a TransformTrack without translations and/or rotations, I’m updating the Wes library to handle such tracks.

Would it cause issues for you if I changed the semantics of TrackEdit.simplify() to delete the translation and/or rotation components as well, when they’re all identities (or approximate identities)?

2 Likes

No, it won’t be an issue for me.

Thanks for asking :slightly_smiling_face:

1 Like