Skip to content

Commit 9727e14

Browse files
timon-schellingKeavon
authored andcommitted
Add the re-labeled node display name to its Properties panel section header (#3930)
* Show nodes display name in properties panel if set * Review
1 parent 9a23b99 commit 9727e14

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ fn document_node_definitions() -> HashMap<DefinitionIdentifier, DocumentNodeDefi
174174
properties: Some("monitor_properties"),
175175
},
176176
DocumentNodeDefinition {
177-
identifier: "Default Network",
177+
identifier: "Custom Node",
178178
category: "General",
179179
node_template: NodeTemplate {
180180
document_node: DocumentNode {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
645645

646646
// Use the network interface to add a default node, then set the imports, exports, paste the nodes inside, and connect them to the imports/exports
647647
let encapsulating_node_id = NodeId::new();
648-
let mut default_node_template = resolve_network_node_type("Default Network").expect("Default Network node should exist").default_node_template();
648+
let mut default_node_template = resolve_network_node_type("Custom Node").expect("Custom Node should exist").default_node_template();
649649
let Some(center_of_selected_nodes) = network_interface.selected_nodes_bounding_box(breadcrumb_network_path).map(|[a, b]| (a + b) / 2.) else {
650650
log::error!("Could not get center of selected_nodes");
651651
return;

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,21 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper
17961796
if layout.is_empty() {
17971797
layout = node_no_properties(node_id, context);
17981798
}
1799-
let name = context.network_interface.implementation_name(&node_id, context.selection_network_path);
1799+
1800+
let display_name = context
1801+
.network_interface
1802+
.node_metadata(&node_id, context.selection_network_path)
1803+
.map(|metadata| metadata.persistent_metadata.display_name.as_str());
1804+
let implementation_name = context.network_interface.implementation_name(&node_id, context.selection_network_path);
1805+
let name = if let Some(display_name) = display_name
1806+
&& implementation_name != display_name
1807+
&& implementation_name != "Custom Node"
1808+
&& !display_name.is_empty()
1809+
{
1810+
format!("{display_name} ({implementation_name})")
1811+
} else {
1812+
implementation_name
1813+
};
18001814

18011815
let description = context
18021816
.network_interface

0 commit comments

Comments
 (0)