Preselect linked Midra sources without starting preview capture
Beffroi/beffroi-tools/pipeline/head This commit looks good
Details
Beffroi/beffroi-tools/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c12bdf22db
commit
ba9a671d65
|
|
@ -229,6 +229,58 @@ impl Editor {
|
|||
.filter(|p| p.enabled && p.source == self.layout.formats().source_for[i])
|
||||
.and_then(|p| p.texture.as_ref().map(|t| (t.id(), p.guides)))
|
||||
}
|
||||
pub(super) fn preselect_linked_capture_inputs(&mut self) {
|
||||
let Some(snapshot) = self.device.snapshot.as_ref() else {
|
||||
return;
|
||||
};
|
||||
let inputs = device_capture::inputs(snapshot);
|
||||
for i in 0..self.layout.layers().len() {
|
||||
let info = self.layout.layer_info(i);
|
||||
let Some(link) = &info.midra_link else {
|
||||
continue;
|
||||
};
|
||||
let Some(layer) = snapshot
|
||||
.screens
|
||||
.iter()
|
||||
.find(|s| s.id == link.screen)
|
||||
.and_then(|s| s.layers.iter().find(|l| l.id == link.layer))
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
let Some(input) = layer
|
||||
.source
|
||||
.strip_prefix("INPUT_")
|
||||
.and_then(|s| s.parse::<u32>().ok())
|
||||
.filter(|id| inputs.iter().any(|input| input.id == *id))
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
let source = self.layout.formats().source_for[i];
|
||||
let preview = self
|
||||
.capture
|
||||
.layers
|
||||
.entry(info.id)
|
||||
.or_insert_with(|| LayerPreview {
|
||||
input: 0,
|
||||
host: self.device.host.clone(),
|
||||
source,
|
||||
texture: None,
|
||||
automatic: false,
|
||||
capture_on_selection: false,
|
||||
name: String::new(),
|
||||
enabled: false,
|
||||
guides: 0.35,
|
||||
});
|
||||
// Seed only untouched controls; never replace an operator's capture choice.
|
||||
if preview.input == 0 && !preview.enabled && preview.texture.is_none() {
|
||||
preview.input = input;
|
||||
preview.host = self.device.host.clone();
|
||||
preview.source = source;
|
||||
preview.automatic = false;
|
||||
preview.capture_on_selection = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
pub(super) fn crop_preview_controls(&mut self, ui: &mut egui::Ui, i: usize) {
|
||||
let id = self.layout.layer_info(i).id;
|
||||
let source = self.layout.formats().source_for[i];
|
||||
|
|
@ -537,6 +589,67 @@ impl Editor {
|
|||
mod tests {
|
||||
use super::super::tests::{click_text, frame};
|
||||
use super::*;
|
||||
#[test]
|
||||
fn linked_input_preselection_is_inert_and_preserves_operator_choices() {
|
||||
let mut app = Editor::default();
|
||||
let ctx = egui::Context::default();
|
||||
let geometry = app.layout.layers()[0];
|
||||
app.device.host = "127.0.0.1:3000".into();
|
||||
app.layout
|
||||
.set_midra_link(
|
||||
0,
|
||||
Some(midra_layout::MidraLink {
|
||||
screen: "2".into(),
|
||||
layer: "1".into(),
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
app.device.snapshot = Some(midra_layout::device::Snapshot {
|
||||
identity: "Test".into(),
|
||||
screens: vec![midra_layout::device::Screen {
|
||||
id: "2".into(),
|
||||
resolution: [1920, 1080],
|
||||
preview_bank: "UP".into(),
|
||||
layers: vec![midra_layout::device::Layer {
|
||||
id: "1".into(),
|
||||
source: "INPUT_4".into(),
|
||||
geometry,
|
||||
container: geometry,
|
||||
framing: None,
|
||||
unsupported: None,
|
||||
warning: None,
|
||||
}],
|
||||
}],
|
||||
raw: serde_json::json!({"device":{"inputList":{"items":{
|
||||
"INPUT_4":{"status":{"pp":{"isAvailable":true,"plug":"1"}},"snapshot":{"pp":{"enable":true}}}
|
||||
}}}}),
|
||||
});
|
||||
let id = app.layout.layer_info(0).id;
|
||||
app.preselect_linked_capture_inputs();
|
||||
let preview = &app.capture.layers[&id];
|
||||
assert_eq!(preview.input, 4);
|
||||
assert!(!preview.enabled && !preview.automatic && !preview.capture_on_selection);
|
||||
assert!(preview.texture.is_none());
|
||||
app.capture_window(&ctx);
|
||||
assert!(app.capture.pending.is_none());
|
||||
assert!(app.capture.last_request.is_none());
|
||||
app.capture.layers.get_mut(&id).unwrap().enabled = true;
|
||||
app.capture_window(&ctx);
|
||||
assert!(
|
||||
app.capture.pending.is_none(),
|
||||
"Enabling a preselected preview does not fetch"
|
||||
);
|
||||
app.capture.layers.get_mut(&id).unwrap().input = 7;
|
||||
app.preselect_linked_capture_inputs();
|
||||
assert_eq!(app.capture.layers[&id].input, 7);
|
||||
app.capture.layers.clear();
|
||||
for source in ["NONE", "COLOR_1", "INPUT_99"] {
|
||||
app.device.snapshot.as_mut().unwrap().screens[0].layers[0].source = source.into();
|
||||
app.preselect_linked_capture_inputs();
|
||||
assert!(!app.capture.layers.contains_key(&id));
|
||||
}
|
||||
}
|
||||
|
||||
fn tiny_reference(
|
||||
ctx: &egui::Context,
|
||||
name: &str,
|
||||
|
|
|
|||
|
|
@ -684,12 +684,16 @@ impl Editor {
|
|||
if !self.device.allow_program {
|
||||
self.device.target = Target::Preview;
|
||||
}
|
||||
let was_pending = self.device.pending.is_some();
|
||||
let recent_before = self.device.recent_hosts.clone();
|
||||
self.device.poll();
|
||||
if self.device.recent_hosts != recent_before {
|
||||
self.settings.save(&self.application_settings(ctx));
|
||||
}
|
||||
self.finish_linked_load();
|
||||
if was_pending && self.device.pending.is_none() {
|
||||
self.preselect_linked_capture_inputs();
|
||||
}
|
||||
self.connection_window(ctx);
|
||||
if !self.device.open {
|
||||
return;
|
||||
|
|
@ -914,7 +918,9 @@ impl Editor {
|
|||
_ => "",
|
||||
};
|
||||
self.layout
|
||||
.import_linked_device_layers(&values, &links, folder)
|
||||
.import_linked_device_layers(&values, &links, folder)?;
|
||||
self.preselect_linked_capture_inputs();
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7376,7 +7376,7 @@ mod tests {
|
|||
(false, "Source properties…", PropertyTab::Source),
|
||||
(false, "Layer properties…", PropertyTab::Layer),
|
||||
(false, "Crop properties…", PropertyTab::Crop),
|
||||
(false, "Preview properties…", PropertyTab::Preview),
|
||||
(false, "Configure capture…", PropertyTab::Preview),
|
||||
(true, "Lock selected layers", PropertyTab::Layer),
|
||||
] {
|
||||
let mut app = Editor::default();
|
||||
|
|
|
|||
|
|
@ -134,3 +134,11 @@ automatic result. Project replacement clears assignments and discards stale resu
|
|||
Automatic refresh never changes fixed references or device settings. Timer settings
|
||||
are not persisted; no save schema changes are involved.
|
||||
Live feeds and separate image-file saving are not implemented.
|
||||
|
||||
After successful connection/linked load or device-layer import, untouched layer
|
||||
preview controls preselect the linked device layer’s `INPUT_n` source when that
|
||||
physical input is available. Signal presence is not required. Existing selections
|
||||
are preserved; no texture, enabled flag, auto-refresh flag or capture-on-selection
|
||||
request is created. Opening/enabling these controls does not fetch the preselected
|
||||
input; Capture still or explicit auto-refresh starts capture. This is session-only
|
||||
state and does not change project or settings schemas.
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
- Preselect linked Midra input sources in untouched capture controls after connection or layer import/load, without enabling previews or requesting images. Preserve operator selections and leave unassigned/non-input sources unselected; regression coverage checks the scheduler stays idle.
|
||||
|
||||
- Replace the nested input-preview context submenu with Configure capture…, opening the layer properties Preview tab directly. Keep long input lists in the window instead of nested popups that can close while selecting near the canvas edge.
|
||||
|
||||
- Group Load and Send mapped layers on the final row of Midra mapping & transfer, with vector down/up arrows and direction tooltips. Keep send preparation separate from the explicit Send click and retain scope-aware loading.
|
||||
|
|
|
|||
|
|
@ -90,6 +90,11 @@ status reflects the last successful read, not continuous polling.
|
|||
|
||||
For a layer, open **Layer properties → Preview** (or right-click → **Configure capture…**):
|
||||
|
||||
When a connection or layer load completes, linked layers preselect their assigned
|
||||
physical input if available. This does not enable previews or request an image,
|
||||
and existing capture choices are preserved. Click **Capture still** when ready,
|
||||
or explicitly enable auto-refresh. Inputs without signal can still be preselected.
|
||||
|
||||
1. Check **Enable input preview**.
|
||||
2. Choose the physical input to preview. Inputs without signal are hidden by
|
||||
default; **Show inputs without signal** inside the dropdown reveals them with
|
||||
|
|
|
|||
Loading…
Reference in New Issue