Skip to content
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

Is it possible to support automatic reload? #163

Closed
ikeough opened this issue Jun 2, 2019 · 8 comments · Fixed by #164
Closed

Is it possible to support automatic reload? #163

ikeough opened this issue Jun 2, 2019 · 8 comments · Fixed by #164

Comments

@ikeough
Copy link

ikeough commented Jun 2, 2019

This extension is fantastic, and has become an indispensable part of my glTF development kit. The one piece that I’d be interested to know whether it is possible to develop is automatic reload. When I’m viewing a glTF file, it would be ideal to have the extension’s view reload when that file changes on disk.

Apologies if this has already been suggested or already works. I’d be happy to contribute if there is a straightforward path for how to do it.

@bghgary
Copy link
Contributor

bghgary commented Jun 2, 2019

It should already do this. Does it not do it for you?

@ikeough
Copy link
Author

ikeough commented Jun 2, 2019

I had thought that this would already be enabled, but as far as I can tell, it is not. Here's the setup:

  • .Net core test project containing code which uses the gltf-CSharp-Loader to write a glTF file into the solution directory.
  • VSCode with updated glTF Tools extension loaded.
  • Run test.
  • Gltf file is generated.
  • Hit "Preview 3D Model". Extension view opens. Looks great!
  • With extension view still open, run the test again overwriting the gltf being viewed. The view does not change.
  • Close the view and hit the "Preview 3D Model" icon again. View opens with updated glTF.

One thing to note. I am overwriting the file. I am not updating the contents of the glTF file.

I did the same test, but after regenerating the glTF, I just clicked on one of the other engine buttons without closing and re-opening the 3D preview. In this case, when the new engine's display came up, the updated results were visible. Switching engines loads the latest. But the current engine does not update its visualization when the file is overwritten.

@bghgary
Copy link
Contributor

bghgary commented Jun 2, 2019

Gotcha. I've submitted a fix.

@emackey
Copy link
Member

emackey commented Jun 3, 2019

Version 2.2.6 is published.

@ikeough
Copy link
Author

ikeough commented Jun 4, 2019

One more data point here. When I first loaded the update, it didn't seem like the fix worked. Then I realized that the changes I made to the gltf were changes that would only change the .bin, not the .gltf, so reload never occurred. For those who might complain about this in the future, the solution is to make sure that you change something in the .gltf.

@bghgary
Copy link
Contributor

bghgary commented Jun 4, 2019

Yeah, I don't think this one is easy to fix. The bin file isn't loaded by VSCode and thus it doesn't know that the file has changed.

@najadojo
Copy link
Contributor

najadojo commented Jun 4, 2019

We could use fs.watchFile after collecting all the uris in the glTF.

@bghgary
Copy link
Contributor

bghgary commented Jun 4, 2019

Hmm, good idea. I'll try it out in a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants