Locked viewer: re-convert pixels when the display profile or output simulation changes (#546)

This commit is contained in:
MarekSpodBiedry
2026-10-10 19:12:02 +02:00
parent 1446e27d85
commit ad0fc4da09
2 changed files with 86 additions and 1 deletions
+5 -1
View File
@@ -522,10 +522,14 @@ fn locked_pane(app: &mut EffectcraftApp, ui: &mut egui::Ui, full: Rect, bg: Colo
let cam = (lv.view != View3D::ActiveCamera && comp.has_3d())
.then(|| app.session.state.views3d.get(&lv.comp).cloned().unwrap_or_default().cam(lv.view, comp.width as f64, comp.height as f64).state());
let dc = effectcraft_engine::viewer::DisplayColor::of(&app.session);
// The display conversion's inputs, keyed as in the main viewer's texture caches.
let sim = app.session.state.viewer.simulation;
let custom = if sim.profile == effectcraft_engine::viewer::SimProfile::MyCustom { format!("{:?}", app.session.prefs.custom_rgb) } else { String::new() };
let dc_key = format!("{cam:?}{}{sim:?}{}{custom}", dc.is_some(), app.session.prefs.previews.display_profile);
let key = {
use std::hash::{Hash, Hasher};
let mut h = std::collections::hash_map::DefaultHasher::new();
(app.session.revision, lv.comp.0, t.0, scale.to_bits(), format!("{cam:?}{}", dc.is_some())).hash(&mut h);
(app.session.revision, lv.comp.0, t.0, scale.to_bits(), dc_key).hash(&mut h);
h.finish()
};
let id = egui::Id::new("viewer-locked");