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 && (