From c80de41d2854f13cbcf74693734a16e94ed0199e Mon Sep 17 00:00:00 2001 From: 0HyperCube <78500760+0HyperCube@users.noreply.github.com> Date: Sun, 26 May 2024 05:35:53 +0100 Subject: [PATCH] Always update source node in borrow tree (#1758) --- .../interpreted-executor/src/dynamic_executor.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/node-graph/interpreted-executor/src/dynamic_executor.rs b/node-graph/interpreted-executor/src/dynamic_executor.rs index b34baa804..11ac7691f 100644 --- a/node-graph/interpreted-executor/src/dynamic_executor.rs +++ b/node-graph/interpreted-executor/src/dynamic_executor.rs @@ -134,6 +134,8 @@ impl BorrowTree { for (id, node) in proto_network.nodes { if !self.nodes.contains_key(&id) { self.push_node(id, node, typing_context).await?; + } else { + self.update_source_map(id, &node); } old_nodes.remove(&id); } @@ -181,8 +183,7 @@ impl BorrowTree { self.nodes.remove(&id); } - /// Insert a new node into the borrow tree, calling the constructor function from `node_registry.rs`. - pub async fn push_node(&mut self, id: NodeId, proto_node: ProtoNode, typing_context: &TypingContext) -> Result<(), GraphErrors> { + pub fn update_source_map(&mut self, id: NodeId, proto_node: &ProtoNode) { self.source_map.insert(proto_node.original_location.path.clone().unwrap_or_default(), id); let params = match &proto_node.construction_args { @@ -195,6 +196,11 @@ impl BorrowTree { for x in proto_node.original_location.outputs_source.values() { assert_eq!(*x, 0, "Proto nodes should refer to output index 0"); } + } + + /// Insert a new node into the borrow tree, calling the constructor function from `node_registry.rs`. + pub async fn push_node(&mut self, id: NodeId, proto_node: ProtoNode, typing_context: &TypingContext) -> Result<(), GraphErrors> { + self.update_source_map(id, &proto_node); match &proto_node.construction_args { ConstructionArgs::Value(value) => {