Let a photographer choose the film, and remember which one

The stock model rendered correctly and nothing could ask for it. This is
the picker, and the sidecar key that makes the choice outlive the session.

How the choice persists was the open question, and the answer was already
written down twice in sidecar.rs: `rating` is a top-level key "because a
rating is not an edit", and `masks` are one "because a layer is not a
scalar". A stock is that kind of thing -- a choice of material, not a
number a slider moves -- so it is a top-level key too.

It stores the **id**, not an index. Stocks are files that users add, so an
index would mean installing a profile silently changed which film every
existing photograph had been developed on. A name this build has no
profile for still round-trips untouched, because the alternative is that
syncing to an older phone quietly un-develops the picture.

Only the names travel. Turning one back into tables needs the profile
database, which dr-pipeline deliberately does not link, so `Version::apply`
clears the film and the session re-bakes -- after the parameters, because
the bake reads the film's own exposure sliders and the print balance is
solved against them. That is also why moving those sliders rebuilds the
lookup where no other control in the panel does: an enlarger's filtration
depends on how the negative was exposed.

The panel keeps its rule. It still names no operation and still generates
every control from a declared parameter kind; the stock gets a bespoke
control beside those, exactly as the mask stack does, and for the same
reason. The film's exposure and print exposure arrive as ordinary
generated sliders.

Two defaults worth stating. Picking a colour negative prints it, because
an unprinted one is an orange strip and offering that as the first thing
somebody sees after choosing Portra reads as a bug rather than as a
choice -- the toggle is there for anyone who wants the scan. And a paste
carries no film: a preset is a parameter map, and a stock is not a
parameter, so pasting one would paste a choice the clipboard never took.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 19:57:41 +02:00
co-authored by Claude Opus 5
parent 4a2fcb6d22
commit baa8957e80
16 changed files with 677 additions and 55 deletions
+5 -1
View File
@@ -1737,7 +1737,11 @@ mod tests {
// largest shader the pipeline can actually generate, which is the one
// with a film in it.
let tables = film_test_tables();
g.set_film_tables(Some(tables.clone()));
g.set_film(Some(dr_pipeline::graph::Film {
stock: "under_test".into(),
print: None,
tables: tables.clone(),
}));
pass.set_film(Some(&tables));
// Cropped, so the render is against an output size that is not the
+14 -1
View File
@@ -68,6 +68,15 @@ fn tables(baked: &dr_film::Baked) -> FilmTables {
}
}
/// A name for the baked stock.
///
/// The id is not carried on `Baked` — it is the *recipe's*, and a bake is a
/// pile of numbers. The tests here only need the graph to hold something, and
/// what it holds is checked by the sidecar's own tests rather than by pixels.
fn film_stock_of(_baked: &dr_film::Baked) -> &'static str {
"under_test"
}
/// Render a flat frame through a stock and return the centre pixel, 0..1.
///
/// The centre rather than a corner: a demosaic invents its edges, and the
@@ -79,7 +88,11 @@ fn rendered(ctx: &GpuContext, level: u16, baked: &dr_film::Baked) -> [f32; 3] {
.expect("demosaic");
let mut graph = EditGraph::default_chain();
graph.set_film_tables(Some(tables(baked)));
graph.set_film(Some(dr_pipeline::graph::Film {
stock: film_stock_of(baked).to_string(),
print: None,
tables: tables(baked),
}));
let shader = graph.compose();
let mut adjust = AdjustPass::new(ctx);