Closed bghgary closed 6 years ago
Hi @bghgary, thanks so much for this PR! Do you mind getting approval to sign our CLA? Jamie Marconi and David Catuhe and a few other Microsoft folks have done this.
/cc #85
CLA sent.
CLA received, thanks @bghgary!!
Thanks @bghgary. Currently can't compile. I suspect something is messed up on my side. Here's what I get:
src/gltfPreview.ts(13,51): error TS2694: Namespace ''vscode'' has no exported member 'WebviewPanel'. src/gltfPreview.ts(44,35): error TS2339: Property 'createWebviewPanel' does not exist on type 'typeof window'. src/gltfPreview.ts(74,47): error TS2694: Namespace ''vscode'' has no exported member 'WebviewPanel'.
Obviously these API points are supposed to exist. I tried npm upgrade
and npm install
. Feels like I've overlooked something.
Ahh, yes. Sorry, I missed adding a package.json change.
This should work now. I was separating the rest of my changes from this PR and missed a couple of things.
If I manually specify a reflection environment via the settings, for either Babylon or ThreeJS, I get CORS errors in the console and the environment won't load.
VSCode User Settings file:
"glTF.Babylon.environment": "D:\\emackey\\EnvMaps\\StonewallEnvHDR.dds",
Output:
Failed to load file:///D:/emackey/EnvMaps/StonewallEnvHDR.dds: Cross origin requests are only supported for protocol schemes: http, data, chrome, vscode-resource, chrome-extension, https. retryLoop @ vscode-resource:c:/Users/emackey/Documents/Git/gltf-vscode/node_modules/babylonjs/babylon.max.js:9040
I like the persistence, you can cycle to other webviews and come back, and the page is still alive and doesn't need to reload. This could open the door to some interesting user interactions on the 3D view itself.
Fixes #85.
the page is still alive and doesn't need to reload
Yes, that's part of the reason why I'm doing this. I have code locally that interacts with the Babylon viewer. It's not quite yet, but I wanted to get the infrastructure merged in first.
Shouldn't be needed those two systems are similar enough.
If I manually specify a reflection environment via the settings, for either Babylon or ThreeJS, I get CORS errors in the console and the environment won't load.
Every webview panel gets created with a list of paths that it is allowed to access. I will probably make it such that the default environment's path is part of this list when the panel is created. The list of paths cannot be updated after the panel is created. This means that the default environment will not update until the preview window is closed and reopened. I think this is okay, but wanted to call it out.
This means that the default environment will not update until the preview window is closed and reopened.
I think that's fine. Later we could add a trigger to destroy and create a new webview when that setting changes, if that becomes important. But I don't change it that often, probably I'll just close and reopen the window manually. For this PR that's fine.
I've updated with the fix for the environment configuration.
Version 2.1.17 published.
I have been working on a hackaton project to add a glTF debugger and I used the vscode extension as the foundation. This PR just does some clean up and switches the glTF preview to the vscode webview so that I can more easily pass messages to it. I have more changes coming.
I added the GLTF2.d.ts that I grabbed from the PR Don is submitting for DefinitelyTyped. We can switch over to the official one once that PR is merged.