Skip to content

Commit a376832

Browse files
authored
Fix and improve robustness of node/parameter tooltip plumbing; simplify properties row widget boilerplate (#2600)
* WIP * WIP2 * Further cleanup
1 parent 6196dbf commit a376832

File tree

11 files changed

+1086
-1108
lines changed

11 files changed

+1086
-1108
lines changed

demo-artwork/changing-seasons.graphite

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-artwork/procedural-string-lights.graphite

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

+64-224
Large diffs are not rendered by default.

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

+10-13
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
111111
responses.add(NodeGraphMessage::SelectedNodesSet { nodes: vec![new_layer_id] });
112112
}
113113
NodeGraphMessage::AddImport => {
114-
network_interface.add_import(graph_craft::document::value::TaggedValue::None, true, -1, "", breadcrumb_network_path);
114+
network_interface.add_import(graph_craft::document::value::TaggedValue::None, true, -1, "", "", breadcrumb_network_path);
115115
responses.add(NodeGraphMessage::SendGraph);
116116
}
117117
NodeGraphMessage::AddExport => {
@@ -2236,8 +2236,8 @@ impl NodeGraphMessageHandler {
22362236
data_type: FrontendGraphDataType::displayed_type(&input.ty, &input.type_source),
22372237
resolved_type: Some(format!("{:?} from {:?}", &input.ty, input.type_source)),
22382238
valid_types: input.valid_types.iter().map(|ty| ty.to_string()).collect(),
2239-
name: input.name.unwrap_or_else(|| input.ty.nested_type().to_string()),
2240-
description: input.description.unwrap_or_default(),
2239+
name: input.input_name.unwrap_or_else(|| input.ty.nested_type().to_string()),
2240+
description: input.input_description.unwrap_or_default(),
22412241
connected_to: input.output_connector,
22422242
})
22432243
});
@@ -2546,8 +2546,8 @@ impl NodeGraphMessageHandler {
25462546

25472547
#[derive(Default)]
25482548
struct InputLookup {
2549-
name: Option<String>,
2550-
description: Option<String>,
2549+
input_name: Option<String>,
2550+
input_description: Option<String>,
25512551
ty: Type,
25522552
type_source: TypeSource,
25532553
valid_types: Vec<Type>,
@@ -2574,20 +2574,17 @@ fn frontend_inputs_lookup(breadcrumb_network_path: &[NodeId], network_interface:
25742574
}
25752575

25762576
// Get the name from the metadata here (since it also requires a reference to the `network_interface`)
2577-
let name = network_interface
2578-
.input_name(&node_id, index, breadcrumb_network_path)
2577+
let input_name = network_interface
2578+
.input_name(node_id, index, breadcrumb_network_path)
25792579
.filter(|s| !s.is_empty())
25802580
.map(|name| name.to_string());
2581-
let description = network_interface
2582-
.input_description(&node_id, index, breadcrumb_network_path)
2583-
.filter(|s| !s.is_empty())
2584-
.map(|description| description.to_string());
2581+
let input_description = network_interface.input_description(node_id, index, breadcrumb_network_path).map(|description| description.to_string());
25852582
// Get the output connector that feeds into this input (done here as well for simplicity)
25862583
let connector = OutputConnector::from_input(input);
25872584

25882585
inputs.push(Some(InputLookup {
2589-
name,
2590-
description,
2586+
input_name,
2587+
input_description,
25912588
output_connector: connector,
25922589
..Default::default()
25932590
}));

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

+379-834
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)