Skip to content
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

Fixed error when nodeCommands[0] is undefined in Model.updateColor() #9271

Merged
merged 2 commits into from
Dec 20, 2020

Conversation

KeyboardSounds
Copy link
Contributor

@KeyboardSounds KeyboardSounds commented Dec 8, 2020

Fixes #9273
Fixes #8394
Fixes #9278

Model.js was missing code to handle the case in updateColor where nodeCommands.length == 0.


Background

For some reason that I ran out of time to diagnose, this PR to TerriaJS is hitting a case where nodeCommands[0] in Model.updateColor() is undefined. This seems like something that shouldn't happen, but this PR stops Cesium from throwing an error and doesn't seem to have any negative consequences.

@cesium-concierge
Copy link

Thanks for the pull request @KeyboardSounds!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@lilleyse
Copy link
Contributor

lilleyse commented Dec 8, 2020

Thanks @KeyboardSounds! Could you also add the same fix to updateBackFaceCulling and updateSilhouette and update CHANGES.md?

@KeyboardSounds
Copy link
Contributor Author

Done :)

@lilleyse
Copy link
Contributor

Thanks, I'll review soon so we can get this in the next release.

Also CC #9278 - a related bug report that should be fixed by this PR.

@lilleyse
Copy link
Contributor

I'm not able to reproduce the bug even with the multiple issues open #9273 #8394 #9278 which has made it a little hard to debug why it's happening.

updateColor, updateBackFaceCulling, and updateSilhouette should only get called if the model is loaded, meaning its node commands should have already been created. In #8394 @verybigzhouhai mentioned that the glTF had a mesh with no primitives which explains why nodeCommands would be empty, though I don't think this would be a valid glTF. But this doesn't seem to always be the cause because the tileset in #9278 passes the glTF validator (via the 3D Tiles validator), so maybe something else is going on.

Still, it's a good fix and I'm happy with with merging it. Thanks @KeyboardSounds!

@lilleyse lilleyse merged commit a3ef9de into CesiumGS:master Dec 20, 2020
@tephenavies tephenavies deleted the node-commands-undefined2 branch October 24, 2022 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants