feat(tools): sync SVG masters into TextureStudio for live 3D preview - #209
Merged
Conversation
The Studio consumes SVG masters, not compiled rasters, so the sync carries masters and flattens textures/block/ into the flat shape it discovers. Signed-off-by: Bharath <bharathasl74185@gmail.com>
fs.watch({recursive:true}) is unsupported there and package.json declares
engines.node >= 18, so --watch would have thrown rather than watched.
Signed-off-by: Bharath <bharathasl74185@gmail.com>
BharathASL
force-pushed
the
feat/texture-studio-master-sync
branch
from
September 2, 2026 04:10
2cad247 to
3188029
Compare
The Node 18 fallback ran on no platform the suite or CI uses. Adds a watchFn seam, remounts on late directories, and closes on mount failure. Signed-off-by: Bharath <bharathasl74185@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
tools/sync-studio.mjs, which pushes this repository's SVG masters into a local TextureStudio checkout so its WebGL viewport previews what Keyframe actually ships. One-shot by default,--watchto keep going.#59's acceptance criteria were written against the wrong artifact, and I corrected the issue before implementing. It asked for a watcher "syncing compiled raster textures to TextureStudio assets directory". TextureStudio does not consume rasters there: its
textures/holds SVG masters,src/app.jsloadTexture()loads/textures/<name>.svgstraight into anImageand draws it to a canvas, and its own compilertools/build-pack.mjsrasterizes those same SVGs with the same@resvg/resvg-jsand the same five tiers as ourbuild.mjs. The Studio's only PNG path is external comparison packs undercache/packs/, fed by dropping a built.zipin — a different feature. Syncing rasters would have handed a compiler its own output and left the real problem untouched. Full evidence, with the running-server output, is in this comment on #59; the criteria in the issue body are rewritten to match.The drift was real and invisible to both repositories. TextureStudio's
dirt.svgstill carried the pre-#37 palette,#d98827/#fcae52, againstmain's#c77d38/#deae70from #198. A dry run measured the whole gap: of 30 masters, 21 were missing from the Studio, 5 had drifted, 4 matched. Neither repo could see it, because the Studio'stextures/is gitignored on its side ("Creative Vector Master Assets (Authored locally)") — which is also why writing into it from here is safe.Design decisions
textures/block/dirt.svg); the Studio'sdiscoverActivePack()does one non-recursivereaddirSyncand expects them flat (textures/dirt.svg). A basename is the Minecraft texture id, so the mapping is lossless — and if two namespaces ever share one, the sync aborts naming both rather than picking a winner. Documented inCONTRIBUTING.mdand in the tool's header and--help.--studio <path>beats$KEYFRAME_STUDIO_DIRbeats the sibling../TextureStudio. A path that does not exist, is a file, or lackstools/server.mjs/tools/build-pack.mjsis a hard error naming the path, where it came from, and the flag that would fix it. The Studio's owntextures/is created if absent — it is gitignored there, so a fresh clone legitimately has none — but only inside a checkout that already passed the marker check.--pruneopts into removing it.--dry-runreports the plan and writes nothing, so the sync can be inspected before it runs.Verification, run for real
D:/Projects/Ninja6-MC/TextureStudio: 21 new, 5 updated, 4 unchanged. A second run reports 30 unchanged, so it is idempotent. The Studio'sdirt.svgnow carries#c77d38./api/packreturns 24 discovered blocks (was"blocks":[]), and/textures/dirt.svgserves the shipped palette over HTTP.~ clay.svgwithin the debounce window; reverted, it reported the revert.npm run build:512succeeds — the fatal shared-base gate intools/build.mjsis untouched and still runs.test:animation,test:palette,test:base-syncall still exit 0.Nothing is committed to TextureStudio. Only its gitignored
textures/is written, at runtime, when someone runs the tool.git statusthere shows no change attributable to this PR.Two findings that need a TextureStudio-side change, and are therefore not fixed here
tools/server.mjsauto-discovers a sibling../Keyframe/texturesahead of its owntextures/, and scans it non-recursively — our masters are one level deeper, so it finds zero SVGs and the active pack comes back empty. Verified:curl localhost:3000/api/pack→"blocks":[]. Until that is fixed,CONTRIBUTING.mddocuments launching withnpm start -- --textures textures.Cache-Control: no-cacheand re-reads from disk per request. A viewport that refreshes itself needs code inside TextureStudio.#59's second criterion is rewritten to say that plainly rather than claim it.Both are reported, not acted on: this session works in Keyframe.
Affected Assets
tools/sync-studio.mjs(new),tools/test/sync-studio.test.mjs(new),package.json,.github/workflows/ci.yml,CONTRIBUTING.md. No texture master is modified.Closes #59
Type of Change
feat: New vector texture master, blockstate, or compiler capabilityfix: Tiling fix, palette correction, or bugfixdocs: Documentation improvementchore/refactor: Maintenance, dependencies, or codebase cleanupContributor Checklist
Vector Texture Standards (if adding/modifying SVGs)
Build & Verification
npm run buildlocally and verified that the pack compiles successfully.dist/— here, verified the masters end to end through TextureStudio's own HTTP API and 3D block discovery.Git Hygiene & Standards
git commit -s).mainwith no merge commits..editorconfig(2-space indent, LF endings, trailing newline).Note on CI
npm run test:tilingfails for 15 of 30 masters and is advisory (continue-on-error: true) — that is pre-existing debt onmain, owned by #206, and no file it reads is touched here.npm testchains it, sonpm testexits 1 onmaintoday as well; the four non-tiling suites, including the new one, all exit 0.