AnalyticalGraphicsInc / gltf-vscode

This is an extension for Visual Studio Code to add support for editing glTF files.
Apache License 2.0
461 stars 63 forks source link

Upgrade BabylonJS #181

Closed emackey closed 4 years ago

emackey commented 4 years ago

Now that 4.1.0 is out, we should upgrade the BabylonJS preview engine.

When I update package.json (on branch babylon-4.1.0) and run it, opening the preview window gives me a pair of messages:

Uncaught NetworkError: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'https://preview.babylonjs.com/gltf_validator.js' failed to load.

Uncaught ReferenceError: GLTFValidator is not defined

Ideally, we shouldn't run the validator in the preview window, as the validator already runs on the document itself. Also, this is a desktop application that needs to work offline. It should not be attempting to touch the public Internet if possible, so it can run in a closed network environment.

There's another error if I open Babylon Inspector and select a node or a texture (but not a material) from the displayed model. This is the error that pops up:

Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs.

/cc @bghgary Any ideas? I should probably have been testing the betas and RCs along the way...

bghgary commented 4 years ago

Ideally, we shouldn't run the validator in the preview window, as the validator already runs on the document itself. Also, this is a desktop application that needs to work offline. It should not be attempting to touch the public Internet if possible, so it can run in a closed network environment.

The inspector turns on the validator. I think we can turn this off, but I will need to check the code a bit.

There's another error if I open Babylon Inspector and select a node or a texture (but not a material) from the displayed model. This is the error that pops up:

Uncaught SecurityError: Failed to read the 'localStorage' property from 'Window': Storage is disabled inside 'data:' URLs.

That sounds like something we need to fix in the inspector. I will investigate when I get a chance.

bghgary commented 4 years ago

The glTF validation issue is easy to fix. Since the inspector turns it on, I just changed the loader to force it to be off. https://github.com/AnalyticalGraphicsInc/gltf-vscode/pull/182/commits/a0e051cf5c61a493607f5be49d908d72a827d675

The right way to fix the second issue is to fix it in Babylon. I have submitted a PR for this, but we will have to take a preview build for the fix. If we don't want to take a preview build, then I have a hack fix that will also work. https://github.com/AnalyticalGraphicsInc/gltf-vscode/pull/182/commits/a460d97bf37ef631a21e90964e4a8ef579655d01

emackey commented 4 years ago

Merged in 94aac09dcb3f, thanks @bghgary