Skip to content

Conversation

@ianpurvis
Copy link
Contributor

Supports #19986


},

InterpolantFactoryMethodSmooth: undefined // not yet implemented
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this pattern where prototype methods are undefined to drive fallback logic in base KeyframeTrack. It feels kind of wrong to mutate the KeyframeTrack interface, although I guess if these can be considered internal it doesn't matter. No need to change now, just pointing it out as another candidate for some cleanup down the road.

Comment on lines +458 to 466
Object.assign( KeyframeTrack.prototype, {

TimeBufferType: Float32Array,

ValueBufferType: Float32Array,

DefaultInterpolation: InterpolateLinear,

} );
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debated whether or not to preserve these prototype properties. They should reduce memory footprint with a large number of animation tracks, though I don't know if that matters in real world usage. They seem better suited as static props than instance props? Anyways, let me know what direction is good and I can tweak this PR as needed.

Honestly, all of the inheritance doesn't seem that useful. In the long run maybe the track system could just be refactored with a more data-driven approach.

@DefinitelyMaybe DefinitelyMaybe mentioned this pull request Aug 5, 2020
43 tasks
@mrdoob mrdoob added this to the r121 milestone Aug 23, 2020
@mrdoob mrdoob modified the milestones: r121, r122 Sep 29, 2020
@mrdoob mrdoob modified the milestones: r122, r123 Oct 28, 2020
@mrdoob mrdoob modified the milestones: r123, r124 Nov 25, 2020
@mrdoob mrdoob modified the milestones: r124, r125 Dec 24, 2020
@mrdoob mrdoob modified the milestones: r125, r126 Jan 27, 2021
@mrdoob mrdoob merged commit 582df68 into mrdoob:dev Feb 17, 2021
@mrdoob
Copy link
Owner

mrdoob commented Feb 17, 2021

Thanks!

@mrdoob
Copy link
Owner

mrdoob commented Feb 17, 2021

Btw, seems like Object.assign() breaks tree-shaking in Rollup. I'll change them to individual *.prototype.* =.

@mrdoob
Copy link
Owner

mrdoob commented Feb 17, 2021

6100437

@ianpurvis ianpurvis deleted the animation-tracks-es6-classes branch February 17, 2021 22:12
@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 23, 2021

It seems this PR has broken KeyframeTrack serialization. This can easily be tested by drag'n'drop an animated asset into the editor and wait for the save.

https://raw.githack.com/mrdoob/three.js/dev/editor/index.html
https://github.com/mrdoob/three.js/blob/dev/examples/models/gltf/Flamingo.glb

The following runtime error occurs:

three.module.js:32997 Uncaught RangeError: Maximum call stack size exceeded

At this place:

const trackType = track.constructor;

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 23, 2021

Fiddle demonstrating the bug:

https://jsfiddle.net/th1m48a9/

@mrdoob Since the release is tomorrow, this is in some sense a blocker. If not fixed in time, it's better to revert this PR.

@ianpurvis
Copy link
Contributor Author

@Mugen87 Thanks for the bug report... I think this should be fixed in #21342.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants