Skip to content

Commit 5115a05

Browse files
committed
Make grid-aligned node graph wires an experimental feature disabled by default
1 parent 2c88bee commit 5115a05

File tree

3 files changed

+43
-31
lines changed

3 files changed

+43
-31
lines changed

editor/src/messages/dialog/preferences_dialog/preferences_dialog_message_handler.rs

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ impl PreferencesDialogMessageHandler {
3333
const TITLE: &'static str = "Editor Preferences";
3434

3535
fn layout(&self, preferences: &PreferencesMessageHandler) -> Layout {
36-
// =====
37-
// INPUT
38-
// =====
36+
// ==========
37+
// NAVIGATION
38+
// ==========
39+
40+
let navigation_header = vec![TextLabel::new("Navigation").italic(true).widget_holder()];
3941

4042
let zoom_with_scroll_tooltip = "Use the scroll wheel for zooming instead of vertically panning (not recommended for trackpads)";
41-
let input_section = vec![TextLabel::new("Input").italic(true).widget_holder()];
4243
let zoom_with_scroll = vec![
44+
Separator::new(SeparatorType::Unrelated).widget_holder(),
4345
CheckboxInput::new(preferences.zoom_with_scroll)
4446
.tooltip(zoom_with_scroll_tooltip)
4547
.on_update(|checkbox_input: &CheckboxInput| {
@@ -52,11 +54,14 @@ impl PreferencesDialogMessageHandler {
5254
TextLabel::new("Zoom with Scroll").table_align(true).tooltip(zoom_with_scroll_tooltip).widget_holder(),
5355
];
5456

55-
// =========
56-
// SELECTION
57-
// =========
57+
// =======
58+
// EDITING
59+
// =======
60+
61+
let editing_header = vec![TextLabel::new("Editing").italic(true).widget_holder()];
62+
63+
let selection_label = vec![Separator::new(SeparatorType::Unrelated).widget_holder(), TextLabel::new("Selection").widget_holder()];
5864

59-
let selection_section = vec![TextLabel::new("Selection").italic(true).widget_holder()];
6065
let selection_mode = RadioInput::new(vec![
6166
RadioEntryData::new(SelectionMode::Touched.to_string())
6267
.label(SelectionMode::Touched.to_string())
@@ -89,32 +94,33 @@ impl PreferencesDialogMessageHandler {
8994
.selected_index(Some(preferences.selection_mode as u32))
9095
.widget_holder();
9196

92-
// ================
93-
// NODE GRAPH WIRES
94-
// ================
97+
// ============
98+
// EXPERIMENTAL
99+
// ============
100+
101+
let experimental_header = vec![TextLabel::new("Experimental").italic(true).widget_holder()];
95102

96103
let node_graph_section_tooltip = "Appearance of the wires running between node connections in the graph";
97-
let node_graph_section = vec![TextLabel::new("Node Graph Wires").tooltip(node_graph_section_tooltip).italic(true).widget_holder()];
104+
let node_graph_wires_label = vec![
105+
Separator::new(SeparatorType::Unrelated).widget_holder(),
106+
TextLabel::new("Node Graph Wires").tooltip(node_graph_section_tooltip).widget_holder(),
107+
];
98108
let graph_wire_style = RadioInput::new(vec![
99-
RadioEntryData::new(GraphWireStyle::GridAligned.to_string())
100-
.label(GraphWireStyle::GridAligned.to_string())
101-
.tooltip(GraphWireStyle::GridAligned.tooltip_description())
102-
.on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()),
103109
RadioEntryData::new(GraphWireStyle::Direct.to_string())
104110
.label(GraphWireStyle::Direct.to_string())
105111
.tooltip(GraphWireStyle::Direct.tooltip_description())
106112
.on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::Direct }.into()),
113+
RadioEntryData::new(GraphWireStyle::GridAligned.to_string())
114+
.label(GraphWireStyle::GridAligned.to_string())
115+
.tooltip(GraphWireStyle::GridAligned.tooltip_description())
116+
.on_update(move |_| PreferencesMessage::GraphWireStyle { style: GraphWireStyle::GridAligned }.into()),
107117
])
108118
.selected_index(Some(preferences.graph_wire_style as u32))
109119
.widget_holder();
110120

111-
// ============
112-
// EXPERIMENTAL
113-
// ============
114-
115121
let vello_tooltip = "Use the experimental Vello renderer (your browser must support WebGPU)";
116-
let renderer_section = vec![TextLabel::new("Experimental").italic(true).widget_holder()];
117122
let use_vello = vec![
123+
Separator::new(SeparatorType::Unrelated).widget_holder(),
118124
CheckboxInput::new(preferences.use_vello && preferences.supports_wgpu())
119125
.tooltip(vello_tooltip)
120126
.disabled(!preferences.supports_wgpu())
@@ -129,6 +135,7 @@ impl PreferencesDialogMessageHandler {
129135

130136
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.";
131137
let vector_meshes = vec![
138+
Separator::new(SeparatorType::Unrelated).widget_holder(),
132139
CheckboxInput::new(preferences.vector_meshes)
133140
.tooltip(vector_mesh_tooltip)
134141
.on_update(|checkbox_input: &CheckboxInput| PreferencesMessage::VectorMeshes { enabled: checkbox_input.checked }.into())
@@ -158,13 +165,18 @@ impl PreferencesDialogMessageHandler {
158165
// ];
159166

160167
Layout::WidgetLayout(WidgetLayout::new(vec![
161-
LayoutGroup::Row { widgets: input_section },
168+
LayoutGroup::Row { widgets: navigation_header },
162169
LayoutGroup::Row { widgets: zoom_with_scroll },
163-
LayoutGroup::Row { widgets: selection_section },
164-
LayoutGroup::Row { widgets: vec![selection_mode] },
165-
LayoutGroup::Row { widgets: node_graph_section },
166-
LayoutGroup::Row { widgets: vec![graph_wire_style] },
167-
LayoutGroup::Row { widgets: renderer_section },
170+
LayoutGroup::Row { widgets: editing_header },
171+
LayoutGroup::Row { widgets: selection_label },
172+
LayoutGroup::Row {
173+
widgets: vec![Separator::new(SeparatorType::Unrelated).widget_holder(), selection_mode],
174+
},
175+
LayoutGroup::Row { widgets: experimental_header },
176+
LayoutGroup::Row { widgets: node_graph_wires_label },
177+
LayoutGroup::Row {
178+
widgets: vec![Separator::new(SeparatorType::Unrelated).widget_holder(), graph_wire_style],
179+
},
168180
LayoutGroup::Row { widgets: use_vello },
169181
LayoutGroup::Row { widgets: vector_meshes },
170182
// LayoutGroup::Row { widgets: imaginate_server_hostname },

editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,9 +1325,9 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
13251325
input,
13261326
});
13271327
responses.add(PropertiesPanelMessage::Refresh);
1328-
if (!network_interface
1328+
if (network_interface
13291329
.reference(&node_id, selection_network_path)
1330-
.is_some_and(|reference| *reference == Some("Imaginate".to_string()))
1330+
.is_none_or(|reference| *reference != Some("Imaginate".to_string()))
13311331
|| input_index == 0)
13321332
&& network_interface.connected_to_output(&node_id, selection_network_path)
13331333
{

editor/src/messages/portfolio/document/node_graph/utility_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ pub enum Direction {
204204
#[derive(Copy, Clone, Debug, PartialEq, Default, serde::Serialize, serde::Deserialize, specta::Type)]
205205
pub enum GraphWireStyle {
206206
#[default]
207-
GridAligned = 0,
208-
Direct = 1,
207+
Direct = 0,
208+
GridAligned = 1,
209209
}
210210

211211
impl std::fmt::Display for GraphWireStyle {

0 commit comments

Comments
 (0)