AnalyticalGraphicsInc / gltf-vscode

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

BabylonJS mesh data not highlighting with user selection #268

Closed emackey closed 1 week ago

emackey commented 3 months ago
  1. Load an ordinary (non-Draco) glTF model and visit the mesh.primitives block for any visible mesh.
  2. Open the Babylon.js 3D model preview (but not the inspector, I think, just the main preview).
  3. Press ALT + d in the mesh primitive attributes block to inspect the data.
  4. In the left bar, an "Inspect Data" tree appears. Expand the list of vertices, then expand the [0..100] block.
  5. Click a particular vertex number, such as 5.

I believe the selected vertex is supposed to be highlighted in BabylonJS, but it is not. On the extension side, the following line posts a message into the webview containing BabylonJS:

https://github.com/AnalyticalGraphicsInc/gltf-vscode/blob/7e07889d105fa8850170ac3c09126e8f43cb5ec9/src/gltfInspectData.ts#L604

This message is successfully delivered into the webview, and babylonDebug.js receives it here:

https://github.com/AnalyticalGraphicsInc/gltf-vscode/blob/7e07889d105fa8850170ac3c09126e8f43cb5ec9/pages/babylonDebug.js#L267

It then looks for the mesh in question:

https://github.com/AnalyticalGraphicsInc/gltf-vscode/blob/7e07889d105fa8850170ac3c09126e8f43cb5ec9/pages/babylonDebug.js#L118-L119

And tries to learn the JSON pointer of each mesh during that search:

https://github.com/AnalyticalGraphicsInc/gltf-vscode/blob/7e07889d105fa8850170ac3c09126e8f43cb5ec9/pages/babylonDebug.js#L105

Unfortunately, Babylon's scene.meshes[i].metadata turns out to be an empty object, so the test for ...metadata.gltf fails, and the selected mesh is never found. So, the selection highlighting does not work.

emackey commented 3 months ago

@bghgary Safe travels home from SIGGRAPH! Let me know if you have thoughts on this, no rush. We're on Babylon 7.17.2 now.

bghgary commented 3 months ago

I am back for a week and then I'll be out again. I'll take a look at the end of the month or early September.

bghgary commented 2 months ago

@emackey I try to investigate, but I am unable to get npm install to succeed. It appears there are commands that don't work on Windows. What platform do you develop on?

C:\GitHub\gltf-vscode>npm install
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated glob@8.1.0: Glob versions prior to v9 are no longer supported
npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm WARN deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead

> gltf-vscode@2.5.0 postinstall
> cd server && npm install && cd .. && npm run fixThree

> gltf-language-server@2.5.0 preinstall
> touch installServerIntoExtension && rm installServerIntoExtension*

'touch' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\GitHub\gltf-vscode\server
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c touch installServerIntoExtension && rm installServerIntoExtension*
emackey commented 1 month ago

@bghgary I'm on Windows for this but I use "Git Bash" as the command line for most of this, which I guess is where touch comes from. Are you able to try again from Git Bash for Windows? At some point I may have to redo all the Language Server stuff in this extension, but it's a big lift.

bghgary commented 1 month ago

Yup, Git Bash works after some trial and error. It appears launching vscode using code . from Git Bash causes it to not be able to find npm 🤷‍♂️. It works fine if I launch from a normal command prompt or with the start menu.

EDIT: this is probably something in my system and is unrelated