AI media harness for planning, generating, and editing locally
TypeScript
Copy and paste effect settings
Bitti8a640430abf3
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 7f64526..80337a9 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -25,6 +25,7 @@ This alpha update adds DMAD LoRA support, resumable model downloads, and improve## Fixes and improvements+- Copy and paste effect settings between matching effects from their **…** menus, including bypass state and LUT data.- Add voice reference chips directly in a shot's Speech field. Voice guidance stays separate from the words spoken.- Removing a reference from a scene's last prompt citation now removes it from generation inputs and “Used by.” References selected as frame or motion inputs remain active.- Reference chips now highlight when included in a prompt's text selection.diff --git a/src/components/workspace/ClipEffects.test.tsx b/src/components/workspace/ClipEffects.test.tsxindex abfb23f..5d78cb3 100644--- a/src/components/workspace/ClipEffects.test.tsx+++ b/src/components/workspace/ClipEffects.test.tsx@@ -3,6 +3,7 @@ import { act, cleanup, fireEvent, render, screen, within, waitFor } from "@testiimport { useState } from "react";import { afterEach, describe, expect, it, vi } from "vitest";import { timelineClipSchema, type TimelineClip } from "../../lib/project";+import { parseCube } from "../../lib/effectSettings";import { ClipEffects } from "./ClipEffects";vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));@@ -41,6 +42,87 @@ async function inTauri(answers: Record<string, (args: unknown) => unknown>, bodyconst CUBE = "LUT_3D_SIZE 2\n0 0 0\n1 0 0\n0 1 0\n1 1 0\n0 0 1\n1 0 1\n0 1 1\n1 1 1";describe("clip effects", () => {+ it("disables Paste settings until settings have been copied", () => {+ render(<ClipEffects clip={{ ...original, sharpen: { amount: 50 } }} disabled={false} onChange={vi.fn()} />);+ fireEvent.click(screen.getByRole("button", { name: "Sharpen options" }));+ expect((screen.getByRole("menuitem", { name: "Paste settings" }) as HTMLButtonElement).disabled).toBe(true);+ });++ it.each([+ { name: "Look", patch: { look: { opacity: 65, temperature: -30, enabled: false } } },+ { name: "Transition", patch: { transition: { type: "wipe-left", durationMs: 1200 } } },+ { name: "Chroma key", patch: { chromaKey: { color: "#123456", tolerance: 43 } } },+ { name: "Sharpen", patch: { sharpen: { amount: 125 } } },+ { name: "Gaussian blur", patch: { blur: { radius: 8.5 } } },+ { name: "Colour correction", patch: { colorCorrection: { exposure: -1.2, contrast: 20, saturation: 75 } } },+ { name: "Vignette", patch: { vignette: { amount: 75 } } },+ { name: "3D LUT", patch: { lut: { intensity: 45, table: parseCube(CUBE, "identity.cube") } } },+ ] satisfies { name: string; patch: Partial<TimelineClip> }[])("copies $name settings to another clip as one independent edit", ({ name, patch }) => {+ const onChange = vi.fn();+ const source = timelineClipSchema.parse({ ...original, ...patch });+ const view = render(<ClipEffects clip={source} disabled={false} onChange={onChange} />);+ fireEvent.click(screen.getByRole("button", { name: `${name} options` }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Copy settings" }));+ expect(onChange).not.toHaveBeenCalled();+ // Clipboard survives leaving the inspector, including a different clip.+ view.unmount();+ const target = timelineClipSchema.parse({ ...source, id: "target", label: "Target clip", startMs: 3000 });+ render(<ClipEffects clip={target} disabled={false} onChange={onChange} />);+ fireEvent.click(screen.getByRole("button", { name: `${name} options` }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Paste settings" }));+ expect(onChange.mock.calls).toEqual([[patch, undefined]]);+ const applied = timelineClipSchema.parse({ ...target, ...onChange.mock.calls[0][0] });+ expect(applied).toMatchObject({ ...patch, id: "target", label: "Target clip", startMs: 3000 });+ const key = Object.keys(patch)[0] as keyof TimelineClip;+ expect(onChange.mock.calls[0][0][key]).not.toBe(source[key]);+ });++ it("does not paste settings into a different effect type", () => {+ render(<Harness />);+ add("Sharpen");+ add("Gaussian blur");+ fireEvent.click(screen.getByRole("button", { name: "Sharpen options" }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Copy settings" }));+ fireEvent.click(screen.getByRole("button", { name: "Gaussian blur options" }));+ const paste = screen.getByRole("menuitem", { name: "Paste settings" }) as HTMLButtonElement;+ expect(paste.disabled).toBe(true);+ fireEvent.click(paste);+ expect(saved().blur).toEqual({ radius: 4 });+ });++ it("keeps LUT snapshots independent of the source and previous pastes", () => {+ const lut = { intensity: 45, table: parseCube(CUBE, "identity.cube") };+ const expected = structuredClone(lut);+ const onChange = vi.fn();+ const view = render(<ClipEffects clip={{ ...original, lut }} disabled={false} onChange={onChange} />);+ fireEvent.click(screen.getByRole("button", { name: "3D LUT options" }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Copy settings" }));+ lut.table.values[0] = 0.9;+ view.rerender(<ClipEffects clip={{ ...original, id: "target", lut: { intensity: 100 } }} disabled={false} onChange={onChange} />);+ for (let index = 0; index < 2; index++) {+ fireEvent.click(screen.getByRole("button", { name: "3D LUT options" }));+ fireEvent.click(screen.getByRole("menuitem", { name: "Paste settings" }));+ const pasted = onChange.mock.calls.at(-1)![0].lut;+ expect(pasted).toEqual(expected);+ pasted.table.values[0] = 0.5;+ }+ });++ it("closes the settings menu when the clip changes or becomes locked", () => {+ const clip = { ...original, sharpen: { amount: 50 } };+ const onChange = vi.fn();+ const view = render(<ClipEffects clip={clip} disabled={false} onChange={onChange} />);+ fireEvent.click(screen.getByRole("button", { name: "Sharpen options" }));+ view.rerender(<ClipEffects clip={{ ...clip, id: "target" }} disabled={false} onChange={onChange} />);+ expect(screen.queryByRole("menu")).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Sharpen options" }));+ view.rerender(<ClipEffects clip={{ ...clip, id: "target" }} disabled onChange={onChange} />);+ expect(screen.queryByRole("menu")).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Sharpen options" }));+ expect(screen.queryByRole("menu")).toBeNull();+ expect(onChange).not.toHaveBeenCalled();+ });+it("bypasses an effect from its header checkbox, keeping its settings", () => {render(<Harness />);add("Sharpen");diff --git a/src/components/workspace/ClipEffects.tsx b/src/components/workspace/ClipEffects.tsxindex 694f464..3d00287 100644--- a/src/components/workspace/ClipEffects.tsx+++ b/src/components/workspace/ClipEffects.tsx@@ -1,4 +1,4 @@-import { Add16, ChevronDown12, FolderOpen14, More14, Reset14, Reset16 } from "../ui/icons";+import { Add16, ChevronDown12, Copy16, FolderOpen14, More14, Paste16, Reset14, Reset16 } from "../ui/icons";import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from "react";import { DEFAULT_CLIP_CHROMA_KEY, DEFAULT_CLIP_LOOK, type TimelineClip } from "../../lib/project";import { isEffectOn, parseCube } from "../../lib/effectSettings";@@ -8,6 +8,9 @@ import { Checkbox, ComboBox, Flyout, PropRow, Slider, tooltipProps, useContextMeimport { ColorSwatch } from "./ColorPicker";type EffectId = "look" | "transition" | "chromaKey" | "sharpen" | "blur" | "colorCorrection" | "vignette" | "lut";+// Keep copied settings across clip selections and inspector remounts, like the+// image-node clipboard. Snapshots include bypass and embedded LUT data.+let effectClipboard: { id: EffectId; settings: NonNullable<TimelineClip[EffectId]> } | null = null;/** `key` names a run of edits to one parameter (a slider drag), so the* project's undo stack folds it into one step. */type Update = (patch: Partial<TimelineClip>, key?: string) => void;@@ -204,6 +207,7 @@ function EffectBlock({ effect, clip, disabled, update, onRemove }: {is one step rather than sixty. */const keyed: Update = (patch, key) => update(patch, key ?? effect.id);const menu = useContextMenu();+ useEffect(() => menu.close(), [clip.id, disabled, menu.close]);const settings = clip[effect.id] as { enabled?: boolean | null } | null | undefined;const on = isEffectOn(settings);/* Reset puts the values back, not the bypass: a switched-off effect stays off. */@@ -233,6 +237,14 @@ function EffectBlock({ effect, clip, disabled, update, onRemove }: {{...tooltipProps("More options")}disabled={disabled}onClick={() => more.current && menu.open(more.current, [+ { label: "Copy settings", icon: <Copy16 />, onSelect: () => {+ const values = clip[effect.id];+ if (values) effectClipboard = { id: effect.id, settings: structuredClone(values) };+ } },+ { label: "Paste settings", icon: <Paste16 />, disabled: effectClipboard?.id !== effect.id, onSelect: () => {+ if (effectClipboard?.id === effect.id) update({ [effect.id]: structuredClone(effectClipboard.settings) });+ } },+ { separator: true },{ label: "Reset", icon: <Reset16 />, onSelect: reset },{ separator: true },{ label: "Remove", shortcut: "Delete", danger: true, onSelect: onRemove },