Repository navigation
Give each Auto-paint color its own filament stack for better colors and thinner Flat Paint (#151) - #223
Merged
Conversation
Add a React-free planner that gives each Auto-paint target color its own stack: the shared foundation plus up to three runs of any loaded filament, scored with the same appearance model and CIEDE2000 as the shared sequence. Each target's shared prefix stays a candidate, so no color is predicted worse. A greedy search enforces a per-layer filament cap (relief stacks align at the plate, Flat Paint stacks at the face) and prefers stacks that reuse filaments already on a layer. Not wired into the app yet. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Generalize the Flat Paint layout into buildStackLayout, which takes each class's own bottom-up filament stack. Plain Flat Paint now builds its classes from prefixes of the shared sequence and produces the same parts. The new relief orientation keeps each column on the plate at its own height. Add region labels for pixels and buildRegionStackLayout, with tests that check every pixel's filament on every layer in all three orientations and that the meshes export as closed shells, one 3MF object per filament. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wire the region stack planner into the app as an opt-in Auto-paint option with a per-layer filament cap (2-16, default 4). Building plans the stacks in a worker and meshes them through the shared slab path in relief and both Flat Paint orientations, exporting one 3MF object per filament. The option persists with Auto-paint settings, excludes Multi-head, shows multi-material print instructions, steps Layer Preview by physical layer, and counts planned layers in the build warning. Localize the controls, notices, instructions, and a new Auto-paint guide section into all 12 languages, and add a browser smoke test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Score each shared prefix with the color Auto-paint published for it, so the never-worse baseline doesn't depend on re-predicting it. - Fall back to the shared sequence above 128 target colors or if a plan can't fit the cap, and give colors with identical stacks one mesh class, bounding mask memory. - Group parts by filament ID, so two filaments with the same color stay separate 3MF objects. - Make Per-region stacks exclusive with Preserve color separation, cancel planning when the image changes, and let the cap field accept 10-16 while typing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Plan colors Auto-paint dropped for zero regional weight, so their pixels keep their own stack instead of the nearest planned color's. - Bound per-stack mask memory by image size, and allocate masks only for classes present in the crop. - Name same-colored filaments apart in 3MF part names. - Score the shared baseline from its published uint8 color, like the alternatives, and load conflicting saved toggles with Per-region stacks off. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- XML-escape 3MF object names, so profile names with characters such as `&` keep the model file valid. - Fall back to the filament ID when same-colored filaments also share a profile name. - Note in the Auto-paint guide (all 12 languages) that very large images plan fewer than 128 colors, and clarify the changelog that colors may keep their shared prefix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Escape part names in model_settings.config with escapeXmlAttribute, so control characters in profile names can't break the file. - Use filament IDs for every same-colored filament when any final part tag would collide. - Build the face-down carrier mask in each caller's pixel pass instead of rescanning the image per class. - Localize the per-region mesh progress label in all 12 languages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Key stacks with an unambiguous JSON encoding, since imported filament IDs may contain any text, so distinct stacks never merge into one mesh class. - Check part-name uniqueness after XML normalization, so names that differ only by forbidden characters fall back to filament IDs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Imported filament IDs may contain any character, including NUL, so a joined string key could hand one filament pair another pair's optics. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The planner built new stacks bottom-up and exempted each color's shared prefix from the run and layer cost, so a 40-layer, 11-run prefix whose deeper layers no longer change the color beat a 6-layer stack that looks the same. Most colors kept their long shared stacks, and the filaments-per-layer cap had nothing to act on. Now every stack pays the same cost, the search also tries the foundation plus the top k layers of each shared prefix, and a stack counts as matching its prefix within 0.1 ΔE. On a real 27-color image with 8 translucent filaments, a Flat Paint slab drops from 43 to 17 layers and from 142 to 58 estimated tool changes, with overall color error improving from 6.46 to 6.08 ΔE. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Per-region stacks no longer turn Preserve color separation off. With separation on, every color it keeps apart must stay within its ΔE limit and may not move closer to another kept color than their shared colors were, up to 3 ΔE. The search starts from the shared prefixes, which meet this by construction, and rejects any move that breaks it, so two separated colors can't collapse onto the same or a near-identical stack. The settings come from the Auto-paint result the planner already receives. The note, guide, and changelog are updated in all 12 languages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The 0.1 ΔE tolerance bounded only how much worse a stack matched its target, so a trimmed stack could move about 3 ΔE away from the color the shared prefix printed. A stack may now be up to 0.1 ΔE less accurate only while its color stays within 0.5 ΔE of the published shared color; stacks at least as accurate stay free to look different. On the owner's 27-color image this leaves layer counts and tool changes unchanged. Also fix a duplicate test swatch that never printed and document that trims of a shared prefix are exempt from maxRuns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #151.
Auto-paint gives every color the first layers of one shared filament sequence. So if one color needs an unusual stack, every color above it prints those layers too, and colors that need unrelated stacks can't both be served well. In Flat Paint, the slab is as thick as the deepest prefix any color needs.
A new opt-in Per-region stacks option, off by default, gives each color its own stack instead:
It works in relief, where each column ends at its own height, and in both Flat Paint orientations, where shorter stacks are padded with foundation. In Flat Paint the cap never drops below what the plain layout already needs, because every face sits on the same layer.
Measured on test palettes:
Relief gets better colors, but needs more tool changes than the shared sequence.
How it fits together
src/lib/regionStacks.tsholds the planner. It is React-free and runs in a worker at build time, taking about 0.5 s for 128 colors.buildFlatPaintLayoutis generalized intobuildStackLayout. Plain Flat Paint now goes through it with unchanged output, and all existing Flat Paint, mesher and multi-head geometry tests pass.createFlatPaintMesherand export as 3MF only, one object per filament.Tests
@smokebrowser test: relief and Flat Paint builds and exports, mode exclusion, and persistence.npm test, lint andcheck:i18npass.test:e2e:all: every suite passed except 4 Display P3 cases inimage-decode-reuse.spec.ts. Those fail on unchangeddeveloptoo (3 of 4 there), which is the known flake image-decode-reuse smoke tests lose clicks after a swatch drag #183.Council review
Rounds: 7. Members: Claude Opus 5.5 and GPT-6.2 Sol at high effort. No third provider was available here: Gemini, Grok and the others are disabled.
Fixed after review
Declined
Changes after the council (from hands-on testing, reviewed with sol-loop below)
Known, not changed here: slab previews (plain Flat Paint too) show a depth-precision speckle on top faces at some angles. The exported geometry is clean: no overlapping coplanar faces.
Proof:
Reviewed with sol-loop: 2 rounds with GPT-6.2 Sol on high. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code, reviewed by Claude Opus 5.5 and GPT-6.2 Sol.
🤖 Generated with Claude Code