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

Expose model ready through the Entity API #4727

Closed
hpinkos opened this issue Dec 7, 2016 · 9 comments
Closed

Expose model ready through the Entity API #4727

hpinkos opened this issue Dec 7, 2016 · 9 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Dec 7, 2016

Users want to know when the model is ready so they can have custom functionality when the model is loading and when the scene is ready

From #3910:

Unfortunately this approach won't really work well for several reasons. The model can change dynamically with time or programatically, but the ready promise can only resolve a single time. So promises may not be the best context here. Additionally, the ModelGraphics object may actually be associated with several different visualizers, so there may not be a single "model ready" event.

Maybe tie it into the boolean returned from DataSourceDisplay.update? This boolean is supposed to the true when when all data sources are ready to be displayed and false otherwise.

@hpinkos
Copy link
Contributor Author

hpinkos commented Aug 23, 2018

@mramato
Copy link
Contributor

mramato commented Aug 23, 2018

The approach described in that forum post is flawed. 3D Tiles are the way to do what they want.

I'm still not convinced we'll ever need this as there is always a better way to do what our users want without this functionality (and having this functionality will lead them down a bad implementation path). There could be exceptions, but I haven't heard them yet.

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/25XIuI25F7A

If this issue affects any of these threads, please post a comment like the following:

The issue at #4727 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


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

🌍 🌎 🌏

@OmarShehata
Copy link
Contributor

Here's a potential use case that can't be done in the Entity layer that I don't see addressed here. This forum thread is trying to use viewer.trackedEntity, which will not work immediately if the model isn't loaded. This delay could be anywhere between a few milliseconds to several seconds. The application developer just needs to know when it's ready to display some sort of loading message/reaction to the user in the mean time. A entity.model.isLoaded boolean could potentially solve this.

Thoughts?

@emackey
Copy link
Contributor

emackey commented Feb 15, 2019

This person wants to show a loading screen until all of the textures have finished loading on his glTF model:

https://stackoverflow.com/questions/54702149/how-to-get-states-of-the-gltf-texture-rendered-with-cesium

@OmarShehata
Copy link
Contributor

I think another thing that could solve that user's issue is if they could toggle the incrementallyLoadTextures from the Entity API. Being able to control sync/async in general would be nice.

@hpinkos
Copy link
Contributor Author

hpinkos commented Feb 15, 2019

I don't have a good answer for what to do for things like this, other than "don't use the entity API for models" =/ There's a reason we didn't add 3D Tiles to the Entity API. If you want more control, you need to work with the primitives at a lower level. These kind of use-cases are just really not what the Entity API was designed for.

@OmarShehata
Copy link
Contributor

Actually, I just realized incrementallyLoadTextures is already exposed as an option on ModelGraphics so I think this is easily solved by setting that to false! Since I assume the problem here is that the user doesn't want the model to appear without the textures.

It's still annoying that you can't control whether entities are async or not, but I think adding a flag there too would solve so many cases where I as a developer would rather risk frame drops rather than showing an entity and having it appear on screen an unknown amount of frames later. It sounds like this would be easy to add a toggle for unless I'm missing something.

@OmarShehata
Copy link
Contributor

Just want to add here, I think exposing a generic entity.ready boolean may be useful, in the same way globe.tilesLoaded tells you whether the globe is ready at this given frame. The use case here is if you want to say, make a button available only when an entity is ready to be zoomed to. Forum thread. The viewer.flyTo(entity) will check every frame if an entity is ready, but the user cannot do this check from the public API.

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

No branches or pull requests

6 participants