-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix discrepency between ids and names in AnimationCollection #5815
Conversation
@lilleyse, thanks for the pull request! Maintainers, we have a signed CLA from @lilleyse, so you can review this at any time. I noticed that CHANGES.md has not been updated. If this change updates the public API in any way, fixes a bug, or makes any non-trivial update, please add a bullet point to I am a bot who helps you make Cesium awesome! Thanks again. |
In the long term in would be better if the |
@lilleyse What's a good way to test this? Is the animated aircraft model sufficient? |
Sure, any animated model will work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks @lilleyse !
This appears to be a breaking change, as specifying the index no longer works. The name is required now. |
Also note that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For backwards compatibility, name
must accept either an index or a name. Previously, this field only accepted an index, in spite of its name. Some models, such as "BrainStem", don't name their animations, as names are optional.
Specifying the index only worked by accident, which was more of a bug from the 1.0-2.0 transition. For glTF 1.0 it expected the I also thought about overloading |
This change does break code that @hpinkos recently merged into another project. Agreed that it was only working "by accident" and probably only for 2 releases or so. But to be clear, with this change there is no way to individually toggle the animations in the BrainStem model (which incidentally shouldn't be using individual animations, but that's beside the point, the point is that animations don't require names anymore in glTF 2.0, only indicies). |
I guess what I mean is apps built before 1.36 shouldn't be broken, but anything after that passes in [EDIT: saw your updated comment, I think we agree] I'm alright with the overloaded behavior, I'll make that change in a bit. |
I'm OK if you don't want to overload, and make the index a separate parameter. It doesn't break any old code, only new code. But some sort of option for specifying the index is required, because glTF models no longer require names. |
a9ebe85
to
3a06502
Compare
@emackey please merge when ready. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks. Tests pass, and I confirmed that both new options work as intended. I tried each option on Cesium Air (glTF 1.0), BrainStem (glTF 2.0 without names), and AnimatedMorphSphere (glTF 2.0 with names).
Only wrinkle is, Cesium allows you to specify both an index and a name in the same call. When this is done, the index "wins" over the name, but it works fine. Is this behavior OK? I'm OK with everything else. Thanks!
# Conflicts: # CHANGES.md
Congratulations on closing the issue! I found these Cesium forum links in the comments above: https://groups.google.com/forum/#!topic/cesium-dev/XDhrq2ejwR4 If this issue affects any of these threads, please post a comment like the following:
I am a bot who helps you make Cesium awesome! Thanks again. |
Bug brought up on the forum: https://groups.google.com/forum/#!topic/cesium-dev/XDhrq2ejwR4
ModelAnimationCollection.add
expectsoptions.name
to be an animation name, but with the switch to glTF 2 the function only worked ifoptions.name
was the array index. The changes here add back support for adding animations byname
and not index. Part of this was cleaning up other areas of the animation code that were still stuck in the glTF 1.0 mindset.