From 0735b8756b2996e573832e5180035d1fa95f4f2c Mon Sep 17 00:00:00 2001 From: Kulratan Thapar Date: Wed, 18 Feb 2026 15:01:31 +0000 Subject: [PATCH 1/7] Upgrade --- .../document/node_graph/node_properties.rs | 9 +-------- .../properties_panel/properties_panel_message.rs | 2 ++ .../properties_panel_message_handler.rs | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index 2efeb8b207..20fea57447 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -2374,16 +2374,9 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper let visible = context.network_interface.is_visible(&node_id, context.selection_network_path); let pinned = context.network_interface.is_pinned(&node_id, context.selection_network_path); - let expanded = !context.properties_panel_collapsed_sections.contains(&node_id); + let expanded = !context.network_interface.is_collapsed(&node_id, context.selection_network_path); LayoutGroup::section(name, description, visible, pinned, expanded, node_id.0, Layout(layout)) -} - -/// The layer that a chain node ultimately feeds, if any. Returns `None` in a nested network since the layer metadata structure -/// is only loaded for the root document network, so a `LayerNodeIdentifier` can't be constructed there. -fn root_layer_for_chain_node(node_id: NodeId, context: &mut NodePropertiesContext) -> Option { - if !context.selection_network_path.is_empty() { - return None; } let layer_node = context.network_interface.downstream_layer_for_chain_node(&node_id, context.selection_network_path)?; Some(LayerNodeIdentifier::new(layer_node, context.network_interface)) diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message.rs index a87d8fb07d..954c909dee 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message.rs @@ -6,4 +6,6 @@ pub enum PropertiesPanelMessage { // Messages Clear, Refresh, + SetAllSectionsExpanded { expanded: bool }, + SetSectionExpanded { node_id: u64, expanded: bool }, } diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index 77e7742fc1..1b4856f9d9 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use graphene_std::uuid::NodeId; use crate::messages::layout::utility_types::widget_prelude::*; @@ -19,7 +21,9 @@ pub struct PropertiesPanelMessageContext<'a> { } #[derive(Debug, Clone, Default, ExtractField)] -pub struct PropertiesPanelMessageHandler {} +pub struct PropertiesPanelMessageHandler { + pub section_expanded: HashMap, +} #[message_handler_data] impl MessageHandler> for PropertiesPanelMessageHandler { @@ -65,6 +69,16 @@ impl MessageHandler> f layout_target: LayoutTarget::PropertiesPanel, }); } + PropertiesPanelMessage::SetAllSectionsExpanded { expanded } => { + for value in self.section_expanded.values_mut() { + *value = expanded; + } + responses.add(PropertiesPanelMessage::Refresh); + } + PropertiesPanelMessage::SetSectionExpanded { node_id, expanded } => { + self.section_expanded.insert(node_id, expanded); + responses.add(PropertiesPanelMessage::Refresh); + } } } From f4055c552ae82d68a5be6fce5076cb85ba839f7d Mon Sep 17 00:00:00 2001 From: Kulratan Thapar Date: Thu, 19 Feb 2026 07:36:34 +0000 Subject: [PATCH 2/7] Fix --- .../document/graph_operation/utility_types.rs | 1 + .../properties_panel_message_handler.rs | 52 +++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/editor/src/messages/portfolio/document/graph_operation/utility_types.rs b/editor/src/messages/portfolio/document/graph_operation/utility_types.rs index d792346fe0..ea587fdcac 100644 --- a/editor/src/messages/portfolio/document/graph_operation/utility_types.rs +++ b/editor/src/messages/portfolio/document/graph_operation/utility_types.rs @@ -65,6 +65,7 @@ impl<'a> ModifyInputsContext<'a> { pub fn create_layer(&mut self, new_id: NodeId) -> LayerNodeIdentifier { let new_merge_node = resolve_network_node_type("Merge").expect("Merge node").default_node_template(); self.network_interface.insert_node(new_id, new_merge_node, &[]); + self.responses.add(PropertiesPanelMessage::SetSectionExpanded { node_id: new_id.0, expanded: false }); LayerNodeIdentifier::new(new_id, self.network_interface) } diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index 1b4856f9d9..e4f16c2b9e 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -70,10 +70,25 @@ impl MessageHandler> f }); } PropertiesPanelMessage::SetAllSectionsExpanded { expanded } => { - for value in self.section_expanded.values_mut() { - *value = expanded; - } - responses.add(PropertiesPanelMessage::Refresh); + let mut layout = { + let mut node_properties_context = NodePropertiesContext { + persistent_data, + responses, + network_interface, + selection_network_path, + document_name, + executor, + section_expanded: &self.section_expanded, + }; + Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)) + }; + + Self::update_all_section_expansion_recursive(&mut layout.0, expanded, &mut self.section_expanded, network_interface, selection_network_path); + + responses.add(LayoutMessage::SendLayout { + layout, + layout_target: LayoutTarget::PropertiesPanel, + }); } PropertiesPanelMessage::SetSectionExpanded { node_id, expanded } => { self.section_expanded.insert(node_id, expanded); @@ -86,3 +101,32 @@ impl MessageHandler> f actions!(PropertiesMessageDiscriminant;) } } + +impl PropertiesPanelMessageHandler { + fn update_all_section_expansion_recursive( + layout: &mut [LayoutGroup], + expanded: bool, + section_expanded: &mut HashMap, + network_interface: &NodeNetworkInterface, + selection_network_path: &[NodeId], + ) { + for group in layout { + if let LayoutGroup::Section { + id, layout, expanded: group_expanded, .. + } = group + { + let is_merge_node = network_interface + .reference(&NodeId(*id), selection_network_path) + .as_ref() + .is_some_and(|id| id.implementation_name_from_identifier() == "Merge"); + + if !is_merge_node { + *group_expanded = expanded; + section_expanded.insert(*id, expanded); + } + + Self::update_all_section_expansion_recursive(&mut layout.0, expanded, section_expanded, network_interface, selection_network_path); + } + } + } +} From 7571e471c68e8a434b776751f8593968abddcd76 Mon Sep 17 00:00:00 2001 From: Kulratan Thapar Date: Thu, 19 Feb 2026 18:40:10 +0000 Subject: [PATCH 3/7] Requested changes --- .../properties_panel_message_handler.rs | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index e4f16c2b9e..1b0a218a89 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -83,7 +83,7 @@ impl MessageHandler> f Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)) }; - Self::update_all_section_expansion_recursive(&mut layout.0, expanded, &mut self.section_expanded, network_interface, selection_network_path); + Self::update_all_section_expansion_recursive(&mut layout.0, expanded, &mut self.section_expanded); responses.add(LayoutMessage::SendLayout { layout, @@ -103,29 +103,16 @@ impl MessageHandler> f } impl PropertiesPanelMessageHandler { - fn update_all_section_expansion_recursive( - layout: &mut [LayoutGroup], - expanded: bool, - section_expanded: &mut HashMap, - network_interface: &NodeNetworkInterface, - selection_network_path: &[NodeId], - ) { + fn update_all_section_expansion_recursive(layout: &mut [LayoutGroup], expanded: bool, section_expanded: &mut HashMap) { for group in layout { if let LayoutGroup::Section { id, layout, expanded: group_expanded, .. } = group { - let is_merge_node = network_interface - .reference(&NodeId(*id), selection_network_path) - .as_ref() - .is_some_and(|id| id.implementation_name_from_identifier() == "Merge"); + *group_expanded = expanded; + section_expanded.insert(*id, expanded); - if !is_merge_node { - *group_expanded = expanded; - section_expanded.insert(*id, expanded); - } - - Self::update_all_section_expansion_recursive(&mut layout.0, expanded, section_expanded, network_interface, selection_network_path); + Self::update_all_section_expansion_recursive(&mut layout.0, expanded, section_expanded); } } } From 14253f50f36754261048843a1965f193da09ebfa Mon Sep 17 00:00:00 2001 From: Kulratan Thapar Date: Sat, 21 Feb 2026 11:56:47 +0000 Subject: [PATCH 4/7] Fix --- .../document/document_message_handler.rs | 6 +--- .../node_graph/document_node_definitions.rs | 16 +++++++-- .../document/node_graph/node_graph_message.rs | 4 +++ .../node_graph/node_graph_message_handler.rs | 5 +++ .../document/node_graph/node_properties.rs | 19 +++++++++++ .../properties_panel_message_handler.rs | 34 ++++++++++++------- .../network_interface/deserialization.rs | 1 + 7 files changed, 65 insertions(+), 20 deletions(-) diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 5908d70c64..5398e7ca8b 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -98,9 +98,6 @@ pub struct DocumentMessageHandler { /// Tracks which layer occurrences are collapsed in the Layers panel, keyed by tree path. #[serde(deserialize_with = "deserialize_collapsed_layers", default)] pub collapsed: CollapsedLayers, - /// The node IDs whose section is collapsed in the Properties panel. - #[serde(default)] - pub properties_panel_collapsed_sections: Vec, /// The full Git commit hash of the Graphite repository that was used to build the editor. /// We save this to provide a hint about which version of the editor was used to create the document. pub commit_hash: String, @@ -178,7 +175,6 @@ impl Default for DocumentMessageHandler { network_interface: default_document_network_interface(), resources: ResourceMessageHandler::default(), collapsed: CollapsedLayers::default(), - properties_panel_collapsed_sections: Vec::new(), commit_hash: GRAPHITE_GIT_COMMIT_HASH.to_string(), document_ptz: PTZ::default(), render_mode: RenderMode::default(), @@ -253,7 +249,7 @@ impl MessageHandler> for DocumentMes document_name: self.name.as_str(), fonts, properties_panel_open, - properties_panel_collapsed_sections: &self.properties_panel_collapsed_sections, + properties_panel_collapsed_sections: &[], }; self.properties_panel_message_handler.process_message(message, responses, context); } diff --git a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs index 3ab0dcc0f1..a09b4e61a1 100644 --- a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs +++ b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs @@ -23,6 +23,8 @@ use graphene_std::vector::Vector; use graphene_std::*; use std::collections::{HashMap, VecDeque}; +pub const MERGE_NODE_IDENTIFIER: &str = "Merge"; + pub struct NodePropertiesContext<'a> { pub responses: &'a mut VecDeque, pub executor: &'a mut NodeGraphExecutor, @@ -31,8 +33,11 @@ pub struct NodePropertiesContext<'a> { pub fonts: &'a FontsMessageHandler, pub selection_network_path: &'a [NodeId], pub document_name: &'a str, +<<<<<<< HEAD /// The node IDs whose Properties panel sections the user has collapsed. pub properties_panel_collapsed_sections: &'a [NodeId], +======= +>>>>>>> 292bad2e7 (Fix) } impl NodePropertiesContext<'_> { @@ -145,7 +150,7 @@ fn document_node_definitions() -> HashMap NodeTemplate { self.node_template_input_override(self.node_template.inputs.clone().into_iter().map(Some)) } diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs index d7df7271fc..5884dae448 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message.rs @@ -237,6 +237,10 @@ pub enum NodeGraphMessage { node_id: NodeId, pinned: bool, }, + SetCollapsed { + node_id: NodeId, + collapsed: bool, + }, SetVisibility { node_id: NodeId, network_path: Vec, 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 13632c96a9..ada9612d87 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 @@ -2029,6 +2029,9 @@ impl<'a> MessageHandler> for NodeG NodeGraphMessage::SetPinned { node_id, pinned } => { network_interface.set_pinned(&node_id, selection_network_path, pinned); } + NodeGraphMessage::SetCollapsed { node_id, collapsed } => { + network_interface.set_collapsed(&node_id, selection_network_path, collapsed); + } NodeGraphMessage::SetVisibility { node_id, network_path, visible } => { network_interface.set_visibility(&node_id, &network_path, visible); } @@ -2038,6 +2041,8 @@ impl<'a> MessageHandler> for NodeG } responses.add(NodeGraphMessage::UpdateActionButtons); responses.add(NodeGraphMessage::SendGraph); + responses.add(NodeGraphMessage::UpdateLayerPanel); + responses.add(PortfolioMessage::AutoSaveActiveDocument); responses.add(PropertiesPanelMessage::Refresh); responses.add(DataPanelMessage::Refresh); diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index 20fea57447..8c5bfe9d90 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -2347,6 +2347,7 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper if layout.is_empty() { layout = node_no_properties(node_id, context); } +<<<<<<< HEAD let display_name = context .network_interface @@ -2362,6 +2363,19 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper } else { implementation_name }; +======= + let mut name = context.network_interface.implementation_name(&node_id, context.selection_network_path); + if name == "Custom Node" { + if let Some(display_name) = context + .network_interface + .node_metadata(&node_id, context.selection_network_path) + .map(|metadata| metadata.persistent_metadata.display_name.clone()) + .filter(|name| !name.is_empty()) + { + name = display_name; + } + } +>>>>>>> 292bad2e7 (Fix) let description = context .network_interface @@ -2374,7 +2388,12 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper let visible = context.network_interface.is_visible(&node_id, context.selection_network_path); let pinned = context.network_interface.is_pinned(&node_id, context.selection_network_path); +<<<<<<< HEAD let expanded = !context.network_interface.is_collapsed(&node_id, context.selection_network_path); +======= + let collapsed = context.network_interface.is_collapsed(&node_id, context.selection_network_path); + let expanded = !collapsed; +>>>>>>> 292bad2e7 (Fix) LayoutGroup::section(name, description, visible, pinned, expanded, node_id.0, Layout(layout)) } diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index 1b0a218a89..67c36a5e9d 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -1,5 +1,3 @@ -use std::collections::HashMap; - use graphene_std::uuid::NodeId; use crate::messages::layout::utility_types::widget_prelude::*; @@ -21,9 +19,7 @@ pub struct PropertiesPanelMessageContext<'a> { } #[derive(Debug, Clone, Default, ExtractField)] -pub struct PropertiesPanelMessageHandler { - pub section_expanded: HashMap, -} +pub struct PropertiesPanelMessageHandler {} #[message_handler_data] impl MessageHandler> for PropertiesPanelMessageHandler { @@ -59,8 +55,12 @@ impl MessageHandler> f resources, selection_network_path, document_name, +<<<<<<< HEAD fonts, properties_panel_collapsed_sections, +======= + executor, +>>>>>>> 292bad2e7 (Fix) }; let layout = Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)); @@ -78,12 +78,15 @@ impl MessageHandler> f selection_network_path, document_name, executor, - section_expanded: &self.section_expanded, }; Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)) }; - Self::update_all_section_expansion_recursive(&mut layout.0, expanded, &mut self.section_expanded); + responses.add(DocumentMessage::AddTransaction); + let node_ids = Self::update_all_section_expansion_recursive(&mut layout.0, expanded, responses); + if !node_ids.is_empty() { + responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids }); + } responses.add(LayoutMessage::SendLayout { layout, @@ -91,8 +94,10 @@ impl MessageHandler> f }); } PropertiesPanelMessage::SetSectionExpanded { node_id, expanded } => { - self.section_expanded.insert(node_id, expanded); - responses.add(PropertiesPanelMessage::Refresh); + let node_id = NodeId(node_id); + responses.add(DocumentMessage::AddTransaction); + responses.add(NodeGraphMessage::SetCollapsed { node_id, collapsed: !expanded }); + responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids: vec![node_id] }); } } } @@ -103,17 +108,20 @@ impl MessageHandler> f } impl PropertiesPanelMessageHandler { - fn update_all_section_expansion_recursive(layout: &mut [LayoutGroup], expanded: bool, section_expanded: &mut HashMap) { + fn update_all_section_expansion_recursive(layout: &mut [LayoutGroup], expanded: bool, responses: &mut VecDeque) -> Vec { + let mut node_ids = Vec::new(); for group in layout { if let LayoutGroup::Section { id, layout, expanded: group_expanded, .. } = group { *group_expanded = expanded; - section_expanded.insert(*id, expanded); - - Self::update_all_section_expansion_recursive(&mut layout.0, expanded, section_expanded); + let node_id = NodeId(*id); + node_ids.push(node_id); + responses.add(NodeGraphMessage::SetCollapsed { node_id, collapsed: !expanded }); + node_ids.extend(Self::update_all_section_expansion_recursive(&mut layout.0, expanded, responses)); } } + node_ids } } diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs index 20927b20b0..e14d97127a 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs @@ -146,6 +146,7 @@ impl From for DocumentNodePersist output_names: old.output_names, locked: old.locked, pinned: old.pinned, + collapsed: false, node_type_metadata: old.node_type_metadata, network_metadata: old.network_metadata, } From f7588f506ddd94edbe4fae62ed09dcbf84d4911c Mon Sep 17 00:00:00 2001 From: Kulratan Date: Fri, 13 Mar 2026 17:15:05 +0000 Subject: [PATCH 5/7] logic improvment --- .../document/node_graph/document_node_definitions.rs | 2 +- .../properties_panel/properties_panel_message_handler.rs | 9 ++++++--- .../utility_types/network_interface/deserialization.rs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs index a09b4e61a1..9d909df5f4 100644 --- a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs +++ b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs @@ -1550,7 +1550,7 @@ impl DocumentNodeDefinition { network.persistent_metadata.reference = Some(self.identifier.to_string()); } if self.identifier == MERGE_NODE_IDENTIFIER { - template.persistent_node_metadata.collapsed = true; + template.persistent_node_metadata.collapsed = Some(true); } template diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index 67c36a5e9d..c25e1323d7 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -111,9 +111,12 @@ impl PropertiesPanelMessageHandler { fn update_all_section_expansion_recursive(layout: &mut [LayoutGroup], expanded: bool, responses: &mut VecDeque) -> Vec { let mut node_ids = Vec::new(); for group in layout { - if let LayoutGroup::Section { - id, layout, expanded: group_expanded, .. - } = group + if let LayoutGroup::Section(WidgetSection { + id, + layout, + expanded: group_expanded, + .. + }) = group { *group_expanded = expanded; let node_id = NodeId(*id); diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs index e14d97127a..099e2a2033 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/deserialization.rs @@ -146,7 +146,7 @@ impl From for DocumentNodePersist output_names: old.output_names, locked: old.locked, pinned: old.pinned, - collapsed: false, + collapsed: None, node_type_metadata: old.node_type_metadata, network_metadata: old.network_metadata, } From 894f9c0b1d15bf1b6383b13e59126b5401c96c52 Mon Sep 17 00:00:00 2001 From: Kulratan Date: Fri, 13 Mar 2026 17:52:16 +0000 Subject: [PATCH 6/7] Improve logic --- .../properties_panel/properties_panel_message_handler.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index c25e1323d7..a02f580568 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -82,7 +82,6 @@ impl MessageHandler> f Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)) }; - responses.add(DocumentMessage::AddTransaction); let node_ids = Self::update_all_section_expansion_recursive(&mut layout.0, expanded, responses); if !node_ids.is_empty() { responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids }); @@ -95,7 +94,6 @@ impl MessageHandler> f } PropertiesPanelMessage::SetSectionExpanded { node_id, expanded } => { let node_id = NodeId(node_id); - responses.add(DocumentMessage::AddTransaction); responses.add(NodeGraphMessage::SetCollapsed { node_id, collapsed: !expanded }); responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids: vec![node_id] }); } @@ -112,10 +110,7 @@ impl PropertiesPanelMessageHandler { let mut node_ids = Vec::new(); for group in layout { if let LayoutGroup::Section(WidgetSection { - id, - layout, - expanded: group_expanded, - .. + id, layout, expanded: group_expanded, .. }) = group { *group_expanded = expanded; From c3c315d4d77676f4a7104538cc484dc6a6a31c67 Mon Sep 17 00:00:00 2001 From: Kulratan Date: Wed, 12 Aug 2026 11:15:29 +0000 Subject: [PATCH 7/7] Fix rebase conflicts and update Properties panel section persistence for master architecture --- .../document/document_message_handler.rs | 13 +++++---- .../node_graph/document_node_definitions.rs | 11 -------- .../node_graph/node_graph_message_handler.rs | 6 ----- .../document/node_graph/node_properties.rs | 27 +++++-------------- .../properties_panel_message_handler.rs | 17 ++++++------ .../network_interface/mutations.rs | 10 +++++++ .../network_interface/queries.rs | 4 +++ .../network_interface/template.rs | 2 ++ .../utility_types/network_interface/types.rs | 2 ++ .../utility_types/network_interface/view.rs | 6 +++++ 10 files changed, 46 insertions(+), 52 deletions(-) diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 5398e7ca8b..a53d532590 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -273,7 +273,6 @@ impl MessageHandler> for DocumentMes breadcrumb_network_path: &self.breadcrumb_network_path, document_id, collapsed: &mut self.collapsed, - properties_panel_collapsed_sections: &mut self.properties_panel_collapsed_sections, ipp, graph_view_overlay_open: self.graph_view_overlay_open, graph_fade_artwork_percentage: self.graph_fade_artwork_percentage, @@ -1407,12 +1406,12 @@ impl MessageHandler> for DocumentMes responses.add(NodeGraphMessage::SendGraph); } DocumentMessage::ToggleNodePropertiesSectionExpanded { node_id } => { - if let Some(index) = self.properties_panel_collapsed_sections.iter().position(|id| *id == node_id) { - self.properties_panel_collapsed_sections.remove(index); - } else { - self.properties_panel_collapsed_sections.push(node_id); - } - responses.add(PropertiesPanelMessage::Refresh); + let collapsed = !self.network_interface.is_collapsed(&node_id, &[]); + responses.add(NodeGraphMessage::SetCollapsed { node_id, collapsed }); + responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { + node_ids: vec![node_id], + network_path: vec![], + }); } DocumentMessage::ToggleSelectedLocked => responses.add(NodeGraphMessage::ToggleSelectedLocked), DocumentMessage::ToggleSelectedVisibility => { diff --git a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs index 9d909df5f4..7ea47d1eff 100644 --- a/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs +++ b/editor/src/messages/portfolio/document/node_graph/document_node_definitions.rs @@ -33,11 +33,8 @@ pub struct NodePropertiesContext<'a> { pub fonts: &'a FontsMessageHandler, pub selection_network_path: &'a [NodeId], pub document_name: &'a str, -<<<<<<< HEAD /// The node IDs whose Properties panel sections the user has collapsed. pub properties_panel_collapsed_sections: &'a [NodeId], -======= ->>>>>>> 292bad2e7 (Fix) } impl NodePropertiesContext<'_> { @@ -1545,14 +1542,6 @@ impl DocumentNodeDefinition { // Ensure that the input properties are initialized for every input of every node template.normalize_input_metadata(); - if let DocumentNodeImplementation::Network(_) = &template.document_node.implementation { - let network = template.persistent_node_metadata.network_metadata.get_or_insert_with(NodeNetworkMetadata::default); - network.persistent_metadata.reference = Some(self.identifier.to_string()); - } - if self.identifier == MERGE_NODE_IDENTIFIER { - template.persistent_node_metadata.collapsed = Some(true); - } - template } 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 ada9612d87..dc4fcd39fe 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 @@ -39,7 +39,6 @@ pub struct NodeGraphMessageContext<'a> { pub breadcrumb_network_path: &'a [NodeId], pub document_id: DocumentId, pub collapsed: &'a mut CollapsedLayers, - pub properties_panel_collapsed_sections: &'a mut Vec, pub ipp: &'a InputPreprocessorMessageHandler, pub graph_view_overlay_open: bool, pub graph_fade_artwork_percentage: f64, @@ -111,7 +110,6 @@ impl<'a> MessageHandler> for NodeG breadcrumb_network_path, document_id, collapsed, - properties_panel_collapsed_sections, ipp, graph_view_overlay_open, graph_fade_artwork_percentage, @@ -193,10 +191,6 @@ impl<'a> MessageHandler> for NodeG // Prune the Layers panel collapsed state for any layer tree paths whose nodes no longer exist, so it doesn't accumulate across loads collapsed.0.retain(|path| path.iter().all(|&node_id| network_interface.document_network().nodes.contains_key(&node_id))); - - // Prune the Properties panel node section collapsed state for any nodes (in any nested network) that no longer exist, so it doesn't accumulate across loads - let existing_nodes = network_interface.document_network().recursive_nodes().map(|(node_id, ..)| *node_id).collect::>(); - properties_panel_collapsed_sections.retain(|node_id| existing_nodes.contains(node_id)); } NodeGraphMessage::SelectedNodesUpdated => { let selected_layers = network_interface.selected_nodes().selected_layers(network_interface.document_metadata()).collect::>(); diff --git a/editor/src/messages/portfolio/document/node_graph/node_properties.rs b/editor/src/messages/portfolio/document/node_graph/node_properties.rs index 8c5bfe9d90..233c5f8e8b 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_properties.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_properties.rs @@ -2347,8 +2347,6 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper if layout.is_empty() { layout = node_no_properties(node_id, context); } -<<<<<<< HEAD - let display_name = context .network_interface .node_metadata(&node_id, context.selection_network_path) @@ -2363,19 +2361,6 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper } else { implementation_name }; -======= - let mut name = context.network_interface.implementation_name(&node_id, context.selection_network_path); - if name == "Custom Node" { - if let Some(display_name) = context - .network_interface - .node_metadata(&node_id, context.selection_network_path) - .map(|metadata| metadata.persistent_metadata.display_name.clone()) - .filter(|name| !name.is_empty()) - { - name = display_name; - } - } ->>>>>>> 292bad2e7 (Fix) let description = context .network_interface @@ -2388,14 +2373,16 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper let visible = context.network_interface.is_visible(&node_id, context.selection_network_path); let pinned = context.network_interface.is_pinned(&node_id, context.selection_network_path); -<<<<<<< HEAD let expanded = !context.network_interface.is_collapsed(&node_id, context.selection_network_path); -======= - let collapsed = context.network_interface.is_collapsed(&node_id, context.selection_network_path); - let expanded = !collapsed; ->>>>>>> 292bad2e7 (Fix) LayoutGroup::section(name, description, visible, pinned, expanded, node_id.0, Layout(layout)) +} + +/// The layer that a chain node ultimately feeds, if any. Returns `None` in a nested network since the layer metadata structure +/// is only loaded for the root document network, so a `LayerNodeIdentifier` can't be constructed there. +fn root_layer_for_chain_node(node_id: NodeId, context: &mut NodePropertiesContext) -> Option { + if !context.selection_network_path.is_empty() { + return None; } let layer_node = context.network_interface.downstream_layer_for_chain_node(&node_id, context.selection_network_path)?; Some(LayerNodeIdentifier::new(layer_node, context.network_interface)) diff --git a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs index a02f580568..1e08b5096c 100644 --- a/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs +++ b/editor/src/messages/portfolio/document/properties_panel/properties_panel_message_handler.rs @@ -55,12 +55,8 @@ impl MessageHandler> f resources, selection_network_path, document_name, -<<<<<<< HEAD fonts, properties_panel_collapsed_sections, -======= - executor, ->>>>>>> 292bad2e7 (Fix) }; let layout = Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)); @@ -72,19 +68,21 @@ impl MessageHandler> f PropertiesPanelMessage::SetAllSectionsExpanded { expanded } => { let mut layout = { let mut node_properties_context = NodePropertiesContext { - persistent_data, responses, + executor, network_interface, + resources, + fonts, selection_network_path, document_name, - executor, + properties_panel_collapsed_sections, }; Layout(NodeGraphMessageHandler::collate_properties(&mut node_properties_context)) }; let node_ids = Self::update_all_section_expansion_recursive(&mut layout.0, expanded, responses); if !node_ids.is_empty() { - responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids }); + responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids, network_path: vec![] }); } responses.add(LayoutMessage::SendLayout { @@ -95,7 +93,10 @@ impl MessageHandler> f PropertiesPanelMessage::SetSectionExpanded { node_id, expanded } => { let node_id = NodeId(node_id); responses.add(NodeGraphMessage::SetCollapsed { node_id, collapsed: !expanded }); - responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { node_ids: vec![node_id] }); + responses.add(NodeGraphMessage::SetLockedOrVisibilitySideEffects { + node_ids: vec![node_id], + network_path: vec![], + }); } } } diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/mutations.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/mutations.rs index 1b2b873985..0db8652d38 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/mutations.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/mutations.rs @@ -1393,6 +1393,16 @@ impl NodeNetworkInterface { self.transaction_modified(); } + pub fn set_collapsed(&mut self, node_id: &NodeId, network_path: &[NodeId], collapsed: bool) { + let Some(node_metadata) = self.node_metadata_mut(node_id, network_path) else { + log::error!("Could not get node {node_id} in set_collapsed"); + return; + }; + + node_metadata.persistent_metadata.collapsed = Some(collapsed); + self.transaction_modified(); + } + /// Reorders a pinned node within its network's Properties panel display order so it ends up at `insert_index` among the /// pinned nodes (0 being the topmost). Rebuilds the order from the list as currently shown, which also drops stale entries. pub fn reorder_pinned_node(&mut self, node_id: NodeId, insert_index: usize, network_path: &[NodeId]) { diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/queries.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/queries.rs index bf888f4ca5..ad5962414c 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/queries.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/queries.rs @@ -832,6 +832,10 @@ impl NodeNetworkInterface { self.query(network_path, "is_pinned", |view| view.is_pinned(node_id)).unwrap_or_default() } + pub fn is_collapsed(&self, node_id: &NodeId, network_path: &[NodeId]) -> bool { + self.query(network_path, "is_collapsed", |view| view.is_collapsed(node_id)).unwrap_or_default() + } + /// The given network's pinned nodes in display order: pinning appends, dragging rearranges, and any not yet recorded go last. pub fn ordered_pinned_nodes(&self, network_path: &[NodeId]) -> Vec { self.query(network_path, "ordered_pinned_nodes", |view| Ok(view.ordered_pinned_nodes())).unwrap_or_default() diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/template.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/template.rs index 3fccaba631..31c10a36a4 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/template.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/template.rs @@ -119,6 +119,7 @@ impl NodeTemplate { output_names, locked, pinned, + collapsed: _, node_type_metadata, network_metadata, } = persistent_node_metadata; @@ -201,6 +202,7 @@ impl NodeTemplate { output_names, locked, pinned, + collapsed: None, node_type_metadata, network_metadata, }; diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs index 74361697b7..9f872da646 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/types.rs @@ -640,6 +640,8 @@ pub struct DocumentNodePersistentMetadata { /// Indicates that the node will be shown in the Properties panel when it would otherwise be empty, letting a user easily edit its properties by just deselecting everything. #[serde(default)] pub pinned: bool, + #[serde(default)] + pub collapsed: Option, /// Metadata that is specific to either nodes or layers, which are chosen states for displaying as a left-to-right node or bottom-to-top layer. /// All fields in NodeTypePersistentMetadata should automatically be updated by using the network interface API pub node_type_metadata: NodeTypePersistentMetadata, diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface/view.rs b/editor/src/messages/portfolio/document/utility_types/network_interface/view.rs index 6c99aca531..13a568375d 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface/view.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface/view.rs @@ -192,6 +192,12 @@ impl<'a, 'p> NetworkView<'a, 'p> { Ok(self.node_metadata(node_id)?.persistent_metadata.pinned) } + pub fn is_collapsed(&self, node_id: &NodeId) -> Result { + let node_metadata = self.node_metadata(node_id)?; + let collapsed = node_metadata.persistent_metadata.collapsed.unwrap_or_else(|| self.implementation_name(node_id) == "Merge"); + Ok(collapsed) + } + pub fn is_visible(&self, node_id: &NodeId) -> Result { Ok(self.node(node_id)?.visible) }