From d4cce4e00101fbd90128ee23ed60680e54c8e890 Mon Sep 17 00:00:00 2001 From: Brian Hursey Date: Sat, 28 Nov 2026 05:49:47 +0000 Subject: [PATCH] Apply a camera profile to every raw from the same camera body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A DCP matrix describes the sensor, so a profile chosen for one frame belongs to all camera-native raws from that body; the panel offers the bulk apply when the library holds more photos than the one on screen. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- src/components/Develop.tsx | 31 +++++++++++++++++++++++++++++++ src/components/Panels.tsx | 27 ++++++++++++++++++++++++++- src/lib/dcpLibrary.test.ts | 14 ++++++++++++++ src/lib/dcpLibrary.ts | 29 +++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 1 deletion(-) diff --git a/src/components/Develop.tsx b/src/components/Develop.tsx index 4c2b32b..222fa1f 100644 --- a/src/components/Develop.tsx +++ b/src/components/Develop.tsx @@ -9,6 +9,7 @@ import { import { subscribeClipPreview } from '../lib/clipPreview'; import { get16BitSource, getBitmap, getDenoisedBitmap } from '../lib/images'; import { rebuildProofCube, restoreProofProfile } from '../lib/softProof'; +import { photosForCamera } from '../lib/dcpLibrary'; import type { Preview16 } from '../lib/preview16'; import { useMediaQuery } from '../lib/useMediaQuery'; import { usePersistentState } from '../lib/usePersistentState'; @@ -271,6 +272,13 @@ export default function Develop({ } | null>(null); const edits = photo.edits; + // A DCP matrix describes the sensor, so one profile can serve every raw from + // the same body; the panel offers a bulk apply only when there is more than + // this photo to update. + const cameraProfileTargets = useMemo( + () => photosForCamera(photos, photo.meta?.camera), + [photos, photo.meta?.camera], + ); const activeLocal = (edits.local ?? []).find((layer) => layer.id === localSelected) ?? null; const zoomed = zoom.pct !== 'fit'; @@ -1555,6 +1563,29 @@ export default function Develop({ photo={photo} set={setEdits} cameraNative={Boolean(hdrSource?.rgbCam)} + cameraPhotoCount={cameraProfileTargets.length} + onApplyToCamera={ + onUpdateEdits + ? (profile) => { + const count = cameraProfileTargets.length; + const camera = photo.meta?.camera || 'this camera'; + if ( + !window.confirm( + `Apply “${profile.name}” to ${count} photos from ${camera}? ` + + 'This replaces any camera profile they already use.', + ) + ) { + return false; + } + onUpdateEdits( + cameraProfileTargets.map((target) => target.id), + { cameraProfile: profile }, + 'Camera profile', + ); + return true; + } + : undefined + } /> boolean | void; +}) { const [error, setError] = useState(null); + const [appliedAll, setAppliedAll] = useState(null); const profile = edits.cameraProfile; const camera = photo.meta?.camera ?? ''; // Saved per camera body: the matrix describes the sensor, so every frame from @@ -2291,6 +2300,22 @@ export function CameraProfilePanel({ )} + {profile && onApplyToCamera && cameraPhotoCount > 1 && ( + + )} + {appliedAll !== null && ( +

+ Applied to {appliedAll} photos from this camera. +

+ )} {applied && (