@@ -659,6 +659,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
659659 } ) ;
660660 responses. add ( NodeGraphMessage :: SetDisplayNameImpl {
661661 node_id : encapsulating_node_id,
662+ network_path : selection_network_path. to_vec ( ) ,
662663 alias : "Untitled Node" . to_string ( ) ,
663664 } ) ;
664665
@@ -909,13 +910,19 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
909910
910911 // Toggle visibility of clicked node and return
911912 if let Some ( clicked_visibility) = network_interface. layer_click_target_from_click ( click, network_interface:: LayerClickTargetTypes :: Visibility , selection_network_path) {
912- responses. add ( NodeGraphMessage :: ToggleVisibility { node_id : clicked_visibility } ) ;
913+ responses. add ( NodeGraphMessage :: ToggleVisibility {
914+ node_id : clicked_visibility,
915+ network_path : selection_network_path. to_vec ( ) ,
916+ } ) ;
913917 return ;
914918 }
915919
916920 // Toggle lock of clicked node and return
917921 if let Some ( clicked_lock) = network_interface. layer_click_target_from_click ( click, network_interface:: LayerClickTargetTypes :: Lock , selection_network_path) {
918- responses. add ( NodeGraphMessage :: ToggleLocked { node_id : clicked_lock } ) ;
922+ responses. add ( NodeGraphMessage :: ToggleLocked {
923+ node_id : clicked_lock,
924+ network_path : selection_network_path. to_vec ( ) ,
925+ } ) ;
919926 return ;
920927 }
921928
@@ -1816,13 +1823,14 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
18161823 }
18171824 NodeGraphMessage :: SetDisplayName {
18181825 node_id,
1826+ network_path,
18191827 alias,
18201828 skip_adding_history_step,
18211829 } => {
18221830 if !skip_adding_history_step {
18231831 responses. add ( DocumentMessage :: StartTransaction ) ;
18241832 }
1825- responses. add ( NodeGraphMessage :: SetDisplayNameImpl { node_id, alias } ) ;
1833+ responses. add ( NodeGraphMessage :: SetDisplayNameImpl { node_id, network_path , alias } ) ;
18261834 if !skip_adding_history_step {
18271835 // Does not add a history step if the name was not changed
18281836 responses. add ( DocumentMessage :: EndTransaction ) ;
@@ -1831,9 +1839,10 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
18311839 responses. add ( DocumentMessage :: RenderScrollbars ) ;
18321840 responses. add ( NodeGraphMessage :: SendGraph ) ;
18331841 responses. add ( OverlaysMessage :: Draw ) ; // Redraw overlays to update artboard names
1842+ responses. add ( DataPanelMessage :: Refresh ) ;
18341843 }
1835- NodeGraphMessage :: SetDisplayNameImpl { node_id, alias } => {
1836- network_interface. set_display_name ( & node_id, alias, selection_network_path ) ;
1844+ NodeGraphMessage :: SetDisplayNameImpl { node_id, network_path , alias } => {
1845+ network_interface. set_display_name ( & node_id, alias, & network_path ) ;
18371846 }
18381847 NodeGraphMessage :: SetImportExportName { name, index } => {
18391848 responses. add ( DocumentMessage :: StartTransaction ) ;
@@ -1872,25 +1881,34 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
18721881 responses. add ( DocumentMessage :: AddTransaction ) ;
18731882
18741883 for node_id in & node_ids {
1875- responses. add ( NodeGraphMessage :: SetLocked { node_id : * node_id, locked } ) ;
1884+ responses. add ( NodeGraphMessage :: SetLocked {
1885+ node_id : * node_id,
1886+ network_path : selection_network_path. to_vec ( ) ,
1887+ locked,
1888+ } ) ;
18761889 }
18771890
1878- responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids } )
1891+ responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects {
1892+ node_ids,
1893+ network_path : selection_network_path. to_vec ( ) ,
1894+ } )
18791895 }
1880- NodeGraphMessage :: ToggleLocked { node_id } => {
1881- let Some ( node_metadata) = network_interface. document_network_metadata ( ) . persistent_metadata . node_metadata . get ( & node_id) else {
1882- log:: error!( "Cannot get node {node_id:?} in NodeGraphMessage::ToggleLocked" ) ;
1883- return ;
1884- } ;
1885-
1886- let locked = !node_metadata. persistent_metadata . locked ;
1896+ NodeGraphMessage :: ToggleLocked { node_id, network_path } => {
1897+ let locked = !network_interface. is_locked ( & node_id, & network_path) ;
18871898
18881899 responses. add ( DocumentMessage :: AddTransaction ) ;
1889- responses. add ( NodeGraphMessage :: SetLocked { node_id, locked } ) ;
1890- responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids : vec ! [ node_id] } )
1900+ responses. add ( NodeGraphMessage :: SetLocked {
1901+ node_id,
1902+ network_path : network_path. clone ( ) ,
1903+ locked,
1904+ } ) ;
1905+ responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects {
1906+ node_ids : vec ! [ node_id] ,
1907+ network_path,
1908+ } ) ;
18911909 }
1892- NodeGraphMessage :: SetLocked { node_id, locked } => {
1893- network_interface. set_locked ( & node_id, selection_network_path , locked) ;
1910+ NodeGraphMessage :: SetLocked { node_id, network_path , locked } => {
1911+ network_interface. set_locked ( & node_id, & network_path , locked) ;
18941912 }
18951913 NodeGraphMessage :: ToggleSelectedIsPinned => {
18961914 let Some ( selected_nodes) = network_interface. selected_nodes_in_nested_network ( selection_network_path) else {
@@ -1906,7 +1924,10 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19061924 for node_id in & node_ids {
19071925 responses. add ( NodeGraphMessage :: SetPinned { node_id : * node_id, pinned } ) ;
19081926 }
1909- responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids } ) ;
1927+ responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects {
1928+ node_ids,
1929+ network_path : selection_network_path. to_vec ( ) ,
1930+ } ) ;
19101931 }
19111932 NodeGraphMessage :: ToggleSelectedVisibility => {
19121933 let Some ( selected_nodes) = network_interface. selected_nodes_in_nested_network ( selection_network_path) else {
@@ -1920,31 +1941,46 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19201941
19211942 responses. add ( DocumentMessage :: AddTransaction ) ;
19221943 for node_id in & node_ids {
1923- responses. add ( NodeGraphMessage :: SetVisibility { node_id : * node_id, visible } ) ;
1944+ responses. add ( NodeGraphMessage :: SetVisibility {
1945+ node_id : * node_id,
1946+ network_path : selection_network_path. to_vec ( ) ,
1947+ visible,
1948+ } ) ;
19241949 }
1925- responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids } ) ;
1950+ responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects {
1951+ node_ids,
1952+ network_path : selection_network_path. to_vec ( ) ,
1953+ } ) ;
19261954 }
1927- NodeGraphMessage :: ToggleVisibility { node_id } => {
1928- let visible = !network_interface. is_visible ( & node_id, selection_network_path ) ;
1955+ NodeGraphMessage :: ToggleVisibility { node_id, network_path } => {
1956+ let visible = !network_interface. is_visible ( & node_id, & network_path ) ;
19291957
19301958 responses. add ( DocumentMessage :: AddTransaction ) ;
1931- responses. add ( NodeGraphMessage :: SetVisibility { node_id, visible } ) ;
1932- responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids : vec ! [ node_id] } ) ;
1959+ responses. add ( NodeGraphMessage :: SetVisibility {
1960+ node_id,
1961+ network_path : network_path. clone ( ) ,
1962+ visible,
1963+ } ) ;
1964+ responses. add ( NodeGraphMessage :: SetLockedOrVisibilitySideEffects {
1965+ node_ids : vec ! [ node_id] ,
1966+ network_path,
1967+ } ) ;
19331968 }
19341969 NodeGraphMessage :: SetPinned { node_id, pinned } => {
19351970 network_interface. set_pinned ( & node_id, selection_network_path, pinned) ;
19361971 }
1937- NodeGraphMessage :: SetVisibility { node_id, visible } => {
1938- network_interface. set_visibility ( & node_id, selection_network_path , visible) ;
1972+ NodeGraphMessage :: SetVisibility { node_id, network_path , visible } => {
1973+ network_interface. set_visibility ( & node_id, & network_path , visible) ;
19391974 }
1940- NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids } => {
1941- if node_ids. iter ( ) . any ( |node_id| network_interface. connected_to_output ( node_id, selection_network_path ) ) {
1975+ NodeGraphMessage :: SetLockedOrVisibilitySideEffects { node_ids, network_path } => {
1976+ if node_ids. iter ( ) . any ( |node_id| network_interface. connected_to_output ( node_id, & network_path ) ) {
19421977 responses. add ( NodeGraphMessage :: RunDocumentGraph ) ;
19431978 }
19441979 responses. add ( NodeGraphMessage :: UpdateActionButtons ) ;
19451980 responses. add ( NodeGraphMessage :: SendGraph ) ;
19461981
19471982 responses. add ( PropertiesPanelMessage :: Refresh ) ;
1983+ responses. add ( DataPanelMessage :: Refresh ) ;
19481984 }
19491985 NodeGraphMessage :: UpdateBoxSelection => {
19501986 if let Some ( ( box_selection_start, _) ) = self . box_selection_start {
@@ -2397,6 +2433,7 @@ impl NodeGraphMessageHandler {
23972433 let mut properties = Vec :: new ( ) ;
23982434
23992435 if let [ node_id] = * nodes. as_slice ( ) {
2436+ let network_path = context. selection_network_path . to_vec ( ) ;
24002437 properties. push ( LayoutGroup :: row ( vec ! [
24012438 Separator :: new( SeparatorStyle :: Related ) . widget_instance( ) ,
24022439 IconLabel :: new( "Node" ) . tooltip_description( "Name of the selected node." ) . widget_instance( ) ,
@@ -2406,6 +2443,7 @@ impl NodeGraphMessageHandler {
24062443 . on_update( move |text_input| {
24072444 NodeGraphMessage :: SetDisplayName {
24082445 node_id,
2446+ network_path: network_path. clone( ) ,
24092447 alias: text_input. value. clone( ) ,
24102448 skip_adding_history_step: false ,
24112449 }
@@ -2468,6 +2506,7 @@ impl NodeGraphMessageHandler {
24682506 return Vec :: new ( ) ;
24692507 }
24702508
2509+ let layer_network_path = context. selection_network_path . to_vec ( ) ;
24712510 let mut layer_properties = vec ! [ LayoutGroup :: row( vec![
24722511 Separator :: new( SeparatorStyle :: Related ) . widget_instance( ) ,
24732512 IconLabel :: new( "Layer" ) . tooltip_description( "Name of the selected layer." ) . widget_instance( ) ,
@@ -2477,6 +2516,7 @@ impl NodeGraphMessageHandler {
24772516 . on_update( move |text_input| {
24782517 NodeGraphMessage :: SetDisplayName {
24792518 node_id: layer,
2519+ network_path: layer_network_path. clone( ) ,
24802520 alias: text_input. value. clone( ) ,
24812521 skip_adding_history_step: false ,
24822522 }
0 commit comments