One texture pipeline for every model viewer, thumbnails by URI - #112
Conversation
- The standalone model viewer (blpPreview) resolves textures through postTexturesToWebview like the object editor's inline preview and the asset browser: same local-first resolver, payload/missing caches and concurrency limit, instead of its own lookup with unbounded Promise.all. Texture messages carry resolvedFsPath so the viewer's "open texture" link still works. The BLP-only findLocalTexture helper is removed. - Cached model thumbnails are handed to webviews as resource URIs instead of base64 data URLs; the thumb cache directory is admitted through localResourceRoots for the object editor and the asset browser. The asset browser also fetches model bytes by URI like the object editor does, so neither the model nor the thumbnail travels through postMessage as base64.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12fc3fd5a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…or model textures
- The asset browser's CSP admits the extension's cspSource for img-src and
connect-src, which URI-mode model fetches and cached thumbnail images need.
- getCandidateRoots(..., { includeAncestors: true }) adds up to four ancestor
directories of the document; postTexturesToWebview uses it so a model nested
below a non-workspace map/project root still finds textures relative to that
root, as the removed BLP-only lookup did. Scans (gatherImportedAssets) keep
the plain root list and never walk ancestors.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1bc57a85c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…changes The shared texture resolver remembers misses so an absent texture is not re-probed on every render, but nothing ever forgot them. The viewer's Refresh (and its file watcher), the object editor's reload, and a wurst.wc3path change now clear that cache so a texture added or made reachable later is picked up.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f0e5aab9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
With models delivered as webview resource URIs, the asset browser's thumbnail renderer still only decoded base64, so every cache miss rendered an empty buffer. It now fetches the URI (falling back to base64 for test doubles) and ignores the result if a newer job superseded it.
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Stacked on #111. Third slice of the audit list: the duplicated texture pipeline and the base64 thumbnail transport.
Texture pipeline
blpPreview.ts) resolves textures throughpostTexturesToWebview, the same code path as the object editor's inline preview and the asset browser: local-first resolver, payload and missing caches, and a concurrency limit of 6, replacing its own lookup with an unboundedPromise.all.resolvedFsPathso the viewer's "open texture" link keeps working.findLocalTexturehelper is removed. Behaviour difference: the old helper also walked up to four parent directories of the model file; the shared resolver uses the document folder,imports/-style subfolders, workspace roots and the game cache. For models inside a map folder or workspace this is a superset; for a lone model in an unrelated directory tree with textures in a grandparent folder it is not.Thumbnail transport
vscode-webviewresource URIs instead of base64 data URLs;~/.wurst/model_thumbsis inlocalResourceRootsfor the object editor and the asset browser. Test doubles withoutasWebviewUristill get a data URL.postMessageas base64 any more.Validation
tsc(real siblings and CI mocks),npm run lint,npm test: clean.npm run test:e2e: all map-data editor specs pass; object-editor failures match themasterbaseline apart from the two known flaky specs, which pass on rerun.