@@ -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,73 +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 :: UnloadWires => {
1596- for input in network_interface. node_graph_input_connectors ( breadcrumb_network_path) {
1597- network_interface. unload_wire ( & input, breadcrumb_network_path) ;
1598- }
1599-
1600- responses. add ( FrontendMessage :: ClearAllNodeGraphWires ) ;
1601- }
1602- NodeGraphMessage :: SendWires => {
1603- let wires = self . collect_wires ( network_interface, preferences. graph_wire_style , breadcrumb_network_path) ;
1604- responses. add ( FrontendMessage :: UpdateNodeGraphWires { wires } ) ;
1605- }
1606- NodeGraphMessage :: UpdateVisibleNodes => {
1607- let Some ( network_metadata) = network_interface. network_metadata ( breadcrumb_network_path) else {
1608- return ;
1609- } ;
1610-
1611- let viewport_bbox = ipp. document_bounds ( ) ;
1612- let document_bbox: [ DVec2 ; 2 ] = viewport_bbox. map ( |p| network_metadata. persistent_metadata . navigation_metadata . node_graph_to_viewport . inverse ( ) . transform_point2 ( p) ) ;
1613-
1614- let mut nodes = Vec :: new ( ) ;
1615- for node_id in & self . frontend_nodes {
1616- let Some ( node_bbox) = network_interface. node_bounding_box ( node_id, breadcrumb_network_path) else {
1617- log:: error!( "Could not get bbox for node: {node_id:?}" ) ;
1618- continue ;
1619- } ;
1620-
1621- 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 {
1622- nodes. push ( * node_id) ;
1623- }
1624- for error in & self . node_graph_errors {
1625- if error. node_path . contains ( node_id) {
1626- nodes. push ( * node_id) ;
1627- }
1628- }
1629- }
1630-
1631- responses. add ( FrontendMessage :: UpdateVisibleNodes { nodes } ) ;
1632- }
16331591 NodeGraphMessage :: SendGraph => {
16341592 responses. add ( NodeGraphMessage :: UpdateLayerPanel ) ;
16351593 responses. add ( DocumentMessage :: DocumentStructureChanged ) ;
16361594 responses. add ( PropertiesPanelMessage :: Refresh ) ;
16371595 responses. add ( NodeGraphMessage :: UpdateActionButtons ) ;
16381596
1639- if !self . should_render_svelte_nodes {
1640- // Generate and render node graph overlay network
1641- } else {
1642- let nodes_to_render = network_interface. collect_nodes ( & self . node_graph_errors , preferences. graph_wire_style , breadcrumb_network_path) ;
1643- self . frontend_nodes = nodes_to_render. iter ( ) . map ( |node| node. metadata . node_id ) . collect ( ) ;
1644- let previewed_node = network_interface. previewed_node ( breadcrumb_network_path) ;
1645- }
1646- responses. add ( NodeGraphMessage :: UpdateVisibleNodes ) ;
1647-
1648- let layer_widths = network_interface. collect_layer_widths ( breadcrumb_network_path) ;
1649-
1597+ responses. add ( FrontendMessage :: RequestNativeNodeGraphRender ) ;
16501598 responses. add ( NodeGraphMessage :: UpdateImportsExports ) ;
1651- responses. add ( FrontendMessage :: UpdateLayerWidths { layer_widths } ) ;
1652- responses. add ( NodeGraphMessage :: SendWires ) ;
16531599 self . update_node_graph_hints ( responses) ;
16541600 }
1655- NodeGraphMessage :: SetGridAlignedEdges => {
1656- if graph_view_overlay_open {
1657- network_interface. set_grid_aligned_edges ( DVec2 :: new ( ipp. viewport_bounds . bottom_right . x - ipp. viewport_bounds . top_left . x , 0. ) , breadcrumb_network_path) ;
1658- // Send the new edges to the frontend
1659- responses. add ( NodeGraphMessage :: UpdateImportsExports ) ;
1660- }
1661- }
16621601 NodeGraphMessage :: SetInputValue { node_id, input_index, value } => {
16631602 let input = NodeInput :: value ( value, false ) ;
16641603 responses. add ( NodeGraphMessage :: SetInput {
@@ -1799,14 +1738,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
17991738 NodeGraphMessage :: TogglePreviewImpl { node_id } => {
18001739 network_interface. toggle_preview ( node_id, selection_network_path) ;
18011740 }
1802- NodeGraphMessage :: ToggleNativeNodeGraphRender => {
1803- self . should_render_svelte_nodes = !self . should_render_svelte_nodes ;
1804- responses. add ( FrontendMessage :: UpdateShouldRenderSvelteNodes {
1805- should_render_svelte_nodes : self . should_render_svelte_nodes ,
1806- } ) ;
1807- responses. add ( NodeGraphMessage :: SendGraph ) ;
1808- responses. add ( MenuBarMessage :: SendLayout ) ;
1809- }
18101741 NodeGraphMessage :: ToggleSelectedLocked => {
18111742 let Some ( selected_nodes) = network_interface. selected_nodes_in_nested_network ( selection_network_path) else {
18121743 log:: error!( "Could not get selected nodes in NodeGraphMessage::ToggleSelectedLocked" ) ;
@@ -1976,8 +1907,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19761907 // Do not show the add import or add export button in the document network;
19771908 let add_import_export = !breadcrumb_network_path. is_empty ( ) ;
19781909
1979- responses. add ( NodeGraphMessage :: UpdateVisibleNodes ) ;
1980- responses. add ( NodeGraphMessage :: SendWires ) ;
19811910 responses. add ( FrontendMessage :: UpdateImportsExports {
19821911 imports,
19831912 exports,
@@ -1990,9 +1919,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19901919 NodeGraphMessage :: UpdateLayerPanel => {
19911920 Self :: update_layer_panel ( network_interface, selection_network_path, collapsed, layers_panel_open, responses) ;
19921921 }
1993- NodeGraphMessage :: UpdateEdges => {
1994- // Update the import/export UI edges whenever the PTZ changes or the bounding box of all nodes changes
1995- }
19961922 NodeGraphMessage :: UpdateNewNodeGraph => {
19971923 let Some ( selected_nodes) = network_interface. selected_nodes_mut ( selection_network_path) else {
19981924 log:: error!( "Could not get selected nodes in NodeGraphMessage::UpdateNewNodeGraph" ) ;
@@ -2673,8 +2599,6 @@ impl Default for NodeGraphMessageHandler {
26732599 reordering_export : None ,
26742600 reordering_import : None ,
26752601 end_index : None ,
2676- frontend_nodes : Vec :: new ( ) ,
2677- should_render_svelte_nodes : false ,
26782602 }
26792603 }
26802604}
0 commit comments