mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-31 21:48:53 -06:00
Reviewing #2952 turned up two more shapes of the same bug, both on the path this branch is about. `effective_wb` ignores the temp / tint stored on an `As Shot` white balance — it answers the file's as-shot white — and on a raw edited in Kelvin it also ignores a named preset mode's stored numbers, through `WbMode::preset`. So a one-field partial that names its scale, `wb {temp: 5800, scale: "kelvin"}`, merged into such a photo, was stored and then read by nothing: the panel shows 5800 K while the render stays at as shot, and the stored tint no longer matches what renders. An unmarked partial already materialized a Custom value through the relative-scale conversion; the named-scale ones never did. The photo's preparation now writes out the white the photo really renders as Custom values before the partial lands, for `As Shot` and for preset modes on a Kelvin source. `Auto` keeps its mode — its gray is resolved and stored when the mode is set, not at render time — and a partial that names a `mode` itself stays authoritative. Sources without the Kelvin scale (a raw whose camera has no matrices, a rendered file) had the same swallow, and the number reaches their render now. The issue asks for one photo-aware merge in every caller that writes settings onto a photo, and names preset apply. `preset.apply` ran `Preset::apply` → `apply_partial` → `DevelopSettings::merged` and never saw the photo's scale, so a preset authored by hand naming one white balance number still had the original bug; measured on a photo at 5000 K / +12, it landed the photo on the relative scale and moved the tint it never mentioned. The preparation and the normalize-back now wrap `Preset::apply` per photo, with the amount blending and the mask merging untouched, which also puts an amount below 100 % on a single scale. Presets the app writes (`preset.create` → `extract_groups`) and the crs / XMP importers name mode, temp, tint and scale together and so land in the branch that behaves exactly as before. Tests: the `As Shot` and preset-mode cases in the #2910 merge test, and the new `preset.apply` test, fail before this commit (the first stores the number in a mode that renders the photo's old white; the second demotes the photo to `Legacy`); the same test then pins that `preset.apply` and `develop.merge` agree on a one-field white balance, which is the point of having one merge. Docs: the rule for an agent is in `docs/control-protocol.md` and `docs/mcp.md`, recorded on the `LR-EDIT-COLOR-TEMP` row of `docs/parity-checklist.md`, and in `docs/whats-new.md`. Co-Authored-By: Claude <noreply@anthropic.com>