Apply a camera profile to every raw from the same camera body

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 <noreply@codebuff.com>
This commit is contained in:
2026-11-28 05:49:47 +00:00
parent 749047ae9e
commit d4cce4e001
4 changed files with 100 additions and 1 deletions
+31
View File
@@ -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
}
/>
<ProofPanel
edits={edits}
+26 -1
View File
@@ -2211,8 +2211,17 @@ export function CameraProfilePanel({
photo,
set,
cameraNative = false,
}: PanelSetProps & { cameraNative?: boolean }) {
cameraPhotoCount = 0,
onApplyToCamera,
}: PanelSetProps & {
cameraNative?: boolean;
/** Camera-native raws from this body, including the photo on screen. */
cameraPhotoCount?: number;
/** Apply the current profile to every photo from this camera body. */
onApplyToCamera?: (profile: { name: string; matrix: number[] }) => boolean | void;
}) {
const [error, setError] = useState<string | null>(null);
const [appliedAll, setAppliedAll] = useState<number | null>(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({
</select>
</label>
)}
{profile && onApplyToCamera && cameraPhotoCount > 1 && (
<button
className="btn ghost small"
onClick={() => {
const done = onApplyToCamera({ name: profile.name, matrix: profile.matrix });
if (done !== false) setAppliedAll(cameraPhotoCount);
}}
>
Apply “{profile.name}” to {cameraPhotoCount} photos
</button>
)}
{appliedAll !== null && (
<p className="muted small panel-hint">
Applied to {appliedAll} photos from this camera.
</p>
)}
{applied && (
<button
className="btn ghost small"