@@ -92,10 +92,6 @@ pub struct NodeGraphMessageHandler {
9292 reordering_export : Option < usize > ,
9393 /// The end index of the moved connector
9494 end_index : Option < usize > ,
95- /// Used to keep track of what nodes are sent to the front end so that only visible ones are sent to the frontend
96- frontend_nodes : Vec < NodeId > ,
97- /// Disables rendering nodes in Svelte
98- should_render_svelte_nodes : bool ,
9995}
10096
10197/// NodeGraphMessageHandler always modifies the network which the selected nodes are in. No GraphOperationMessages should be added here, since those messages will always affect the document network.
@@ -1592,61 +1588,16 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
15921588 click_targets : Some ( network_interface. collect_frontend_click_targets ( breadcrumb_network_path) ) ,
15931589 } ) ,
15941590 NodeGraphMessage :: EndSendClickTargets => responses. add ( FrontendMessage :: UpdateClickTargets { click_targets : None } ) ,
1595- NodeGraphMessage :: UpdateVisibleNodes => {
1596- let Some ( network_metadata) = network_interface. network_metadata ( breadcrumb_network_path) else {
1597- return ;
1598- } ;
1599-
1600- let viewport_bbox = ipp. document_bounds ( ) ;
1601- let document_bbox: [ DVec2 ; 2 ] = viewport_bbox. map ( |p| network_metadata. persistent_metadata . navigation_metadata . node_graph_to_viewport . inverse ( ) . transform_point2 ( p) ) ;
1602-
1603- let mut nodes = Vec :: new ( ) ;
1604- for node_id in & self . frontend_nodes {
1605- let Some ( node_bbox) = network_interface. node_bounding_box ( node_id, breadcrumb_network_path) else {
1606- log:: error!( "Could not get bbox for node: {node_id:?}" ) ;
1607- continue ;
1608- } ;
1609-
1610- if node_bbox[ 1 ] . x >= document_bbox[ 0 ] . x && node_bbox[ 0 ] . x <= document_bbox[ 1 ] . x && node_bbox[ 1 ] . y >= document_bbox[ 0 ] . y && node_bbox[ 0 ] . y <= document_bbox[ 1 ] . y {
1611- nodes. push ( * node_id) ;
1612- }
1613- for error in & self . node_graph_errors {
1614- if error. node_path . contains ( node_id) {
1615- nodes. push ( * node_id) ;
1616- }
1617- }
1618- }
1619-
1620- responses. add ( FrontendMessage :: UpdateVisibleNodes { nodes } ) ;
1621- }
16221591 NodeGraphMessage :: SendGraph => {
16231592 responses. add ( NodeGraphMessage :: UpdateLayerPanel ) ;
16241593 responses. add ( DocumentMessage :: DocumentStructureChanged ) ;
16251594 responses. add ( PropertiesPanelMessage :: Refresh ) ;
16261595 responses. add ( NodeGraphMessage :: UpdateActionButtons ) ;
16271596
1628- if !self . should_render_svelte_nodes {
1629- // Generate and render node graph overlay network
1630- } else {
1631- let nodes_to_render = network_interface. collect_nodes ( & self . node_graph_errors , preferences. graph_wire_style , breadcrumb_network_path) ;
1632- self . frontend_nodes = nodes_to_render. iter ( ) . map ( |node| node. metadata . node_id ) . collect ( ) ;
1633- let previewed_node = network_interface. previewed_node ( breadcrumb_network_path) ;
1634- }
1635- responses. add ( NodeGraphMessage :: UpdateVisibleNodes ) ;
1636-
1637- let layer_widths = network_interface. collect_layer_widths ( breadcrumb_network_path) ;
1638-
1597+ responses. add ( FrontendMessage :: RequestNativeNodeGraphRender ) ;
16391598 responses. add ( NodeGraphMessage :: UpdateImportsExports ) ;
1640- responses. add ( FrontendMessage :: UpdateLayerWidths { layer_widths } ) ;
16411599 self . update_node_graph_hints ( responses) ;
16421600 }
1643- NodeGraphMessage :: SetGridAlignedEdges => {
1644- if graph_view_overlay_open {
1645- network_interface. set_grid_aligned_edges ( DVec2 :: new ( ipp. viewport_bounds . bottom_right . x - ipp. viewport_bounds . top_left . x , 0. ) , breadcrumb_network_path) ;
1646- // Send the new edges to the frontend
1647- responses. add ( NodeGraphMessage :: UpdateImportsExports ) ;
1648- }
1649- }
16501601 NodeGraphMessage :: SetInputValue { node_id, input_index, value } => {
16511602 let input = NodeInput :: value ( value, false ) ;
16521603 responses. add ( NodeGraphMessage :: SetInput {
@@ -1782,14 +1733,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
17821733 NodeGraphMessage :: TogglePreviewImpl { node_id } => {
17831734 network_interface. toggle_preview ( node_id, selection_network_path) ;
17841735 }
1785- NodeGraphMessage :: ToggleNativeNodeGraphRender => {
1786- self . should_render_svelte_nodes = !self . should_render_svelte_nodes ;
1787- responses. add ( FrontendMessage :: UpdateShouldRenderSvelteNodes {
1788- should_render_svelte_nodes : self . should_render_svelte_nodes ,
1789- } ) ;
1790- responses. add ( NodeGraphMessage :: SendGraph ) ;
1791- responses. add ( MenuBarMessage :: SendLayout ) ;
1792- }
17931736 NodeGraphMessage :: ToggleSelectedLocked => {
17941737 let Some ( selected_nodes) = network_interface. selected_nodes_in_nested_network ( selection_network_path) else {
17951738 log:: error!( "Could not get selected nodes in NodeGraphMessage::ToggleSelectedLocked" ) ;
@@ -1959,7 +1902,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19591902 // Do not show the add import or add export button in the document network;
19601903 let add_import_export = !breadcrumb_network_path. is_empty ( ) ;
19611904
1962- responses. add ( NodeGraphMessage :: UpdateVisibleNodes ) ;
19631905 responses. add ( FrontendMessage :: UpdateImportsExports {
19641906 imports,
19651907 exports,
@@ -1972,9 +1914,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19721914 NodeGraphMessage :: UpdateLayerPanel => {
19731915 Self :: update_layer_panel ( network_interface, selection_network_path, collapsed, layers_panel_open, responses) ;
19741916 }
1975- NodeGraphMessage :: UpdateEdges => {
1976- // Update the import/export UI edges whenever the PTZ changes or the bounding box of all nodes changes
1977- }
19781917 NodeGraphMessage :: UpdateNewNodeGraph => {
19791918 let Some ( selected_nodes) = network_interface. selected_nodes_mut ( selection_network_path) else {
19801919 log:: error!( "Could not get selected nodes in NodeGraphMessage::UpdateNewNodeGraph" ) ;
@@ -2620,8 +2559,6 @@ impl Default for NodeGraphMessageHandler {
26202559 reordering_export : None ,
26212560 reordering_import : None ,
26222561 end_index : None ,
2623- frontend_nodes : Vec :: new ( ) ,
2624- should_render_svelte_nodes : false ,
26252562 }
26262563 }
26272564}
0 commit comments