-
Notifications
You must be signed in to change notification settings - Fork 15
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
new components with importDocument #43
Comments
Here is an example: https://andreasplesch.github.io/x_ite_dom/tests/interactiveTransformations.xhtml This scene uses event utilities such as BooleanFilter and TimeTrigger. Now there are XMLParser error complaining about unknown node types because the EventUtilities component is not loaded. I could prepare a minimal example only using SAI methods as well, if helpful. |
To trigger load in importDocument is not possible because it is not asynchronously. In your There is a getProviderUrls in X3DParser which determines the required components from profile/component declarations, may be should I put this function to X3DScene?
The result can be passed to require.
on success you can safely use |
I could make a |
Yes, I saw that in the parser. I will give it a try. I also tried loading a dummy x3d as a plain data url with a profile='Full' as a src attribute to X3DCanvas. The main problem then was to wait for the loading to finish before installing the integrations. I could not figure it out. The onload event listener apparently can only be given as an attribute ? It would be nice to have an .onload property on X3Canvas or actually be able to .addEventListener. |
Cool, using require 'manually' to get the component providers works: There is just a bit of a chicken and egg problem since I have to importDocument first to get the scene with the profile which causes parsing errors. But then I can use the scene to make a parser for this scene which has then the correct provider urls, and then I can reimport with require. Overall this works well but I think from a standard perspective importDocument() and then replaceWorld should also just work with any profile. |
I moved |
The 'alpha' version is already up to date. |
This uses the master branch directly: The X3D has a profile field, and x_ite_dom now looks for the X3D dom node rather than Scene. It uses the same approach as before. There are two import passes, the first one to set the profile for the new scene, and then the second one to use the correct scene profile to reimport with the required components. I could manually parse the profile (and components) of the new scene dom, and set it on the current (empty) scene. Could there be a browser.importDocumentAsync that requires the components, then imports and returns a promise ? The use pattern would be something like: scenePromise = browser.importDocumentAsync(dom);
scenePromise.then((loadedScene)=>browser.replaceWorld(loadedScene));
//or
scene.then(browser.replaceWorld, rejectFunction);
//or
async replaceWorldAsync(scenePromise) {
var scene = await scenePromise;
return browser.replaceWorld(scene) };
scene = replaceWorldAsync(scenePromise); |
I am testing to replace .importDocument with parser.parseIntoScene since it can require the components if there is a success callback: Here is the modified loading: It is nicer because it does not require the two passes and does not generate errors. But is uses the internal parseIntoScene parser function whereas it would be better to rely on SAI only. But since otherwise getProviderUrls would have to be used anyways, this is actually probably ok. Still, it would be great if .importDocument could be made to work for lazy loading without having to use workarounds. |
x_ite 4.4.4 allows browser.importDocument(dom,success,error) for async. component loading and subsequent invocation of provided success callback. |
Now that many components are loaded on demand, is there a way to trigger loading of new components with importDocument followed by replaceWorkd ?
For example, going from a Scene with Immersive profile to a Scene with Full profile.
The text was updated successfully, but these errors were encountered: