From d3b247a2bc4682dd546b0bfb7f503473cd6a9548 Mon Sep 17 00:00:00 2001 From: Adam Obuchowicz Date: Wed, 8 Mar 2023 18:37:18 +0100 Subject: [PATCH] Do not attach visualization on startup. (#5841) @hubertp has reported in #5620 that sometimes enabling visualization does not send "attachVisualization" message to the engine. The actual cause was simply because it was already attached. Updating the default visualizations (when receiving information about type) updated the preprocessors, what caused in turn attaching visualization. That was a bug, of course. This PR fixes it: now we don't update any visualization if it's hidden. --- Cargo.toml | 1 + app/gui/view/graph-editor/src/lib.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 96d44128ad..9d41e1d49a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,6 +128,7 @@ syn = { version = "1.0", features = [ "extra-traits", "printing", "parsing", + "visit", "visit-mut", ] } quote = { version = "1.0.23" } diff --git a/app/gui/view/graph-editor/src/lib.rs b/app/gui/view/graph-editor/src/lib.rs index f49b16cc91..63aea4aa3b 100644 --- a/app/gui/view/graph-editor/src/lib.rs +++ b/app/gui/view/graph-editor/src/lib.rs @@ -1619,12 +1619,16 @@ impl GraphEditorModelWithNetwork { selected <- vis_is_selected.on_true(); deselected <- vis_is_selected.on_false(); - output.visualization_preprocessor_changed <+ - node_model.visualization.frp.preprocessor.map(move |preprocessor| - (node_id,preprocessor.clone())); output.on_visualization_select <+ selected.constant(Switch::On(node_id)); output.on_visualization_select <+ deselected.constant(Switch::Off(node_id)); + preprocessor_changed <- + node_model.visualization.frp.preprocessor.map(move |preprocessor| { + (node_id,preprocessor.clone()) + }); + output.visualization_preprocessor_changed <+ preprocessor_changed.gate(&node.visualization_visible); + + metadata <- any(...); metadata <+ node_model.visualization.frp.preprocessor.map(visualization::Metadata::new);