LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-EDIT-RESET: Reset Edits returns a raw to its import defaults, sharpening and colour NR included
radialmonster9da719c6ed5e
diff --git a/crates/engine/src/cmd/develop.rs b/crates/engine/src/cmd/develop.rsindex 33570f47b..3a84b1dcc 100644--- a/crates/engine/src/cmd/develop.rs+++ b/crates/engine/src/cmd/develop.rs@@ -239,10 +239,14 @@ pub fn specs() -> Vec<CommandSpec> {let fresh = match look {Some(l) => (*l).clone(),None => {+ // the photo's built-in defaults (raws: capture sharpening and colour noise+ // reduction, embedded lens corrections), as at import, with the white balance+ // of its current as-shot referencelet info = s.source_info(id);+ let defaults = s.catalog.photo(id).map(|p| p.camera_defaults()).unwrap_or_default();DevelopSettings {wb: lightcraft_develop::WhiteBalance { mode: WbMode::AsShot, temp: info.as_shot_temp, tint: info.as_shot_tint },- ..Default::default()+ ..defaults}}};diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rsindex cea8475e6..489b92cb3 100644--- a/crates/engine/src/tests.rs+++ b/crates/engine/src/tests.rs@@ -37,6 +37,33 @@ fn changing_one_wb_control_resolves_as_shot_without_stale_tint() {}}+/// Reset Edits on a raw goes back to its import defaults, capture sharpening and colour noise+/// reduction included (#763: reset left both at 0 while import sets 40 / 25); a rendered file+/// keeps none.+#[test]+fn reset_edits_restores_a_raws_import_defaults() {+ use lightcraft_catalog::{Photo, PhotoId, Source};+ use lightcraft_develop::DevelopSettings;+ let mut s = demo();+ for (id, format, raw) in [(200u64, "NEF", true), (201, "JPG", false)] {+ let name = format!("p{id}.{format}");+ let mut p = Photo::new(PhotoId(id), Source::File { path: name.clone() }, &name, format, 16, 16, "");+ if raw {+ p.as_shot_wb = Some((5200.0, 4.0));+ p.develop = std::sync::Arc::new(DevelopSettings::for_raw(5200.0, 4.0));+ }+ s.catalog.apply(lightcraft_catalog::Op::AddPhoto { photo: Box::new(p) }).unwrap();+ }+ for (id, want) in [(200, (40.0, 25.0)), (201, (0.0, 0.0))] {+ s.execute("library.select", &json!({"ids": [id], "active": id})).unwrap();+ s.execute("develop.set", &json!({"control": "detail.sharpenAmount", "value": 90})).unwrap();+ s.execute("develop.set", &json!({"control": "detail.nrColor", "value": 70})).unwrap();+ s.execute("develop.reset", &json!({})).unwrap();+ let d = active_dev(&s);+ assert_eq!((d.detail.sharpen_amount, d.detail.nr_color), want, "photo {id}");+ }+}+#[test]fn demo_library_loads() {let mut s = demo();