Skip to content

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

Adjust: a unit segment on the number field, tried on Temperature

Jareerf718864942db
diff --git a/engine/crates/concat/src/studio.rs b/engine/crates/concat/src/studio.rs
index afd1d381..b6bba355 100644
--- a/engine/crates/concat/src/studio.rs
+++ b/engine/crates/concat/src/studio.rs
@@ -971,6 +971,7 @@ fn adjust_rows(chain: &[AppliedFilter]) -> Vec<AppliedParamData> {
key: param.key.as_str().into(),
label: t(&param.label).into(),
group: t(&param.group).into(),
+ unit: param.unit.as_str().into(),
min: param.min as f32,
max: param.max as f32,
step: if param.step > 0.0 {
@@ -1022,6 +1023,7 @@ fn chain_rows(chain: &[AppliedFilter]) -> (Vec<AppliedEntryData>, Vec<AppliedPar
key: concat_effects::catalogue::INTENSITY.into(),
label: t("Intensity").into(),
group: "".into(),
+ unit: "%".into(),
min: 0.0,
max: 100.0,
step: 1.0,
@@ -1045,6 +1047,7 @@ fn chain_rows(chain: &[AppliedFilter]) -> (Vec<AppliedEntryData>, Vec<AppliedPar
key: param.key.as_str().into(),
label: t(&param.label).into(),
group: "".into(),
+ unit: param.unit.as_str().into(),
min: param.min as f32,
max: param.max as f32,
step: step as f32,
diff --git a/engine/crates/concat/ui/inspector/clip-inspector.slint b/engine/crates/concat/ui/inspector/clip-inspector.slint
index 69672620..facd5553 100644
--- a/engine/crates/concat/ui/inspector/clip-inspector.slint
+++ b/engine/crates/concat/ui/inspector/clip-inspector.slint
@@ -97,6 +97,8 @@ export struct AppliedParamData {
/// The subhead this knob sits under; empty for none. Rows that share
/// one in a run share one subhead.
group: string,
+ /// The unit the manifest gives the value: `%`, `K`, `EV`, or nothing.
+ unit: string,
min: float,
max: float,
step: float,
@@ -1507,6 +1509,9 @@ export component AdjustPanel inherits VerticalLayout {
knob := Param {
slider: false;
+ // The unit segment, on one row for now: the shape
+ // is under review before the rest follow.
+ unit: p.key == "temperature" ? p.unit : "";
label: p.label;
value: p.value;
minimum: p.min;
diff --git a/engine/crates/concat/ui/inspector/controls.slint b/engine/crates/concat/ui/inspector/controls.slint
index 402ed2d2..62e1b898 100644
--- a/engine/crates/concat/ui/inspector/controls.slint
+++ b/engine/crates/concat/ui/inspector/controls.slint
@@ -424,6 +424,9 @@ export component Param inherits VerticalLayout {
/// Off drops the fader and folds the row into one line; the number
/// field alone carries the value, and drags for it.
in property <bool> slider: true;
+ /// The value's unit, worn by the number field's trailing segment in
+ /// place of the formatted readout: the number is then said once.
+ in property <string> unit;
/// Show the keyframe cluster, and which field it keys. Opt-in rather
/// than derived from `field`, because a Slint enum property with nothing
/// assigned to it is its first variant and not "none" - every unkeyable
@@ -447,7 +450,7 @@ export component Param inherits VerticalLayout {
Rectangle { horizontal-stretch: 1; }
- Text {
+ if root.unit == "": Text {
text: InspectorFmt.format(root.fmt, root.value);
color: Theme.fg;
font-family: Theme.font-technical;
@@ -457,13 +460,14 @@ export component Param inherits VerticalLayout {
if !root.slider: Rectangle { width: 8px; }
if !root.slider: NumberField {
- width: 64px;
+ width: root.unit == "" ? 64px : 84px;
value <=> root.value;
minimum: root.minimum;
maximum: root.maximum;
step: root.step;
precision: InspectorFmt.precision-of(root.step);
enabled: root.enabled;
+ unit: root.unit;
changed(v) => { root.changed(v); }
}
diff --git a/engine/crates/concat/ui/primitives/number-field.slint b/engine/crates/concat/ui/primitives/number-field.slint
index 492f3fb2..9b08df6b 100644
--- a/engine/crates/concat/ui/primitives/number-field.slint
+++ b/engine/crates/concat/ui/primitives/number-field.slint
@@ -28,6 +28,10 @@ export component NumberField inherits Rectangle {
in property <Glyph> prefix-glyph: Glyph.none;
/// appended to the displayed number, e.g. `%` or `s`
in property <string> suffix;
+ /// The unit as a segment on the trailing edge, set apart and muted,
+ /// the way a search field wears its glass: `K`, `%`, `EV`. The number
+ /// stays a bare number, so typing never has to fight a suffix.
+ in property <string> unit;
/// render the keyframe diamond on the trailing edge
in property <bool> keyframe;
in-out property <bool> keyframed;
@@ -55,6 +59,8 @@ export component NumberField inherits Rectangle {
min-width: 44px;
horizontal-stretch: 1;
border-radius: Theme.r;
+ // The unit segment is square-cornered; the field's own radius cuts it.
+ clip: root.unit != "";
opacity: root.enabled ? 1.0 : 0.45;
background: (ti.has-focus || (scrub.has-hover && root.enabled)) ? Theme.field-hover : Theme.field;
@@ -80,7 +86,7 @@ export component NumberField inherits Rectangle {
HorizontalLayout {
padding-left: 8px;
- padding-right: 4px;
+ padding-right: root.unit != "" ? 0px : 4px;
spacing: 5px;
if root.prefix != "": Text {
@@ -177,6 +183,29 @@ export component NumberField inherits Rectangle {
}
}
}
+
+ // The unit, in its own quiet segment: a hairline, a slightly
+ // darker ground, dim text. It is not a control and does not look
+ // like one; the scrub still runs across it.
+ if root.unit != "": Rectangle {
+ width: unit-label.preferred-width + 14px;
+ background: Theme.well;
+ Rectangle {
+ x: 0;
+ width: 1px;
+ background: Theme.line;
+ }
+ unit-label := Text {
+ text: root.unit;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ vertical-alignment: center;
+ horizontal-alignment: center;
+ width: parent.width;
+ height: parent.height;
+ }
+ }
}
// Covers the text but stops short of the keyframe diamond, and steps aside