-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
LoadingManager: wrong order of events #5438
Comments
It might be more problematic than that. Just switching the order of onLoad and onProgress does not fix my problem. My LoadCallback ( on a JSONLoader ) is still called after the OnProgress is called (with total == completed). Also I tried the "onLoad" function of the DefaultLoadingManager - this is sometimes even called when not everything is loaded (I think because while locally testing some objects load so fast, they trigger even before all loads are requested) A console.log in the onProgress and the onLoad Callbacks of the DefaultLoadingManager (sometimes!) result in this: DefaulLoadingManafger.onProgress textures/marker.png 1 1 This is the log code: console.log('DefaulLoadingManafger.onProgress', item, loaded, total ); From what I gather in the code the "onLoad" should only fire if everything is loaded - but the Loadingmanager simply does not know, that there will be more to load. (Because the loading of item 1 is done, before the loading of item 2 is even requested). (This is using the unmodified three.js 68) |
Can you provide upload somewhere a test so we can take a look? |
Hello, Sorry for taking a three days to respond. I am using Windows 7 64bit. With Firefox it seems to be fine every time. Here is the demo of the bug (or the demo of my code not understanding the loading manager): Demo consists of: loadertest.html (contains the relevant script), a mini json model + texture and the current release three.js (68). Expected console output is: loaded floor # 1 At least this is what happens the first time (and for me 2 more times refreshing in chrome) and then, refreshing more often (hitting f5 a few times in chrome for example) console-output like this happens: loaded floor # 1 So I can't use the progress or the onSetup of the defaultLoadingManager to safely ensure that everything is loaded, before I start my rendering loop. Thanks for taking the time to look at this. |
The real problem is that JSON Laoder doesn't support the loaderManager. |
@mrdoob As shown above the loadingManager does not work (at least not every time) with IE and Chrome. (only firefox.) I must admit, that I am not sure what gero3 means. |
It was wrong that is why i deleted it. What happens:
So this is not correct. What should happen is:
|
Thank you for the clarification, I understand it now. (And still think that On Fri, Oct 31, 2014 at 10:26 AM, gero3 notifications@github.com wrote:
|
I'd call it a |
Agreed :), thank you. |
I tried running the linked example, it seems to give the correct result. Maybe the example was modified since first reported? In any case, |
Hi,
Maybe I am getting this wrong, but shouldn't the loading manager first call the onLoad function and after that the onProgress function?
My Reason:
I load a json file (containing materials and a geometry) and I set the onLoad callback. In this callback I place the stuff in my scene and in some array to later modify it.
Now I wan to use the DefaultLoadingManager to start my application when everything is loaded.
I do it this way:
THREE.DefaultLoadingManager.onProgress = function ( item, loaded, total ) {
if (loaded == total) {
start();
}
Since the order in which the callbacks are called is "progress" and after that "loaded" the LoadingManager starts the application before everything is setup properly and it (sometimes, depending on the load order) crashes.
If I am just using this wrong, feel free to point me in the right direction - if not, I'll be happy to switch the order of the callbacks and create a pull request.
The text was updated successfully, but these errors were encountered: