From 5115a05c5bd2dd4171f68cecc3b863c0efff12ad Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Fri, 21 Feb 2025 13:27:30 -0800 Subject: [PATCH] Make grid-aligned node graph wires an experimental feature disabled by default --- .../preferences_dialog_message_handler.rs | 80 +++++++++++-------- .../node_graph/node_graph_message_handler.rs | 4 +- .../document/node_graph/utility_types.rs | 4 +- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs b/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs index 8c0df6d42..47cb43c9f 100644 --- a/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs +++ b/editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs @@ -33,13 +33,15 @@ impl PreferencesDialogMessageHandler { const TITLE: &'static str = "Editor Preferences"; fn layout(&self, preferences: &PreferencesMessageHandler) -> Layout { - // ===== - // INPUT - // ===== + // ========== + // NAVIGATION + // ========== + + let navigation_header = vec![TextLabel::new("Navigation").italic(true).widget_holder()]; let zoom_with_scroll_tooltip = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads)"; - let input_section = vec![TextLabel::new("Input").italic(true).widget_holder()]; let zoom_with_scroll = vec![ + Separator::new(SeparatorType::Unrelated).widget_holder(), CheckboxInput::new(preferences.zoom_with_scroll) .tooltip(zoom_with_scroll_tooltip) .on_update(|checkbox_input: &CheckboxInput| { @@ -52,11 +54,14 @@ impl PreferencesDialogMessageHandler { TextLabel::new("Zoom with Scroll").table_align(true).tooltip(zoom_with_scroll_tooltip).widget_holder(), ]; - // ========= - // SELECTION - // ========= + // ======= + // EDITING + // ======= + + let editing_header = vec![TextLabel::new("Editing").italic(true).widget_holder()]; + + let selection_label = vec![Separator::new(SeparatorType::Unrelated).widget_holder(), TextLabel::new("Selection").widget_holder()]; - let selection_section = vec![TextLabel::new("Selection").italic(true).widget_holder()]; let selection_mode = RadioInput::new(vec![ RadioEntryData::new(SelectionMode::Touched.to_string()) .label(SelectionMode::Touched.to_string()) @@ -89,32 +94,33 @@ impl PreferencesDialogMessageHandler { .selected_index(Some(preferences.selection_mode as u32)) .widget_holder(); - // ================ - // NODE GRAPH WIRES - // ================ - - let node_graph_section_tooltip = "Appearance of the wires running between node connections in the graph"; - let node_graph_section = vec![TextLabel::new("Node Graph Wires").tooltip(node_graph_section_tooltip).italic(true).widget_holder()]; - let graph_wire_style = RadioInput::new(vec![ - RadioEntryData::new(GraphWireStyle::GridAligned.to_string()) - .label(GraphWireStyle::GridAligned.to_string()) - .tooltip(GraphWireStyle::GridAligned.tooltip_description()) - .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()), - RadioEntryData::new(GraphWireStyle::Direct.to_string()) - .label(GraphWireStyle::Direct.to_string()) - .tooltip(GraphWireStyle::Direct.tooltip_description()) - .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::Direct }.into()), - ]) - .selected_index(Some(preferences.graph_wire_style as u32)) - .widget_holder(); - // ============ // EXPERIMENTAL // ============ + let experimental_header = vec![TextLabel::new("Experimental").italic(true).widget_holder()]; + + let node_graph_section_tooltip = "Appearance of the wires running between node connections in the graph"; + let node_graph_wires_label = vec![ + Separator::new(SeparatorType::Unrelated).widget_holder(), + TextLabel::new("Node Graph Wires").tooltip(node_graph_section_tooltip).widget_holder(), + ]; + let graph_wire_style = RadioInput::new(vec![ + RadioEntryData::new(GraphWireStyle::Direct.to_string()) + .label(GraphWireStyle::Direct.to_string()) + .tooltip(GraphWireStyle::Direct.tooltip_description()) + .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::Direct }.into()), + RadioEntryData::new(GraphWireStyle::GridAligned.to_string()) + .label(GraphWireStyle::GridAligned.to_string()) + .tooltip(GraphWireStyle::GridAligned.tooltip_description()) + .on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()), + ]) + .selected_index(Some(preferences.graph_wire_style as u32)) + .widget_holder(); + let vello_tooltip = "Use the experimental Vello renderer (your browser must support WebGPU)"; - let renderer_section = vec![TextLabel::new("Experimental").italic(true).widget_holder()]; let use_vello = vec![ + Separator::new(SeparatorType::Unrelated).widget_holder(), CheckboxInput::new(preferences.use_vello && preferences.supports_wgpu()) .tooltip(vello_tooltip) .disabled(!preferences.supports_wgpu()) @@ -129,6 +135,7 @@ impl PreferencesDialogMessageHandler { let vector_mesh_tooltip = "Allow tools to produce vector meshes, where more than two segments can connect to an anchor point.\n\nCurrently this does not properly handle line joins and fills."; let vector_meshes = vec![ + Separator::new(SeparatorType::Unrelated).widget_holder(), CheckboxInput::new(preferences.vector_meshes) .tooltip(vector_mesh_tooltip) .on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::VectorMeshes { enabled: checkbox_input.checked }.into()) @@ -158,13 +165,18 @@ impl PreferencesDialogMessageHandler { // ]; Layout::WidgetLayout(WidgetLayout::new(vec![ - LayoutGroup::Row { widgets: input_section }, + LayoutGroup::Row { widgets: navigation_header }, LayoutGroup::Row { widgets: zoom_with_scroll }, - LayoutGroup::Row { widgets: selection_section }, - LayoutGroup::Row { widgets: vec![selection_mode] }, - LayoutGroup::Row { widgets: node_graph_section }, - LayoutGroup::Row { widgets: vec![graph_wire_style] }, - LayoutGroup::Row { widgets: renderer_section }, + LayoutGroup::Row { widgets: editing_header }, + LayoutGroup::Row { widgets: selection_label }, + LayoutGroup::Row { + widgets: vec![Separator::new(SeparatorType::Unrelated).widget_holder(), selection_mode], + }, + LayoutGroup::Row { widgets: experimental_header }, + LayoutGroup::Row { widgets: node_graph_wires_label }, + LayoutGroup::Row { + widgets: vec![Separator::new(SeparatorType::Unrelated).widget_holder(), graph_wire_style], + }, LayoutGroup::Row { widgets: use_vello }, LayoutGroup::Row { widgets: vector_meshes }, // LayoutGroup::Row { widgets: imaginate_server_hostname }, diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index b38429f76..120e20ec4 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -1325,9 +1325,9 @@ impl<'a> MessageHandler> for NodeGrap input, }); responses.add(PropertiesPanelMessage::Refresh); - if (!network_interface + if (network_interface .reference(&node_id, selection_network_path) - .is_some_and(|reference| *reference == Some("Imaginate".to_string())) + .is_none_or(|reference| *reference != Some("Imaginate".to_string())) || input_index == 0) && network_interface.connected_to_output(&node_id, selection_network_path) { diff --git a/editor/src/messages/portfolio/document/node_graph/utility_types.rs b/editor/src/messages/portfolio/document/node_graph/utility_types.rs index c3cca3388..fc15dd16f 100644 --- a/editor/src/messages/portfolio/document/node_graph/utility_types.rs +++ b/editor/src/messages/portfolio/document/node_graph/utility_types.rs @@ -204,8 +204,8 @@ pub enum Direction { #[derive(Copy, Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize, specta::Type)] pub enum GraphWireStyle { #[default] - GridAligned = 0, - Direct = 1, + Direct = 0, + GridAligned = 1, } impl std::fmt::Display for GraphWireStyle {