Add opt-in input routing on Send and preview following

This commit is contained in:
Dandaedre 2026-11-18 15:39:56 +01:00
parent 637a4e4e17
commit b686cdb3ea
23 changed files with 519 additions and 24 deletions

2
Cargo.lock generated
View File

@ -602,7 +602,7 @@ dependencies = [
[[package]]
name = "canvas-pilot"
version = "0.9.63"
version = "0.9.64"
dependencies = [
"base64 0.22.1",
"craft-dwg",

View File

@ -4,7 +4,7 @@ default-members = ["crates/canvas-pilot"]
resolver = "3"
[workspace.package]
version = "0.9.63"
version = "0.9.64"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot"

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "Language packs",
"language.remove-pack": "Remove pack…",
"language.overwrite-pack": "Overwrite pack",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "Lingvopakaĵoj",
"language.remove-pack": "Forigi pakaĵon…",
"language.overwrite-pack": "Anstataŭigi pakaĵon",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "Paquetes de idiomas",
"language.remove-pack": "Eliminar paquete…",
"language.overwrite-pack": "Sobrescribir paquete",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Changer l’entrée",
"ui.follow-input": "Suivre l’entrée",
"ui.device-input": "Entrée de l’appareil",
"language.packs": "Packs de langues",
"language.remove-pack": "Supprimer le pack…",
"language.overwrite-pack": "Remplacer le pack",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "Δέματα γλωσσῶν",
"language.remove-pack": "Ἀφαιρεῖν τὸ δέμα…",
"language.overwrite-pack": "Ἀντικαθιστάναι τὸ δέμα",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "भाषा पैक",
"language.remove-pack": "पैक हटाएँ…",
"language.overwrite-pack": "पैक बदलें",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "言語パック",
"language.remove-pack": "パックを削除…",
"language.overwrite-pack": "パックを上書き",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "भाषा प्याकहरू",
"language.remove-pack": "प्याक हटाउनुहोस्…",
"language.overwrite-pack": "प्याक बदल्नुहोस्",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "Pacotes de idiomas",
"language.remove-pack": "Remover pacote…",
"language.overwrite-pack": "Substituir pacote",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "ชุดภาษา",
"language.remove-pack": "ลบชุดภาษา…",
"language.overwrite-pack": "เขียนทับชุดภาษา",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "kulupu toki",
"language.remove-pack": "o weka e kulupu…",
"language.overwrite-pack": "o ante e kulupu",

View File

@ -1,4 +1,7 @@
{
"ui.change-input": "Change input",
"ui.follow-input": "Follow input",
"ui.device-input": "Device input",
"language.packs": "语言包",
"language.remove-pack": "移除语言包…",
"language.overwrite-pack": "覆盖语言包",

View File

@ -485,6 +485,17 @@ impl Editor {
let online = self.device.online();
let idle = self.capture.pending.is_none();
let cooling = self.capture.cooling_down();
let chosen = self.selected_physical_input(i);
let choice =
self.device
.source_choices
.entry(id)
.or_insert(super::device_ui::SourceChoice {
input: chosen,
..Default::default()
});
ui.checkbox(&mut choice.follow,tr(ui.ctx(), "ui.follow-input")).on_hover_text("Use the input selected in Source properties for this preview. This does not route the device layer.");
let following = choice.follow;
let preview = self
.capture
.layers
@ -511,14 +522,22 @@ impl Editor {
preview.automatic = false;
preview.capture_on_selection = false;
}
ui.checkbox(
&mut preview.enabled,
tr(ui.ctx(), "ui.enable-input-preview"),
);
if ui
.checkbox(
&mut preview.enabled,
tr(ui.ctx(), "ui.enable-input-preview"),
)
.changed()
&& preview.enabled
&& following
{
preview.capture_on_selection = preview.input != 0;
preview.paused = false;
}
let mut capture = false;
ui.add_enabled_ui(preview.enabled, |ui| {
let before = preview.input;
input_picker(ui, ("layer-preview-input", id), &mut preview.input, &inputs, &mut self.capture.show_empty_inputs);
ui.add_enabled_ui(!following, |ui| {input_picker(ui, ("layer-preview-input", id), &mut preview.input, &inputs, &mut self.capture.show_empty_inputs);});
if before != preview.input {
preview.host = self.device.host.clone();
preview.paused = false;
@ -573,7 +592,28 @@ impl Editor {
self.capture.pending_layer = Some((id, source, input, self.device.host.clone()));
}
}
fn sync_followed_inputs(&mut self) {
for i in 0..self.layout.layers().len() {
let id = self.layout.layer_info(i).id;
let Some(choice) = self.device.source_choices.get(&id).filter(|c| c.follow) else {
continue;
};
let Some(preview) = self.capture.layers.get_mut(&id) else {
continue;
};
if preview.input != choice.input || preview.host != self.device.host {
preview.input = choice.input;
preview.host = self.device.host.clone();
preview.texture = None;
preview.bytes.clear();
preview.name.clear();
preview.capture_on_selection = preview.enabled && choice.input != 0;
preview.paused = false;
}
}
}
pub(super) fn capture_window(&mut self, ctx: &egui::Context) {
self.sync_followed_inputs();
if self.capture.host != self.device.host || !self.device.online() {
self.capture.discard_result = true;
self.capture.preview = None;
@ -856,6 +896,31 @@ impl Editor {
mod tests {
use super::super::tests::{click_text, frame};
use super::*;
#[test]
fn following_source_invalidates_old_capture_without_routing() {
let mut app = Editor::default();
let ctx = egui::Context::default();
let _ = ctx.run_ui(Default::default(), |ui| app.crop_preview_controls(ui, 0));
let id = app.layout.layer_info(0).id;
let preview = app.capture.layers.get_mut(&id).unwrap();
preview.enabled = true;
preview.input = 1;
preview.bytes = vec![1, 2, 3];
let choice = app.device.source_choices.get_mut(&id).unwrap();
choice.input = 5;
choice.follow = true;
app.sync_followed_inputs();
let preview = &app.capture.layers[&id];
assert_eq!(preview.input, 5);
assert!(preview.bytes.is_empty());
assert!(preview.capture_on_selection);
assert!(!app.device.source_choices[&id].change);
app.device.source_choices.get_mut(&id).unwrap().follow = false;
app.device.source_choices.get_mut(&id).unwrap().input = 6;
app.sync_followed_inputs();
assert_eq!(app.capture.layers[&id].input, 5);
}
#[test]
fn project_restores_capture_stills_and_settings_without_network_work() {
use canvas_pilot::project::Project;

View File

@ -1,4 +1,4 @@
//! Explicit WebRCS layer writes, plus separately opted-in advanced input edits. No routing or TAKE.
//! Explicit WebRCS layer writes, plus separately opted-in advanced input edits. Source routing requires explicit opt-in; no TAKE.
use crate::{
Layout,
device::{self, Snapshot},
@ -87,6 +87,134 @@ impl Plan {
}
Ok(plan)
}
/// Opt-in physical source selection, separate from editor source-slot identity.
#[allow(clippy::too_many_arguments)]
pub fn prepare_with_inputs(
snapshot: &Snapshot,
layout: &Layout,
screen_index: usize,
mappings: &[(usize, String)],
target: Target,
sizing: Sizing,
inputs: &std::collections::BTreeMap<usize, u32>,
) -> Result<Self, String> {
if !mappings.iter().any(|(id, _)| inputs.contains_key(id)) {
return Self::prepare(snapshot, layout, screen_index, mappings, target, sizing);
}
let screen = snapshot
.screens
.get(screen_index)
.ok_or("Choose a screen.")?;
let bank = if target == Target::Preview {
&screen.preview_bank
} else {
&screen.program_bank
};
let mut projected = snapshot.clone();
let mut routes = Vec::new();
for (id, destination) in mappings {
let Some(input) = inputs.get(id) else {
continue;
};
if !crate::device_capture::inputs(snapshot)
.iter()
.any(|i| i.id == *input && i.signal)
{
return Err(format!(
"Input {input} is unavailable or has no valid signal."
));
}
let input_path = format!(
"/device/inputList/items/{}",
snapshot.profile.input_key(*input)
);
let raw = field(&snapshot.raw, &input_path)?;
let plug = raw
.pointer("/status/pp/plug")
.and_then(Value::as_str)
.ok_or("Input plug unavailable")?;
let settings = raw
.pointer(&format!("/plugList/items/{plug}"))
.ok_or("Input settings unavailable")?;
let native =
crate::formats::resolution_from_values(["imageWidth", "imageHeight"].map(|k| {
settings
.pointer(&format!("/status/signal/pp/{k}"))
.and_then(Value::as_f64)
.unwrap_or(0.)
}))?;
if snapshot.profile == device::Profile::Midra4k {
for edge in ["left", "right", "top", "bottom"] {
if settings
.pointer(&format!("/settings/cropping/status/pp/{edge}"))
.and_then(Value::as_f64)
.ok_or("Input crop status unavailable; refresh before switching input.")?
!= 0.
{
return Err("Input switching with active input crop is not yet supported. Choose an uncropped input.".into());
}
}
for (key, expected) in [("signal", "NATIVE"), ("transformTo", "SIGNAL")] {
if settings
.pointer(&format!("/settings/aspect/pp/{key}"))
.and_then(Value::as_str)
.ok_or("Input aspect status unavailable; refresh before switching input.")?
!= expected
{
return Err(
"Input switching with aspect correction is not yet supported.".into(),
);
}
}
}
let layer_path = snapshot.profile.layer_path(&screen.id, bank, destination);
let path = format!("{layer_path}{}", snapshot.profile.source_field());
let before = field(&snapshot.raw, &path)?.clone();
let after = json!(format!(
"{}{}",
if snapshot.profile == device::Profile::Aquilon6 {
"LIVE_"
} else {
"INPUT_"
},
input
));
*projected
.raw
.pointer_mut(&path)
.ok_or("Source selector unavailable")? = after.clone();
if snapshot.profile == device::Profile::Midra4k {
for (key, value) in [("contentWidth", native[0]), ("contentHeight", native[1])] {
*projected
.raw
.pointer_mut(&format!("{layer_path}/status/pp/{key}"))
.ok_or("Layer content dimensions unavailable")? = json!(value);
}
}
if before != after {
routes.push(Change {
path: path
.trim_start_matches('/')
.split('/')
.map(str::to_owned)
.collect(),
before,
after,
});
}
}
let mut plan = Self::prepare(&projected, layout, screen_index, mappings, target, sizing)?;
// Conversion uses the selected input; preflight still compares the actual device state.
for (path, before) in &mut plan.observed {
*before = field(&snapshot.raw, path)?.clone();
}
for change in &mut plan.changes {
change.before = field(&snapshot.raw, &format!("/{}", change.path.join("/")))?.clone();
}
routes.append(&mut plan.changes);
plan.changes = routes;
Ok(plan)
}
pub(crate) fn prepare_midra(
snapshot: &Snapshot,
layout: &Layout,
@ -582,6 +710,80 @@ mod tests {
.unwrap();
l
}
#[test]
fn selected_input_requires_opt_in_and_preserves_fresh_state_guards() {
let mut state = snapshot();
state.raw["device"]["inputList"] = json!({"items":{"INPUT_5":{
"status":{"pp":{"isAvailable":true,"plug":"HDMI"}},
"plugList":{"items":{"HDMI":{
"status":{"signal":{"pp":{"isValid":true,"imageWidth":1920,"imageHeight":1080}}},
"settings":{"cropping":{"status":{"pp":{"left":0,"right":0,"top":0,"bottom":0}}},
"aspect":{"pp":{"signal":"NATIVE","transformTo":"SIGNAL"}}}
}}}
}}});
let editor = layout();
let mappings = [(2, "2".into())];
let plain = Plan::prepare_with_inputs(
&state,
&editor,
0,
&mappings,
Target::Preview,
Sizing::OutputBox,
&Default::default(),
)
.unwrap();
assert!(
!plain
.changes
.iter()
.any(|c| c.path.join("/").ends_with("source/pp/input"))
);
let plan = Plan::prepare_with_inputs(
&state,
&editor,
0,
&mappings,
Target::Preview,
Sizing::OutputBox,
&[(2, 5)].into(),
)
.unwrap();
assert_eq!(plan.changes[0].after, json!("INPUT_5"));
assert_eq!(plan.changes[0].before, json!("INPUT_4"));
assert!(validate_fresh(&plan, &state).is_ok());
let mut changed = state.clone();
changed.raw["device"]["inputList"]["items"]["INPUT_5"]["status"]["pp"]["plug"] =
json!("OTHER");
assert!(validate_fresh(&plan, &changed).is_err());
assert!(
Plan::prepare_with_inputs(
&state,
&editor,
0,
&mappings,
Target::Preview,
Sizing::OutputBox,
&[(2, 99)].into()
)
.is_err()
);
state.raw["device"]["inputList"]["items"]["INPUT_5"]["plugList"]["items"]["HDMI"]["settings"]
["cropping"]["status"]["pp"]["left"] = json!(12);
assert!(
Plan::prepare_with_inputs(
&state,
&editor,
0,
&mappings,
Target::Preview,
Sizing::OutputBox,
&[(2, 5)].into()
)
.is_err()
);
}
#[test]
fn sending_accepts_rounded_content_dimensions_but_rejects_real_mismatches() {
let mut state = snapshot();

View File

@ -42,6 +42,12 @@ impl DeviceFailure {
}
}
#[derive(Clone, Copy, Default)]
pub(super) struct SourceChoice {
pub input: u32,
pub change: bool,
pub follow: bool,
}
#[derive(Clone)]
struct SendConflict {
host: String,
@ -49,6 +55,7 @@ struct SendConflict {
links: Vec<(usize, canvas_pilot::DeviceLink)>,
sizing: Sizing,
details: Vec<String>,
inputs: std::collections::BTreeMap<usize, u32>,
}
impl SendConflict {
fn reload_links(&self) -> Result<Vec<(usize, canvas_pilot::DeviceLink)>, String> {
@ -101,7 +108,15 @@ impl SendConflict {
if mappings.is_empty() {
return Err("The original mapping is no longer available.".into());
}
Plan::prepare(snapshot, layout, index, &mappings, old.target, self.sizing)
Plan::prepare_with_inputs(
snapshot,
layout,
index,
&mappings,
old.target,
self.sizing,
&self.inputs,
)
})
.collect()
}
@ -301,8 +316,16 @@ pub(super) struct DeviceUi {
error: String,
send_attempt: Option<SendConflict>,
conflict: Option<SendConflict>,
pub(super) source_choices: std::collections::BTreeMap<usize, SourceChoice>,
}
impl DeviceUi {
fn input_changes(&self) -> std::collections::BTreeMap<usize, u32> {
self.source_choices
.iter()
.filter(|(_, c)| c.change)
.map(|(id, c)| (*id, c.input))
.collect()
}
pub(super) fn try_startup_connection(&mut self, ctx: &egui::Context) {
if self.autoconnect_at_startup && !self.host.trim().is_empty() {
self.fetch(ctx);
@ -312,6 +335,7 @@ impl DeviceUi {
self.destinations.fill(Destination::Skip);
self.mapping_scope = None;
self.loading = None;
self.source_choices.clear();
}
pub(super) fn with_connection_preferences(host: String, allow_program: bool) -> Self {
Self {
@ -393,7 +417,7 @@ impl DeviceUi {
.iter()
.position(|s| s.id == screen)
.ok_or_else(|| format!("Linked screen {screen} is unavailable."))?;
let plan = Plan::prepare(
let plan = Plan::prepare_with_inputs(
snapshot,
layout,
index,
@ -404,6 +428,7 @@ impl DeviceUi {
Target::Preview
},
self.sizing,
&self.input_changes(),
)?;
Ok(plan)
})
@ -488,6 +513,7 @@ impl DeviceUi {
links,
sizing: self.sizing,
details: vec![],
inputs: self.input_changes(),
});
self.conflict = None;
self.error.clear();
@ -644,6 +670,55 @@ impl DeviceUi {
}
}
impl Editor {
pub(super) fn selected_physical_input(&self, i: usize) -> u32 {
let info = self.layout.layer_info(i);
if let Some(choice) = self.device.source_choices.get(&info.id) {
return choice.input;
}
self.device
.snapshot
.as_ref()
.and_then(|snapshot| {
let link = info
.send_mapping
.current_links()
.find(|link| link.family == snapshot.profile.family())?;
let layer = snapshot
.screens
.iter()
.find(|s| s.id == link.screen)?
.layers
.iter()
.find(|l| l.id == link.layer)?;
snapshot.profile.input_from_source(&layer.source)
})
.unwrap_or(0)
}
pub(super) fn source_input_controls(&mut self, ui: &mut egui::Ui, i: usize) {
let input = self.selected_physical_input(i);
let available = self
.device
.snapshot
.as_ref()
.map(canvas_pilot::device_capture::inputs)
.unwrap_or_default();
let choice = self
.device
.source_choices
.entry(self.layout.layer_info(i).id)
.or_insert(SourceChoice {
input,
..Default::default()
});
ui.horizontal(|ui| {
ui.label(tr(ui.ctx(), "ui.device-input"));
egui::ComboBox::from_id_salt(("source-input",i)).selected_text(if choice.input==0 {"Choose input…".into()} else {format!("Input {}",choice.input)}).show_ui(ui,|ui| {
for input in &available {ui.selectable_value(&mut choice.input,input.id,format!("Input {}{}",input.id,if input.signal {""} else {" · No signal"}));}
});
ui.checkbox(&mut choice.change,tr(ui.ctx(), "ui.change-input")).on_hover_text("Switch this layer's mapped device destinations to the selected input on the next Send. Nothing changes immediately.");
});
ui.small("Input changes are staged for this session only. Nothing is routed until Send.");
}
pub(super) fn layer_mapping_controls(&mut self, ui: &mut egui::Ui, i: usize) {
let original = self.layout.layer_info(i).load_mapping.clone();
let mut link = original.clone();
@ -1064,7 +1139,7 @@ impl Editor {
ui.label("The device no longer matches the state used to prepare this send. No layers were sent.");
egui::ScrollArea::vertical().max_height(260.).show(ui,|ui| {for detail in &conflict.details {ui.label(detail);}});
ui.separator();
ui.label("Send my layout anyway rebuilds the send against the current device state. Input routing is not changed, and all validation checks remain active.");
ui.label("Send my layout anyway rebuilds the send against the current device state. Only explicitly selected input changes are included; all validation checks remain active.");
if let Err(error)=&prepared {ui.colored_label(ui.visuals().error_fg_color,error);}
ui.label("Discard local changes and reload replaces the mapped local layers’ geometry, crop, fit and masks with the device Preview values. Other layers remain unchanged. Undo is available.");
if program {ui.small("Reload is available for Preview destinations only.");}
@ -1100,6 +1175,9 @@ impl Editor {
reload_links.as_ref().unwrap(),
) {
Ok(()) => {
for (id, _) in reload_links.as_ref().unwrap() {
self.device.source_choices.remove(id);
}
self.sync();
self.device.conflict = None;
self.device.error.clear();
@ -1215,8 +1293,9 @@ impl Editor {
(info.id, info.send_mapping.current_links().find(|link| link.family == snapshot.profile.family() && link.screen == screen_id).map(|link| link.layer.clone()).unwrap_or_default())
}).collect();
let previous = targets.clone();
let input_changes = self.device.input_changes();
let prepared_plan = send_review(ui, &self.layout, &scope_indices, snapshot, self.device.screen, &mut targets,
&mut self.device.target, &mut self.device.sizing, self.device.pending.is_some(), self.device.allow_program);
&mut self.device.target, &mut self.device.sizing, self.device.pending.is_some(), self.device.allow_program, &input_changes);
for (id, destination) in targets {
if previous.get(&id) != Some(&destination) {
let i = (0..self.layout.layers().len()).find(|&i| self.layout.layer_info(i).id == id).unwrap();
@ -1441,6 +1520,7 @@ fn send_review(
sizing: &mut Sizing,
busy: bool,
allow_program: bool,
inputs: &std::collections::BTreeMap<usize, u32>,
) -> Option<Plan> {
let screen = &snapshot.screens[screen_index];
if !allow_program {
@ -1482,6 +1562,12 @@ fn send_review(
}
let target = targets.entry(id).or_default();
ui.separator();
if let Some(input) = inputs.get(&id) {
ui.colored_label(
ui.visuals().warn_fg_color,
format!("Change input on Send: Input {input}"),
);
}
ui.horizontal(|ui| {
ui.strong(layout.layer_label(i));
egui::ComboBox::from_id_salt(("device_send_target", id))
@ -1577,13 +1663,14 @@ fn send_review(
ui.colored_label(ui.visuals().error_fg_color, error);
return None;
}
match Plan::prepare(
match Plan::prepare_with_inputs(
snapshot,
layout,
screen_index,
&mappings,
*target_mode,
*sizing,
inputs,
) {
Ok(plan) => {
ui.label(format!(
@ -1706,6 +1793,7 @@ mod tests {
links: vec![(app.layout.layer_info(0).id, link)],
sizing: Sizing::default(),
details,
inputs: Default::default(),
};
app.device.snapshot = Some(fresh);
(app, conflict)
@ -1777,6 +1865,15 @@ mod tests {
let ctx = egui::Context::default();
let (mut app, conflict) = conflict_fixture();
let before = app.layout.layers().clone();
let id = app.layout.layer_info(0).id;
app.device.source_choices.insert(
id,
SourceChoice {
input: 5,
change: true,
follow: true,
},
);
app.device.conflict = Some(conflict.clone());
super::super::tests::click_text(&mut app, &ctx, "Cancel send");
assert!(app.device.conflict.is_none());
@ -1785,6 +1882,7 @@ mod tests {
app.device.conflict = Some(conflict);
super::super::tests::click_text(&mut app, &ctx, "Discard local changes and reload");
assert!(app.device.conflict.is_none());
assert!(!app.device.source_choices.contains_key(&id));
assert_ne!(app.layout.layers()[0], before[0]);
assert_eq!(app.layout.layers()[1], before[1]);
assert!(app.device.pending.is_none());
@ -2333,6 +2431,7 @@ mod tests {
&mut Sizing::OutputBox,
false,
allow,
&Default::default(),
);
});
});
@ -2498,6 +2597,7 @@ mod tests {
&mut Sizing::OutputBox,
false,
false,
&Default::default(),
)
});
});
@ -2520,6 +2620,7 @@ mod tests {
&mut Sizing::OutputBox,
false,
false,
&Default::default(),
)
});
});
@ -2740,6 +2841,7 @@ mod tests {
&mut Sizing::OutputBox,
false,
false,
&Default::default()
)
.is_none()
);
@ -2904,6 +3006,7 @@ mod tests {
&mut Sizing::OutputBox,
false,
false,
&Default::default(),
);
});
});

View File

@ -345,15 +345,12 @@ impl Editor {
ui.separator();
}
if self.property_tab == PropertyTab::Source {
self.source_input_controls(ui,i);
ui.separator();
ui.heading(tr(ui.ctx(), "ui.advanced-source-input-settings"));
if ui.button("Open shared input settings…").clicked() {
self.inputs.open = true;
if let Some(snapshot) = &self.device.snapshot
&& let Some(link) = self.layout.layer_info(i).send_mapping.current_links().next()
&& let Some(screen) = snapshot.screens.iter().find(|s| s.id == link.screen)
&& let Some(layer) = screen.layers.iter().find(|l| l.id == link.layer) {
self.inputs.selected = snapshot.profile.input_from_source(&layer.source).unwrap_or(0);
}
self.inputs.selected = self.selected_physical_input(i);
}
ui.small("Shared input settings apply to every layer using that physical input. Load the layout again after changing device preprocessing.");
}

View File

@ -669,3 +669,31 @@ fn one_editor_layer_can_prepare_multiple_distinct_aquilon_destinations() {
.is_err()
);
}
#[test]
fn explicit_source_selection_is_guarded_and_verified_in_the_plan() {
let snapshot = Snapshot::parse(&identity(), &raw()).unwrap();
let layout = Layout::default();
let id = layout.layer_info(0).id;
let plan = Plan::prepare_with_inputs(
&snapshot,
&layout,
0,
&[(id, "1".into())],
Target::Preview,
Sizing::OutputBox,
&[(id, 1)].into(),
)
.unwrap();
assert_eq!(plan.changes[0].after, json!("LIVE_1"));
assert!(
plan.changes[0]
.path
.join("/")
.ends_with("source/pp/inputNum")
);
canvas_pilot::device_send::validate_fresh(&plan, &snapshot).unwrap();
let mut changed = snapshot.clone();
changed.raw["device"]["inputList"]["items"]["IN_1"]["status"]["pp"]["plug"] = json!("OTHER");
assert!(canvas_pilot::device_send::validate_fresh(&plan, &changed).is_err());
}

View File

@ -4,6 +4,16 @@
## Unreleased
### v0.9.64
- Source properties can stage a physical input with **Change input**, applied only
on explicit Send. Fresh-state checks and readback include the selected source.
- Preview **Follow input** follows that selection without routing the device.
These choices are session-only; project/export schemas are unchanged.
- Switching currently requires a valid, uncorrected input matching the editor
source dimensions. Unsupported input processing is rejected before writes.
### v0.9.63
- Added a device-state conflict dialog with changed fields, Cancel send, Send my

View File

@ -193,7 +193,7 @@ explicitly clears destination blanking during a reviewed send. Fully blanked axe
are allowed. Non-centered fit modes, malformed masks and shared input aspect/crop
corrections are reported explicitly when their visible bounds cannot be imported. Shared input
correction controls remain managed in WebRCS for this adapter. Ordinary sends
never route inputs, TAKE, or change shared input processing.
do not TAKE or change shared input processing; routing requires **Change input**.
Aquilon reads only the required properties through AWJ TCP 10606, in batches,
including a consistency check. The tested emulator now downloads about 197 KB
@ -213,7 +213,7 @@ Shared device input drafts are session-only; [projects omit them](advanced-excha
- **Cancel send** keeps your local edits and sends nothing.
- **Send my layout anyway** rebuilds the original mapped send against the refreshed
device state. It overwrites the mapped layout fields, not source routing. Range,
device state. It overwrites the mapped layout fields and any explicitly staged input selection. Range,
input compatibility and fresh-state checks still apply. A changed device family
or Preview/Program bank requires checking the mapping again instead.
- **Discard local changes and reload** uses a warning color because it replaces
@ -225,3 +225,23 @@ Shared device input drafts are session-only; [projects omit them](advanced-excha
If the device changes again before an explicit overwrite, sending can be stopped
again. Changes or failures occurring during a send remain reported as partial-send
errors, with the completed-screen count; they never trigger an automatic retry.
## Select the input to send or preview
In **Layer properties → Source**, select a **Device input**. Enable **Change input**
to route the mapped destination layer to that input on the next explicit **Send**.
Selecting an input alone does not change the device. Leave the checkbox off to
send geometry without changing its source.
In **Preview**, enable **Follow input** to capture the input selected in Source.
Enable input preview as usual; automatic refresh remains a separate option.
Following an input does not route it, and changing the selection clears the old
picture before requesting a new capture.
Discarding local changes in the send conflict dialog also clears these choices for the reloaded layers.
These selections are session-only and reset when a project or connection is
replaced; they are not saved in projects or exchange files. Input switching requires
a valid signal with native dimensions matching the editor source format and no
input crop/aspect correction. Unsupported combinations stop preparation with an
error. Sending to Program can visibly change the live source.

View File

@ -99,7 +99,7 @@ half-pixel/top-left geometry is not rounded. Conversion rejects a rounded visibl
size error above one pixel. Center rounding contributes at most half a pixel.
Strict readback checks the quantized values rather than silently accepting clamps.
Only `MIDDLE_CENTER` anchors are currently accepted. Source routing is
`source.pp.inputNum` (`LIVE_n`, `NONE`, etc.); production geometry sends omit it.
`source.pp.inputNum` (`LIVE_n`, `NONE`, etc.); geometry-only sends omit it; explicit Change input sends include it.
`cropping.classic.pp.{left,right,top,bottom}` are integer fractions 0–65535.
Layer crop combines the editor input crop and dynamic crop in native source pixels,
@ -195,3 +195,20 @@ local layer more than once for distinct destinations and reject duplicate device
destinations. No new network connections or automatic writes are introduced.
Current mapping controls still synchronize one load source and one send target.
See the [project contract](canvas-pilot.md#directional-device-mapping-version-19).
### Explicit source selection on Send
Session-only per-editor-layer input selections are separate from persistent editor
source identity and directional mappings. Only checked **Change input** selections
enter a send plan. The adapter prepares geometry against the requested input,
while preflight observes the actual destination and requested input state.
Source changes precede geometry writes, share the preset apply, and participate in
readback verification. No TAKE is issued. Rebuilding a conflicted plan preserves
the explicit selection and reruns validation.
Midra writes source.pp.input = INPUT_n; Aquilon writes source.pp.inputNum = LIVE_n.
Only available inputs with valid signals, compatible native dimensions, and supported
uncorrected input processing are accepted. Preview following is read-only, clears
stale captures, and uses the existing pooled capture scheduler. Neither option
changes the project or exchange schema.

View File

@ -24,7 +24,7 @@ Normal geometry fields under the mapped live layer are:
- `crop.pp.aspectOverride`: `CENTERED` normally; explicit fit also supports `1_1`, `FULLSCREEN`, `CROPPED`.
At `AT_DOWN`, Preview is UP and Program DOWN; `AT_UP` reverses those roles.
The selected configuration captures one physical bank. Send first refreshes the device and rejects changed bank roles, conversion inputs or destination values before writing. Commands do not retarget halfway through. No TAKE or source routing,
The selected configuration captures one physical bank. Send first refreshes the device and rejects changed bank roles, conversion inputs or destination values before writing. Commands do not retarget halfway through. No TAKE; source routing requires explicit Change input opt-in. No
effect, opacity or output setting is sent. Shared input aspect/crop fields
are omitted unless explicitly opted into and edited as described below.
@ -101,7 +101,7 @@ Only numeric live-layer IDs 1 through that count are listed or accepted as send
destinations, even though the firmware stores eight slots. The staged NEW
configuration, physical input count, background and foreground planes do not
determine this list. Missing/invalid allocation metadata produces a connection
error rather than exposing all slots. Missing layer IDs are not synthesized. Input routing is informational and is never changed by geometry
error rather than exposing all slots. Missing layer IDs are not synthesized. Input routing is only changed with explicit Change input opt-in, never implicitly by geometry
transfers. A Centered layer without usable content dimensions and with zero crop
imports container geometry and mask without inferred source framing; nonzero crops
still require valid dimensions for visible-bound reconstruction.
@ -367,3 +367,20 @@ fit and masks, atomically and through normal undo. Program and ambiguous fan-out
reloads are disabled. The dialog and attempted mapping are transient UI state;
project and exchange schemas are unchanged. Partial-send errors do not offer this
no-writes conflict dialog.
### Explicit source selection on Send
Session-only per-editor-layer input selections are separate from persistent editor
source identity and directional mappings. Only checked **Change input** selections
enter a send plan. The adapter prepares geometry against the requested input,
while preflight observes the actual destination and requested input state.
Source changes precede geometry writes, share the preset apply, and participate in
readback verification. No TAKE is issued. Rebuilding a conflicted plan preserves
the explicit selection and reruns validation.
Midra writes source.pp.input = INPUT_n; Aquilon writes source.pp.inputNum = LIVE_n.
Only available inputs with valid signals, compatible native dimensions, and supported
uncorrected input processing are accepted. Preview following is read-only, clears
stale captures, and uses the existing pooled capture scheduler. Neither option
changes the project or exchange schema.