Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

Three inspector tabs with sections, undo on the keyboard, and one undo per drag

Jareer4e88748c17ac
diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rs
index 80644729..87fe74dd 100644
--- a/engine/crates/concat/src/studio.rs
+++ b/engine/crates/concat/src/studio.rs
@@ -541,6 +541,14 @@ pub struct Studio {
pub gesture: Gesture,
/// The snap lines of a stage move in flight; empty between moves.
pub stage_guides: Vec<StageGuideData>,
+ /// Where the inspector should go, and a count that changes every time
+ /// something is applied from the library; see `Editor.inspector-jump-token`.
+ pub inspector_jump: (i32, &'static str, &'static str),
+ /// The last inspector commit: what it changed and when. A control that
+ /// is dragged commits on every move, and each of those would be an undo
+ /// step of its own; a commit that changes the same thing as the last
+ /// one, within a moment of it, replaces it in the history instead.
+ last_commit: Option<(String, std::time::Instant)>,
/// Each title's painted block in frame pixels, by clip id, as of the
/// last time the monitor asked for a frame. What the stage box for a
/// text clip is drawn from; see `footprint`.
@@ -643,6 +651,53 @@ fn format_of(unit: &str) -> ParamFormat {
}
}
+/// What a batch of inspector commands touches, as a string two commits can
+/// be compared by: the variant names, and for a patch the fields it sets.
+fn commit_key(commands: &[Command]) -> String {
+ commands
+ .iter()
+ .map(|command| match command {
+ Command::SetClipTransform { .. } => "transform".to_owned(),
+ Command::SetClipSpeed { .. } => "speed".to_owned(),
+ Command::SetClipSpeedCurve { .. } => "curve".to_owned(),
+ Command::SetClipAnimation { slot, .. } => format!("animation:{slot:?}"),
+ Command::UpdateClip { patch, .. } => {
+ let mut fields = Vec::new();
+ if patch.name.is_some() {
+ fields.push("name");
+ }
+ if patch.volume.is_some() {
+ fields.push("volume");
+ }
+ if patch.fade_in.is_some() {
+ fields.push("fade_in");
+ }
+ if patch.fade_out.is_some() {
+ fields.push("fade_out");
+ }
+ if patch.opacity.is_some() {
+ fields.push("opacity");
+ }
+ if patch.text.is_some() {
+ fields.push("text");
+ }
+ if patch.video_effects.is_some() {
+ fields.push("video_effects");
+ }
+ if patch.filters.is_some() {
+ fields.push("filters");
+ }
+ if patch.crop.is_some() {
+ fields.push("crop");
+ }
+ format!("patch:{}", fields.join("+"))
+ }
+ _ => "other".to_owned(),
+ })
+ .collect::<Vec<_>>()
+ .join(",")
+}
+
/// The menu row of a slot's animation: -1 for none.
fn slot_index(
slot: concat_project::model::AnimationSlot,
@@ -855,6 +910,8 @@ impl Studio {
divider_press: None,
gesture: Gesture::None,
stage_guides: Vec::new(),
+ inspector_jump: (0, "", ""),
+ last_commit: None,
title_blocks: HashMap::new(),
drop: None,
host,
@@ -1014,6 +1071,9 @@ impl Studio {
/// because the session's project is the truth again.
pub fn apply(&mut self, command: Command) -> Option<String> {
self.echo = None;
+ // Anything but an inspector commit ends the coalescing window; the
+ // commit path sets `last_commit` again right after calling here.
+ self.last_commit = None;
let session = self.session.as_mut()?;
match session.apply(command) {
Ok(view) => {
@@ -1742,6 +1802,24 @@ impl Studio {
}
};
self.apply(Command::UpdateClip { clip_id, patch });
+ // Show it: the applied chain is where the knobs are, and a card
+ // that did something with no visible result reads as a card that
+ // did nothing.
+ let is_look = Catalogue::builtin()
+ .packages()
+ .find(|package| package.answers_to(id))
+ .is_some_and(|package| package.kind() == PackageKind::Filter);
+ self.inspector_jump = (
+ self.inspector_jump.0 + 1,
+ if video { "Effects" } else { "Audio" },
+ if !video {
+ "Sound"
+ } else if is_look {
+ "Filters"
+ } else {
+ "Effects"
+ },
+ );
}
pub fn apply_transition(&mut self, id: &str) {
@@ -2438,8 +2516,27 @@ impl Studio {
commands.push(Command::UpdateClip { clip_id: id, patch });
}
self.echo = None;
+ if commands.is_empty() {
+ return;
+ }
+ // One undo step per gesture, not per pointer move: a commit that
+ // changes the same things on the same clip as the last, within a
+ // moment of it, takes the last one's place. Every command here sets
+ // absolute values, so undoing the previous and applying this lands
+ // where this alone would have.
+ let key = format!("{}:{}", after.id, commit_key(&commands));
+ let now = std::time::Instant::now();
+ let coalesce = self
+ .last_commit
+ .as_ref()
+ .is_some_and(|(last, at)| *last == key && now.duration_since(*at).as_millis() < 900);
+ if coalesce
+ && let Some(session) = self.session.as_mut()
+ && session.can_undo()
+ {
+ session.undo();
+ }
match commands.len() {
- 0 => {}
1 => {
self.apply(commands.remove(0));
}
@@ -2447,6 +2544,7 @@ impl Studio {
self.apply(Command::Batch { commands });
}
}
+ self.last_commit = Some((key, now));
}
// ── the stage ──
@@ -3760,6 +3858,9 @@ impl Studio {
});
editor.set_selected_clip(self.selected());
+ editor.set_inspector_jump_token(self.inspector_jump.0);
+ editor.set_inspector_jump_tab(self.inspector_jump.1.into());
+ editor.set_inspector_jump_section(self.inspector_jump.2.into());
let active = project
.timelines
.iter()
diff --git a/engine/crates/concat/ui/app.slint b/engine/crates/concat/ui/app.slint
index b63fdf1a..db6b618c 100644
--- a/engine/crates/concat/ui/app.slint
+++ b/engine/crates/concat/ui/app.slint
@@ -210,6 +210,16 @@ export component App inherits Window {
enabled: !root.on-start;
activated => { root.app-menu-selected("save"); }
}
+ KeyBinding {
+ keys: @keys(Control + Z);
+ enabled: !root.on-start;
+ activated => { root.app-menu-selected("undo"); }
+ }
+ KeyBinding {
+ keys: @keys(Control + Shift + Z);
+ enabled: !root.on-start;
+ activated => { root.app-menu-selected("redo"); }
+ }
// Space plays and pauses, the way it does in every editor. It lands
// here only when nothing else took it: a field being typed into
diff --git a/engine/crates/concat/ui/editor.slint b/engine/crates/concat/ui/editor.slint
index 7f3c2c4c..8be83983 100644
--- a/engine/crates/concat/ui/editor.slint
+++ b/engine/crates/concat/ui/editor.slint
@@ -115,6 +115,14 @@ export global Editor {
/// The Adjust tab: the colour package's knobs for the selected clip.
in-out property <[AppliedParamData]> adjust-params;
callback adjust-set(key: string, value: float);
+
+ /// Something was just applied from the library: the inspector should
+ /// show it. The token changes with every application; the tab and
+ /// section say where the thing landed. An inspector that opens later
+ /// reads them too, so the first one up shows the effect.
+ in-out property <int> inspector-jump-token;
+ in-out property <string> inspector-jump-tab;
+ in-out property <string> inspector-jump-section;
/// `audio` picks the chain: the sound's, or the picture's. A parameter
/// change lands on the echo and `clip-commit` makes it a command, the
/// same as every other inspector control.
diff --git a/engine/crates/concat/ui/workspace/config-pane.slint b/engine/crates/concat/ui/workspace/config-pane.slint
index 5a4e71f2..ee6c44bc 100644
--- a/engine/crates/concat/ui/workspace/config-pane.slint
+++ b/engine/crates/concat/ui/workspace/config-pane.slint
@@ -2,11 +2,12 @@
// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
import { Theme, SegmentedControl } from "../primitives/primitives.slint";
+import { Select } from "../primitives/select.slint";
import { Pane, PaneBody, PaneScroll } from "pane.slint";
import { PaneKind, PaneSwitcher } from "pane-switcher.slint";
import { EffectData } from "../demo/effects-panel.slint";
import {
- AdjustPanel, AnimationPanel, AppliedEntryData, AppliedParamData, AudioPanel,
+ AdjustPanel, AppliedEntryData, AppliedParamData, AudioPanel,
CatalogueEntryData, FilterPanel, PresetStack, SpeedPanel, VideoPanel,
} from "../inspector/clip-inspector.slint";
import { TextPanel } from "../inspector/text-panel.slint";
@@ -141,6 +142,12 @@ export component ConfigPane inherits Rectangle {
in property <[AppliedParamData]> adjust-params;
callback adjust-set(key: string, value: float);
+ /// See Editor.inspector-jump-token: the library applied something and
+ /// this pane should show it.
+ in property <int> jump-token;
+ in property <string> jump-tab;
+ in property <string> jump-section;
+
callback chain-add(audio: bool, id: string);
callback chain-toggle(audio: bool, index: int);
callback chain-move-by(audio: bool, index: int, delta: int);
@@ -153,14 +160,14 @@ export component ConfigPane inherits Rectangle {
callback clip-commit();
- // The tab strip follows the selection: nothing selected shows only
- // Details, since there is nothing to edit; a video clip shows everything;
- // a still has picture and no sound, so it loses Audio; a sound clip has
- // no picture, so it loses Filters and Effects; and a title gets Text
- // alone — offering the others would be offering panels that can only say
- // "nothing here". The words are the ones video editors' users know:
- // Filters are colour looks, Effects happen to the picture, Audio is the
- // voice and the room.
+ // The tab strip follows the selection, and stays short: three tabs at
+ // most, each with a dropdown of its sections, because seven tabs on a
+ // strip this narrow cannot be read. Video holds what happens to the
+ // picture - its placement, its speed, its animation, its colour; Audio
+ // the level, the fades and the voice and room chain; Effects the two
+ // shelves and the picture's chain. A still loses Audio, a sound clip
+ // keeps Audio alone, and a title gets Text alone — offering the others
+ // would be offering panels that can only say "nothing here".
property <bool> is-text: root.selected.kind == ClipKind.text;
property <bool> is-image: root.selected.kind == ClipKind.image;
property <bool> is-audio: root.selected.kind == ClipKind.audio;
@@ -168,11 +175,11 @@ export component ConfigPane inherits Rectangle {
/// it has no transform, no gain and no rate, and every other tab could
/// only say "nothing here".
property <bool> is-layer: root.selected.kind == ClipKind.filter;
- property <[string]> tabs: root.is-text ? ["Text", "Animation"]
+ property <[string]> tabs: root.is-text ? ["Text"]
: root.is-layer ? ["Filter"]
- : root.is-image ? ["Video", "Animation", "Adjust", "Filters", "Effects"]
- : root.is-audio ? ["Audio", "Speed"]
- : ["Video", "Audio", "Speed", "Animation", "Adjust", "Filters", "Effects"];
+ : root.is-image ? ["Video", "Effects"]
+ : root.is-audio ? ["Audio"]
+ : ["Video", "Audio", "Effects"];
/// A one-segment segmented control is a label wearing a costume, so a lone
/// tab renders as the panel's plain heading instead.
property <bool> single: root.tabs.length < 2;
@@ -181,7 +188,7 @@ export component ConfigPane inherits Rectangle {
// drop any binding declared here, so it is assigned and never bound.
property <int> tab;
/// The kind the strip was last built for. A selection change can leave the
- /// strip pointing past the end of a shorter list — Filters on a still,
+ /// strip pointing past the end of a shorter list — Audio on a still,
/// anything at all on a title — so the index is pulled back in when the
/// shape of the strip changes, and left alone when it has not.
property <ClipKind> strip-kind;
@@ -189,17 +196,65 @@ export component ConfigPane inherits Rectangle {
if (root.selected.kind != root.strip-kind) {
root.strip-kind = root.selected.kind;
// Clamped rather than reset: going from a video to a still should
- // stay on Effects, which both offer, instead of jumping back to
- // Adjust.
+ // stay on Effects, which both offer, instead of jumping back.
root.tab = Math.min(root.tab, root.tabs.length - 1);
}
}
- /// Which panel the index names, resolved once rather than at each `if`:
- /// the same number means different things depending on what is selected.
- property <string> showing: root.tabs[Math.max(0,
+ /// Which tab the index names.
+ property <string> heading: root.tabs[Math.max(0,
Math.min(root.tab, root.tabs.length - 1))];
+ /// The sections of the current tab, as the dropdown lists them.
+ // Animation is deliberately not offered yet: the engine plays it, but
+ // the panel for it is still to be designed.
+ property <[string]> sections: root.heading == "Video"
+ ? (root.is-image ? ["Basic", "Adjust"] : ["Basic", "Speed", "Adjust"])
+ : root.heading == "Audio"
+ ? (root.is-audio ? ["Sound", "Speed"] : ["Sound"])
+ : root.heading == "Effects" ? ["Filters", "Effects"]
+ : root.heading == "Text" ? ["Text"]
+ : ["Layer"];
+
+ // Each tab remembers its own section, so flipping to Audio and back
+ // lands on the colour panel you were adjusting. Assigned, never bound,
+ // for the same reason `tab` is.
+ property <int> section-video;
+ property <int> section-audio;
+ property <int> section-effects;
+ property <int> section-text;
+ property <int> section: root.heading == "Video" ? root.section-video
+ : root.heading == "Audio" ? root.section-audio
+ : root.heading == "Effects" ? root.section-effects
+ : root.heading == "Text" ? root.section-text
+ : 0;
+ function pick-section(index: int) {
+ if (root.heading == "Video") { root.section-video = index; }
+ else if (root.heading == "Audio") { root.section-audio = index; }
+ else if (root.heading == "Effects") { root.section-effects = index; }
+ else if (root.heading == "Text") { root.section-text = index; }
+ }
+
+ /// Which panel is up, resolved once rather than at each `if`: the same
+ /// number means different things depending on what is selected.
+ property <string> showing: root.sections[Math.max(0,
+ Math.min(root.section, root.sections.length - 1))];
+
+ // Go where the library just put something. On a fresh token, and once
+ // on opening, so an inspector that was not on screen when the effect
+ // was applied still opens on it.
+ function jump() {
+ if (root.jump-token == 0) { return; }
+ if (root.jump-tab == "Video") { root.tab = 0; }
+ else if (root.jump-tab == "Audio") { root.tab = root.is-audio ? 0 : 1; }
+ else if (root.jump-tab == "Effects") { root.tab = root.tabs.length - 1; }
+ if (root.jump-section == "Effects") { root.pick-section(1); }
+ else if (root.jump-section == "Filters") { root.pick-section(0); }
+ else { root.pick-section(0); }
+ }
+ changed jump-token => { root.jump(); }
+ init => { root.jump(); }
+
Pane {
// ── details ──────────────────────────────────────────────────────
if !root.has-selection: Rectangle {
@@ -380,19 +435,53 @@ export component ConfigPane inherits Rectangle {
}
}
+ // The tab's sections, as a dropdown under the strip. One section
+ // needs no dropdown: the strip already says where you are.
+ if root.has-selection && root.sections.length > 1: Rectangle {
+ height: 40px;
+ background: Theme.panel;
+
+ Rectangle {
+ x: 0;
+ y: parent.height - 1px;
+ width: parent.width;
+ height: 1px;
+ background: Theme.line;
+ }
+
+ HorizontalLayout {
+ padding-left: Theme.pad;
+ padding-right: Theme.pad;
+ spacing: 8px;
+
+ Text {
+ text: "Section";
+ color: Theme.fg-muted;
+ font-size: Theme.fs;
+ vertical-alignment: center;
+ }
+
+ Rectangle { horizontal-stretch: 1; }
+
+ VerticalLayout {
+ alignment: center;
+ Select {
+ width: 168px;
+ options: root.sections;
+ current: Math.max(0, Math.min(root.section, root.sections.length - 1));
+ changed(index) => { root.pick-section(index); }
+ }
+ }
+ }
+ }
+
if root.has-selection: PaneBody {
// No padding: the inspector rows carry their own 14px inset, and
// sections run edge to edge so their hairlines reach both sides.
padding: 0px;
PaneScroll {
- if root.showing == "Video": VideoPanel {
- selected: root.selected;
- set(field, value) => { root.clip-set(field, value); }
- commit => { root.clip-commit(); }
- }
-
- if root.showing == "Animation": AnimationPanel {
+ if root.showing == "Basic": VideoPanel {
selected: root.selected;
set(field, value) => { root.clip-set(field, value); }
commit => { root.clip-commit(); }
@@ -410,7 +499,7 @@ export component ConfigPane inherits Rectangle {
commit => { root.clip-commit(); }
}
- if root.showing == "Filter": FilterPanel {
+ if root.showing == "Layer": FilterPanel {
selected: root.selected;
set(field, value) => { root.clip-set(field, value); }
commit => { root.clip-commit(); }
@@ -426,7 +515,7 @@ export component ConfigPane inherits Rectangle {
// Audio: the level and fades, then the voice and room chain
// under them, as CapCut's audio tab has it.
- if root.showing == "Audio": VerticalLayout {
+ if root.showing == "Sound": VerticalLayout {
AudioPanel {
selected: root.selected;
set(field, value) => { root.clip-set(field, value); }
diff --git a/engine/crates/concat/ui/workspace/media-pane.slint b/engine/crates/concat/ui/workspace/media-pane.slint
index 3b0378d3..9979a0fb 100644
--- a/engine/crates/concat/ui/workspace/media-pane.slint
+++ b/engine/crates/concat/ui/workspace/media-pane.slint
@@ -999,7 +999,6 @@ export component MediaPane inherits Rectangle {
property <int> effect-category;
/// 0 = Voice, 1 = Tone, 2 = Space — the inspector's filter shelves
property <int> filter-category;
- property <int> audio-category;
property <bool> audio-open: true;
/// The category column. In-out, because it is dragged.
in-out property <length> sidebar-w: 104px;
@@ -1167,15 +1166,10 @@ export component MediaPane inherits Rectangle {
clicked => { root.tab = 4; }
}
LibraryTab {
- label: "Audio";
+ label: "Templates";
current: root.tab == 5;
clicked => { root.tab = 5; }
}
- LibraryTab {
- label: "Templates";
- current: root.tab == 6;
- clicked => { root.tab = 6; }
- }
}
}
@@ -1359,6 +1353,33 @@ export component MediaPane inherits Rectangle {
current: root.effect-category == 3;
clicked => { root.effect-category = 3; }
}
+
+ // The sound's effects, on the same page as the
+ // picture's: one place called Effects.
+ CategoryHeading {
+ height: 26px;
+ title: "Audio Effects";
+ open: root.audio-open;
+ toggled => { root.audio-open = !root.audio-open; }
+ }
+ if root.audio-open: CategoryRow {
+ height: 24px;
+ label: "Voice";
+ current: root.effect-category == 4;
+ clicked => { root.effect-category = 4; }
+ }
+ if root.audio-open: CategoryRow {
+ height: 24px;
+ label: "Tone";
+ current: root.effect-category == 5;
+ clicked => { root.effect-category = 5; }
+ }
+ if root.audio-open: CategoryRow {
+ height: 24px;
+ label: "Space";
+ current: root.effect-category == 6;
+ clicked => { root.effect-category = 6; }
+ }
}
// Filters are colour looks, the way every video editor's
@@ -1381,34 +1402,6 @@ export component MediaPane inherits Rectangle {
}
if root.tab == 5: VerticalLayout {
- spacing: 1px;
- CategoryHeading {
- height: 26px;
- title: "Audio Effects";
- open: root.audio-open;
- toggled => { root.audio-open = !root.audio-open; }
- }
- if root.audio-open: CategoryRow {
- height: 24px;
- label: "Voice";
- current: root.audio-category == 0;
- clicked => { root.audio-category = 0; }
- }
- if root.audio-open: CategoryRow {
- height: 24px;
- label: "Tone";
- current: root.audio-category == 1;
- clicked => { root.audio-category = 1; }
- }
- if root.audio-open: CategoryRow {
- height: 24px;
- label: "Space";
- current: root.audio-category == 2;
- clicked => { root.audio-category = 2; }
- }
- }
-
- if root.tab == 6: VerticalLayout {
spacing: 1px;
CategoryHeading {
height: 26px;
@@ -1554,8 +1547,17 @@ export component MediaPane inherits Rectangle {
items: root.effect-category == 0 ? root.effects-basic
: root.effect-category == 1 ? root.effects-blur
: root.effect-category == 2 ? root.effects-stylize
- : root.effects-distort;
- applied(id, label) => { root.apply-effect(id); }
+ : root.effect-category == 3 ? root.effects-distort
+ : root.effect-category == 4 ? root.audio-voice
+ : root.effect-category == 5 ? root.audio-tone
+ : root.audio-space;
+ applied(id, label) => {
+ if (root.effect-category >= 4) {
+ root.apply-audio(id);
+ } else {
+ root.apply-effect(id);
+ }
+ }
}
}
@@ -1575,21 +1577,9 @@ export component MediaPane inherits Rectangle {
}
}
- if root.tab == 5: HorizontalLayout {
- padding: 8px;
-
- CatalogueGrid {
- horizontal-stretch: 1;
- items: root.audio-category == 0 ? root.audio-voice
- : root.audio-category == 1 ? root.audio-tone
- : root.audio-space;
- applied(id, label) => { root.apply-audio(id); }
- }
- }
-
// Templates: the save affordance, then the gallery of saved
// templates, which shows its empty state until one is saved.
- if root.tab == 6: HorizontalLayout {
+ if root.tab == 5: HorizontalLayout {
padding: 8px;
ImportButton {
@@ -1599,7 +1589,7 @@ export component MediaPane inherits Rectangle {
}
}
- if root.tab == 6: Empty {
+ if root.tab == 5: Empty {
glyph: Glyph.slot;
text: "No templates yet. Mark media as slots, then save this project as a template.";
}
diff --git a/engine/crates/concat/ui/workspace/seat.slint b/engine/crates/concat/ui/workspace/seat.slint
index a0d44f16..b624c92d 100644
--- a/engine/crates/concat/ui/workspace/seat.slint
+++ b/engine/crates/concat/ui/workspace/seat.slint
@@ -187,6 +187,9 @@ export component Seat inherits Rectangle {
audio-params: Editor.audio-params;
adjust-params: Editor.adjust-params;
adjust-set(key, value) => { Editor.adjust-set(key, value); }
+ jump-token: Editor.inspector-jump-token;
+ jump-tab: Editor.inspector-jump-tab;
+ jump-section: Editor.inspector-jump-section;
chain-add(audio, id) => { Editor.chain-add(audio, id); }
chain-toggle(audio, index) => { Editor.chain-toggle(audio, index); }
chain-move-by(audio, index, delta) => { Editor.chain-move-by(audio, index, delta); }