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

Srwiseman 6272 fix #6305

Merged
merged 12 commits into from
Mar 8, 2018
Merged

Srwiseman 6272 fix #6305

merged 12 commits into from
Mar 8, 2018

Conversation

srwiseman
Copy link
Contributor

Fixes #6272.

This was a pretty basic fix, but it was causing me some issues since model.readyPromise evaluates within a loop. Therefore, if I tried to create a function like .otherwise(function() {...});, eslint would fail with 'no-loop-func'.

To solve this, I created a function checkModelLoad(). If this function determines the the model will not load, it sets a flag called loadFail within the model data. This flag is then checked when the boundingSphereState is evaluated.

@cesium-concierge
Copy link

Please sign the CLA before we review this PR.

Welcome to the Cesium community @srwiseman!

Can you please send in a Contributor License Agreement (CLA) so that we can review and merge this pull request?

⚠️ 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 CHANGES.md and comment on this pull request so we know it was updated. For more info, see the Pull Request Guidelines.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@pjcozzi
Copy link
Contributor

pjcozzi commented Mar 4, 2018

Thanks @srwiseman. We received your CLA.

@lilleyse can you review this when available?

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

Looks good @srwiseman.

@@ -327,6 +327,12 @@ define([
function onModelError(error) {
console.error(error);
}
function checkModelLoad(model, entity, modelHash){
model.readyPromise.otherwise(function(error){
onModelError(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's fine now to just copy the contents of onModelError into here and remove that function.

@@ -137,9 +134,12 @@ define([
url : resource.url,
animationsRunning : false,
nodeTransformationsScratch : {},
originalNodeMatrixHash : {}
originalNodeMatrixHash : {},
loadFail: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Small style tweak, add a space before the :

loadFail : false

@lilleyse
Copy link
Contributor

lilleyse commented Mar 5, 2018

Also add the fix to CHANGES.md.

@srwiseman
Copy link
Contributor Author

Thanks! If I have time, I'll make these changes this evening.

@srwiseman
Copy link
Contributor Author

@lilleyse Done!

@lilleyse
Copy link
Contributor

lilleyse commented Mar 8, 2018

Thanks @srwiseman.

@lilleyse lilleyse merged commit 61efcd9 into CesiumGS:master Mar 8, 2018
@mramato
Copy link
Contributor

mramato commented Mar 8, 2018

@lilleyse is there a reason we merged this without tests?

@lilleyse
Copy link
Contributor

lilleyse commented Mar 8, 2018

Ah... my bad. Yes there should be a test. @srwiseman would you like to add one, or leave that to us?

@srwiseman
Copy link
Contributor Author

Hi @lilleyse, sorry I was on vacation with no internet for a while.

Did you write a test for this yet? If not, I could write one.

@lilleyse
Copy link
Contributor

Ah no problem. I haven't written a test, so you are still welcome.

@srwiseman
Copy link
Contributor Author

Cool. So basically the test would check to ensure that if the model fails to load, the bounding sphere state correctly gets updated to FAILED? Correct?

@lilleyse
Copy link
Contributor

Yes that sounds good.

@srwiseman srwiseman deleted the srwiseman_6272_fix branch March 21, 2018 00:53
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.

Zoom When Model Load Failure
5 participants