Files
craft-libs/crates/develop-model/README.md
Tex Jernigan db9e24391a craft-develop-model and craft-geom: develop settings and crs: import, from LightCraft (#1132)
* craft-geom and craft-develop-model: develop settings and crs: import, from LightCraft

craft-develop-model is lightcraft-develop (settings, controls, presets,
segmentation masks, process versions) plus the crs: import from
lightcraft-engine (crs.rs, crs_masks.rs). craft-geom is lightcraft-geom,
which the model and the coming develop pipeline both need. Step 3 of #587.

* craft-develop-model, craft-geom: review fixes to copy, presets, section reset and crs: import

Copy and presets: to_json_for_merge states every setting the stored JSON
leaves out at its default, so copying a group turns HDR, the camera's local
tone and Lens Blur's optional settings off on the target, and a preset at an
amount starts from them. A preset at no amount adds no mask, and its Lens
Blur focus mask follows its mask to the id the photo gives it.

Reset and range: reset_section resets the sliders of point colours and red
eyes, Upright with its guides, and the two Optics switches. Settings from
outside the app keep the list sliders in range. is_unedited counts a chosen
white balance as an edit.

crs: import: a brush dab that is not a finite number is dropped instead of
failing the whole packet, brush runs that differ in MaskInverted stay two
components, RetouchInfo is read only without RetouchAreas, and an XMP preset
keeps its masks. SegMask::from_logits does not overflow on an absurd side.

craft-geom: Homography::from_quads solves a mapping that sends the origin
to infinity, by solving again about the middle of the source quad.

Docs: the links to LightCraft's light-v3.md and grain.md point at that
repository, and xmp-interop.md says when the older fields are read. The
README lists what now differs from LightCraft.

* craft-develop-model, craft-geom: second round of review fixes to crs: import, mask grids, crop and quads

A range mask with a number that is not one failed the whole merge; a straight legacy ToneCurve and a
photo's switched-off masks or spots were left unsaid, so the photo kept what it had; a mask grid of a
side past the limit was cut to 32 bits; a crop restored under a new angle could reach outside the
photo; a quad mapping onto a collapsed quad solved to a matrix that does not map it.
2026-11-18 15:35:02 -05:00

4.1 KiB

craft-develop-model

Raw develop settings as data: the second of the three crates planned in craft-libs#587 (craft-raw, craft-develop-model, craft-develop). No rendering, no GPU, no I/O. An app can store, copy, merge, migrate and serialise a photo's edits without depending on the pipeline.

craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "<commit>" }

The base is LightCraft's lightcraft-develop and the crs: import from lightcraft-engine (crs.rs, crs_masks.rs) at a75497d6. Issue numbers in comments are LightCraft's (storytold/lightcraft#N).

What is here

Module Contents
settings DevelopSettings, the complete, serialisable description of a photo's look: white balance (Kelvin or relative scale), light, tone curve, HSL / mixer / point colour, B&W mix, colour grading, calibration, effects (vignette, grain), detail, optics (lens profile, embedded corrections, defringe), geometry and Upright, crop, masks (brush, linear, radial, range, AI segmentation), spots, red eye, lens blur, enhance, HDR. ProcessVersion / Process: which formulas an edit renders with, so later formula changes leave existing edits alone (process versions).
controls CONTROLS: every numeric slider by id, with its label, section, range, default, step and track gradient. UIs and agents address sliders through it.
presets Preset, SettingsGroup (the groups a copy, paste, sync or preset covers), extract_groups, apply_partial (a partial settings object merged at an amount), deep_merge.
segmask SegMask: a compressed AI segmentation mask stored inside the settings.
crs, crs_masks Camera Raw / Lightroom crs: properties (from craft_metadata::parse_xmp) mapped to a partial DevelopSettings JSON object, which is merged like a preset: global adjustments, tone curves, white balance (Target decides how a crs: temperature is read), crop, Upright, local corrections and retouch spots, with a report of what was read and what was left out. preset_from_xmp reads an XMP preset. The field table is in xmp-interop.

Reading the crs: packet itself (names, structures, Camera Raw's number formats) is craft-crs's job; this crate decides what those settings mean for the edit model. The mapping is a best-effort approximation of the other application's look, not a pixel match.

Different from LightCraft

Fixes made here that LightCraft a75497d6 does not have. It gets them when it switches to this crate.

  • to_json_for_merge states every setting the stored JSON leaves out at its default (HDR, the profile and its camera local tone, the curve, Lens Blur's and Denoise's optional settings), not only Remove Hot Pixels. Copying a group turns them off on the target, and a preset at an amount starts from them.
  • reset_section resets the sliders of point colours and red eyes, Upright with its guides, and the lens profile and Remove Chromatic Aberration switches. Settings from outside the app keep those sliders in range.
  • is_unedited counts a chosen white balance as an edit. As shot, the numbers stay the photo's own.
  • A preset at no amount adds no mask, and its Lens Blur focus mask follows its mask to the id the photo gives it.
  • crs: import: a brush dab that is not a finite number is dropped, brush runs that differ in crs:MaskInverted stay two components, crs:RetouchInfo is read only without crs:RetouchAreas, and an XMP preset keeps its masks.
  • Homography::from_quads (craft-geom) solves a mapping that sends the origin to infinity.

Not here yet

  • Writing crs: back from DevelopSettings. LightCraft writes its own lc:settings in a sidecar; PhotoCraft's Camera Raw writes crs:. That comes with the PhotoCraft switch, together with the migration of PhotoCraft's current Camera Raw settings.
  • The tests that render a mask or a spot to check its sense (inside or outside a radial, where a spot lands) need the pipeline. They come back with craft-develop. The mapping half of each is kept here.
  • LightCraft-only paths: Target from a catalog photo, and .lrtemplate (Lua) presets.