@@ -63,6 +63,7 @@ pub struct NodeGraphExecutor {
6363#[ derive( Debug , Clone ) ]
6464struct ExecutionContext {
6565 export_config : Option < ExportConfig > ,
66+ document_id : DocumentId ,
6667}
6768
6869impl NodeGraphExecutor {
@@ -133,7 +134,13 @@ impl NodeGraphExecutor {
133134 }
134135
135136 /// Adds an evaluate request for whatever current network is cached.
136- pub ( crate ) fn submit_current_node_graph_evaluation ( & mut self , document : & mut DocumentMessageHandler , viewport_resolution : UVec2 , time : TimingInformation ) -> Result < Message , String > {
137+ pub ( crate ) fn submit_current_node_graph_evaluation (
138+ & mut self ,
139+ document : & mut DocumentMessageHandler ,
140+ document_id : DocumentId ,
141+ viewport_resolution : UVec2 ,
142+ time : TimingInformation ,
143+ ) -> Result < Message , String > {
137144 let render_config = RenderConfig {
138145 viewport : Footprint {
139146 transform : document. metadata ( ) . document_to_viewport ,
@@ -153,7 +160,7 @@ impl NodeGraphExecutor {
153160 // Execute the node graph
154161 let execution_id = self . queue_execution ( render_config) ;
155162
156- self . futures . insert ( execution_id, ExecutionContext { export_config : None } ) ;
163+ self . futures . insert ( execution_id, ExecutionContext { export_config : None , document_id } ) ;
157164
158165 Ok ( DeferMessage :: SetGraphSubmissionIndex ( execution_id) . into ( ) )
159166 }
@@ -162,17 +169,18 @@ impl NodeGraphExecutor {
162169 pub fn submit_node_graph_evaluation (
163170 & mut self ,
164171 document : & mut DocumentMessageHandler ,
172+ document_id : DocumentId ,
165173 viewport_resolution : UVec2 ,
166174 time : TimingInformation ,
167175 inspect_node : Option < NodeId > ,
168176 ignore_hash : bool ,
169177 ) -> Result < Message , String > {
170178 self . update_node_graph ( document, inspect_node, ignore_hash) ?;
171- self . submit_current_node_graph_evaluation ( document, viewport_resolution, time)
179+ self . submit_current_node_graph_evaluation ( document, document_id , viewport_resolution, time)
172180 }
173181
174182 /// Evaluates a node graph for export
175- pub fn submit_document_export ( & mut self , document : & mut DocumentMessageHandler , mut export_config : ExportConfig ) -> Result < ( ) , String > {
183+ pub fn submit_document_export ( & mut self , document : & mut DocumentMessageHandler , document_id : DocumentId , mut export_config : ExportConfig ) -> Result < ( ) , String > {
176184 let network = document. network_interface . document_network ( ) . clone ( ) ;
177185
178186 // Calculate the bounding box of the region to be exported
@@ -204,7 +212,10 @@ impl NodeGraphExecutor {
204212 . send ( GraphRuntimeRequest :: GraphUpdate ( GraphUpdate { network, inspect_node : None } ) )
205213 . map_err ( |e| e. to_string ( ) ) ?;
206214 let execution_id = self . queue_execution ( render_config) ;
207- let execution_context = ExecutionContext { export_config : Some ( export_config) } ;
215+ let execution_context = ExecutionContext {
216+ export_config : Some ( export_config) ,
217+ document_id,
218+ } ;
208219 self . futures . insert ( execution_id, execution_context) ;
209220
210221 Ok ( ( ) )
@@ -279,7 +290,7 @@ impl NodeGraphExecutor {
279290 } else {
280291 self . process_node_graph_output ( node_graph_output, transform, responses) ?
281292 }
282- responses. add ( DeferMessage :: TriggerGraphRun ( execution_id) ) ;
293+ responses. add_front ( DeferMessage :: TriggerGraphRun ( execution_id, execution_context . document_id ) ) ;
283294
284295 // Update the spreadsheet on the frontend using the value of the inspect result.
285296 if self . old_inspect_node . is_some ( ) {
0 commit comments