stef-levesque / vscode-3dviewer

Preview 3D meshes in VSCode
MIT License
96 stars 20 forks source link

Impossible to open the viewer #10

Closed AlexPiro closed 4 years ago

AlexPiro commented 5 years ago

I try to open the viewer but nothing appears. Tried different files, used url, local files ... nothing happen ! Is there something to activate after the installation of this extension ? Thank you for your help

Using : MacOS 10.14.6 VSCode 1.37.1 3DViewer for VSCode 0.1.0

ericsstoll commented 5 years ago

same

EXPLOR3R commented 5 years ago

+1

Windows 10 (17763) VSCode 1.38.0

mjbvz commented 5 years ago

This is likely caused by #9. Please consider helping out the extension author with a PR that migrates this extension to use webviews

deckar01 commented 4 years ago

I took a quick peek at this. The way this currently works is that TextDocumentContentProvider is subclassed so that the HTML can be served through a virtual URI. The JS dependencies are included by src and proxied through the provided.

webview doesn't allow URI navigation. Once a webview panel is created, the HTML string must be assigned to the html property directly. Also, the only examples of JS I found in the webview docs show inlining code in the script tags. If file:// includes don't work they will probably have to be read from disk and injected into the HTML template.

mjbvz commented 4 years ago

See this guide on how to load local resources: https://code.visualstudio.com/api/extension-guides/webview#loading-local-content

deckar01 commented 4 years ago

I didn't get very far: https://github.com/stef-levesque/vscode-3dviewer/compare/master...deckar01:10-webview

I'm really only getting feedback from the compiler. When I debug the extension there is no indication that the extension is actually running when an STL file is opened.

Edit: I got compiler errors indicating that the version of typescript was too old for the version used in vscode now. Updating that package started causing the package to produce different errors about data structures between vscode's version of typescript and the version install for this package.

acaeronte commented 4 years ago

Tengo un modelo en formato .obj pero no consigo ver la preview gráfica. ¿alguna sugerencia? Gracias

felixvd commented 4 years ago

@deckar01 Seems like you're the only one who tried it. I'm not sure that you didn't get far. Any chance you'll try again? I'll bounty a dinner.

deckar01 commented 4 years ago

I got past the basic previewHTML to webview conversion, but webviews broke many more things:

https://github.com/stef-levesque/vscode-3dviewer/compare/master...deckar01:10-webview-2

Screen Shot 2020-03-12 at 11 19 46 AM

I had to comment out the usage of several basic browser features that VSCode's webview does not allow. Each time I would hit a missing feature, I would find a corresponding VSCode issue about it that ended with @mjbvz saying there is a native VSCode alternative and no interest in supporting the browser functionality. The features are enabled in the browser engine, VSCode just will not expose the arguments in their options API so that developers can use them. There are too many libraries in this project that rely on web standards to port all of them to VSCode. This kind of vendor lock in is anti-open source. I will be replacing VSCode and no longer contributing to this project. Good luck.

mjbvz commented 4 years ago

Such as? If you’re talking about native pop ups (alerts, prompts), yes those are not supported. They look out of place visually in VS Code, feel out of place because normal keybindings and such don’t work, and let the web view block interaction with the entire editor

That’s why we want you to use the normal VS Code UI instead. You can overwrite window.alert if some library you use depends on it

felixvd commented 4 years ago

@deckar01 Thanks for retrying and the quick response. If you have any concrete links to issues that would be appreciated. I would be interested in this discussion.

stef-levesque commented 4 years ago

Hey, sorry for not maintaining the repo over the last few months.

I've stop trying to support webview, and now focus on using custom editor in the custom-editorbranch

I'll submit a fix for the extension when the proposed API is approved

stef-levesque commented 4 years ago

I overwrite alert and confirm with the functions from top. So far this works fine.

    // VSCode webview doesn't support modal window
    window.alert = top.alert;
    window.confirm = top.confirm;
stef-levesque commented 4 years ago

Version 0.2.0 of the extension has just been pushed, you can now view 3D models using the Open With... command.