moe-settings-previews
Invoke when the MoE Calculator settings-panel widget preview PNGs must be regenerated — after ANY change to the shipped in-battle widget CSS/JS that alters a widget's look (MoEBattle*, MoEEfficiency*,
SKILL.md.claude/skills/moe-settings-previews/SKILL.md
GitHubRegenerating the settings-panel preview PNGs
Six transparent PNGs at src/res/gui/maps/icons/moe_calculator/previews/, shown live in the
MSA settings panel via two Image controls (mod_settings.py CALC_PREVIEW_KEY /
BAR_PREVIEW_KEY), so the user can see a widget's look without starting a battle:
calc_assist_on.png/calc_assist_off.png— in-battle calculator,countedAssist3-row / 2-row.bar_eff_horizontal.png/bar_eff_vertical.png— Damage Efficiency bar, both orientations.bar_ma_horizontal.png/bar_ma_vertical.png— Moving Average (Progress) bar, both orientations.
Full background/rationale: TASKS/settings-preview-images.md.
Run the generator
py tools/dev/gen_settings_previews.py
Dev-only deps: py -m pip install pillow playwright (no playwright install / browser
download needed). It drives the system WebView2-runtime Chromium
(C:\Program Files (x86)\Microsoft\EdgeCore\<ver>\msedge.exe, globbed — highest version wins)
via Playwright, omit_background=True, device_scale_factor=4 (SUPERSAMPLE — real Chromium
supersampling, not a post-hoc PIL upscale), waits for the hold-fade-in, floors output alpha,
then Pillow alpha-bbox-crops. Ships the FULL 4x crop — MSA's own width/height do the
downscale at render time.
Source tuners (tools/dev/gen_settings_previews.py's _JOBS):
TASKS/refs/in-battle-overlay-tuner.html— calculator (both assist states viasetAssist(false)).tools/dev/eff_bar_tuner.html/eff_bar_tuner_vertical.html— Damage Efficiency H/V.TASKS/refs/in-battle-bar-tuner.html/in-battle-bar-tuner-vertical.html— Moving Average H/V.
Each bar job uses the tuner's OWN default on-load state (the same state its check_*.js gate
already verifies) — do not drive it. _STRIP_SCENE_CSS hides the tuner's own scene dressing
(.panel, #ribbons, #mmMock, #loupe) before the shot; none of that is shipped widget CSS.
Accuracy gate — MANDATORY before trusting any render
- The tuners derive from the shipped CSS, not the reverse. If shipped widget CSS changed,
regenerate the tuners FIRST:
pwsh tools/dev/gen_bar_tuner_vertical.ps1 -EmitCss,node tools/dev/make_eff_vertical_artifact.js,pwsh tools/dev/gen_overlay_tuner.ps1, and refresh any gate reference the documented way (see moe-progress / moe-battle skills). - Run ALL four drift gates and require GREEN before rendering:
node tools/dev/check_eff_css.js,check_eff_vertical.js,check_bar_vertical.js,check_overlay_css.js. - These gates are BYTE-level, not geometry-level. They diff CSS text/tokens — they do NOT
catch rendered icon/backdrop MISPOSITIONING. When geometry changed, also measure elements via
Playwright
getBoundingClientRect()against the shipped CSS's intended positions before trusting a render. A gate-green tuner can still paint icons in the wrong place — this bit thebar_ma_horizontalandbar_eff_horizontalrenders (see Gotchas below).
Wiring the output (mod_settings.py)
- MSA
Imagesourceis a bare Scaleform resource path,gui/maps/icons/moe_calculator/previews/<name>.png— never the Gamefaceimg://scheme. MSA's Image control is Scaleform/AS3 feeding a WGUILoaderAlt/Loader; animg://URL fails silently there, leaving the reserved box blank (mod_settings.py:501-506). - The PNGs are 4x-supersampled; MSA must DOWNSCALE.
_PREVIEW_DISPLAY(mod_settings.py:514) maps each name → display(w, h)px, passed aswidth/heighton both the_imagedescriptor and everyupdateImageswap. NOT yet live-confirmed that MSA's AS3 loader honorswidth/heightas a scale rather than a crop — revisit if the live panel shows cropped/ unscaled previews. _CALC_PREVIEW_W/Hand_BAR_PREVIEW_W/H(the reserved container size) = the MAX display dims across each swappable set, so the panel doesn't jump when the image swaps.- Both preview varNames are addressing handles for
updateImage, deliberately absent fromDEFAULTS— never treat them as a stored setting or give them a template row (that whole class of bug is documented in memorymsa-drops-any-varname-without-a-template-rowand its family — these two are the deliberate exception since they're never persisted). - After regen: if any render's display size changed, update
_PREVIEW_DISPLAY(and the two container maxes) and the three pin tests intests/test_mod_settings.py.
Gotchas (all live-confirmed during the build/tuning pass)
- Alpha haze.
omit_backgroundcapture over stacked masked/gradient layers leaves a low-alpha (~0-40) veil across nearly the whole stage — independent of GPU vs software render (--disable-gpu,--disable-gpu-compositing,--use-gl=swiftshaderall tried, none changed it). Fix is an OUTPUT alpha floor (T=45 for bars, T=10 for the calculator — its page has no haze), not a launch arg. The flat T=45 floor applies to all bars (the protected-floor machinery was removed); the backdrop is hidden via_STRIP_SCENE_CSS. - Wait ≥2s before capture. The bars hold-fade in on load; a short wait under-renders every alpha value (calculator has no such fade — 200ms suffices there).
- The bare Edge CLI is broken for this.
msedge.exe --screenshot --default-background-color=00000000caps captured alpha at ~41/255 on this build — must go through Playwright'somit_background, not the CLI flag. - Raster
.pkgicons cap at source resolution — quest glyphs 128x128, marksOnGun pips have no larger variant. Supersampling the PAGE doesn't fix an icon asset that was already small; a hard crispness ceiling for those specific glyphs, not a bug in this pipeline. calc_assist_offmust TOP-align, not center-pad, intocalc_assist_on's taller canvas. The two share a container so the panel doesn't jump whencountedAssisttoggles between the 2-row and 3-row calculator, butcalc_assist_on(3 rows) is strictly taller. Center-padding the shorteroffcrop into that canvas shifts rows 1/2 vertically relative toon— the "toggling the 3rd row moves the whole preview" regression, since rows 1/2 are the SAME content in both states and must stay registered at the same y. Top-align (y = 0) instead: rows 1/2 land identically in both crops, and the missing 3rd row becomes transparent padding at the BOTTOM only. This is a deliberate product decision (no shift on toggle beats a standalone centered look) — seegen_settings_previews.pyaround thecalc_assist_offpadding step for the exact code and comment.
Verify
- Composite each PNG onto the MSA dark panel colour (
#2b2d30) and eyeball; an HTML gallery artifact (4x source next to its display-size render) is a useful throwaway for this. - Live-only, needs a deployed client: MSA actually downscales via
width/height(LIVE-ONLY, unconfirmed, see wiring note above), the previews render at all, and geometry reads aligned in-client — none of this is checkable from the dev box alone.