mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 14:27:35 -06:00
A Color Lookup layer embeds its LUT file in the PSD (LUT3DFileData, LUTFormat, LUT3DFileName). Photoshop stores the file as loaded and tags its format; it never converts it. PhotoCraft kept only the parsed table, so every save re-encoded it as .cube with LUTFormatCUBE while keeping the original name: a layer loaded from "Film.3dl" was saved as .cube data under a .3dl name. The layer now keeps the file it was loaded from (its format and bytes, `ColorLookup::source`), set when a PSD is read and when the colorLookup command loads `data`/`file`, and cleared when a built-in look or "none" replaces the table. A PSD save writes those bytes and format back unchanged, but only while they still parse to the layer's table, so the stored file can never go stale. Otherwise (a table made in PhotoCraft, or one that no longer matches) it falls back to .cube as before and swaps a .3dl/.look extension in the name for .cube. The new field is `#[serde(default)]` and skipped when empty, so older .pcraft files load unchanged. lutfile gains Format::detect/parse_as so the recorded format is exactly the one the parser used. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>