Tidy up NodeNetworkInterface, replacing &[] root network arguments with methods for the document network (#2393)

* Replace `.selected_nodes(&[])` with `.selected_nodes_in_nested_network()` and `.selected_nodes()`

* Replace `.network(&[])` with `.document_network()` and `.nested_network()`

* Replace `.network_metadata(&[])` with `.document_network_metadata()`
This commit is contained in:
Keavon Chambers
2025-03-07 01:33:24 -08:00
committed by GitHub
parent 22a900b35e
commit c4cf47703a
28 changed files with 224 additions and 247 deletions

View File

@@ -460,7 +460,7 @@ impl NodeGraphExecutor {
pub(crate) fn update_node_graph_instrumented(&mut self, document: &mut DocumentMessageHandler) -> Result<Instrumented, String> {
// We should always invalidate the cache.
self.node_graph_hash = generate_uuid();
let mut network = document.network_interface.network(&[]).unwrap().clone();
let mut network = document.network_interface.document_network().clone();
let instrumented = Instrumented::new(&mut network);
self.sender.send(NodeRuntimeMessage::GraphUpdate(network)).map_err(|e| e.to_string())?;
@@ -469,11 +469,11 @@ impl NodeGraphExecutor {
/// Update the cached network if necessary.
fn update_node_graph(&mut self, document: &mut DocumentMessageHandler, ignore_hash: bool) -> Result<(), String> {
let network_hash = document.network_interface.network(&[]).unwrap().current_hash();
let network_hash = document.network_interface.document_network().current_hash();
if network_hash != self.node_graph_hash || ignore_hash {
self.node_graph_hash = network_hash;
self.sender
.send(NodeRuntimeMessage::GraphUpdate(document.network_interface.network(&[]).unwrap().clone()))
.send(NodeRuntimeMessage::GraphUpdate(document.network_interface.document_network().clone()))
.map_err(|e| e.to_string())?;
}
Ok(())
@@ -513,7 +513,7 @@ impl NodeGraphExecutor {
/// Evaluates a node graph for export
pub fn submit_document_export(&mut self, document: &mut DocumentMessageHandler, mut export_config: ExportConfig) -> Result<(), String> {
let network = document.network_interface.network(&[]).unwrap().clone();
let network = document.network_interface.document_network().clone();
// Calculate the bounding box of the region to be exported
let bounds = match export_config.bounds {