@@ -8,18 +8,16 @@ use graph_craft::application_io::{PlatformApplicationIo, PlatformEditorApi};
88use graph_craft:: document:: value:: { RenderOutput , RenderOutputType , TaggedValue } ;
99use graph_craft:: document:: { NodeId , NodeNetwork } ;
1010use graph_craft:: graphene_compiler:: { CompileError , CompiledNetwork , Compiler } ;
11- use graph_craft:: proto:: { ConstructionArgs , GraphErrors } ;
11+ use graph_craft:: proto:: GraphErrors ;
1212use graphene_hash:: CacheHash ;
1313use graphene_std:: application_io:: { ApplicationIo , ExportFormat , Texture } ;
14- use graphene_std:: list:: { Item , List } ;
1514use graphene_std:: ops:: ConvertAsync ;
1615#[ cfg( all( target_family = "wasm" , feature = "gpu" , feature = "wasm" ) ) ]
1716use graphene_std:: platform_application_io:: canvas_utils:: { Canvas , CanvasSurface , CanvasSurfaceHandle } ;
1817use graphene_std:: raster_types:: Raster ;
1918use graphene_std:: runtime:: AsyncRuntime ;
2019use graphene_std:: vector:: style:: RenderMode ;
21- use graphene_std:: vector:: { Vector , VectorGeometry , path, paths_from_list_row_attributes} ;
22- use graphene_std:: { Context , NodeError , NodeParameter , Poll } ;
20+ use graphene_std:: { Context , NodeError , Poll } ;
2321use interpreted_executor:: dynamic_executor:: { DynamicExecutor , ResolvedDocumentNodeTypesDelta } ;
2422use interpreted_executor:: util:: wrap_network_in_scope;
2523use observer:: Observer ;
@@ -56,18 +54,13 @@ pub struct NodeRuntime {
5654 resources : ResourceRegistry ,
5755 node_graph_errors : GraphErrors ,
5856 node_graph_warnings : GraphErrors ,
59- /// Each Path node with the proto node feeding its content, which gives the geometry the node's edits apply to.
60- path_nodes : Vec < ( NodeId , NodeId ) > ,
6157 thumbnails : Thumbnails ,
6258 observer : Observer < ObservationKey > ,
6359 /// Whether an observation changed since its results were last sent.
6460 observations_changed : bool ,
6561
6662 preprocessor : preprocessor:: Preprocessor ,
6763
68- vector_modify : HashMap < NodeId , VectorGeometry > ,
69- vector_evaluations : HashMap < NodeId , ( NodeId , u64 ) > ,
70-
7164 /// Cached surface for Wasm viewport rendering (reused across frames)
7265 #[ cfg( all( target_family = "wasm" , feature = "gpu" , feature = "wasm" ) ) ]
7366 wasm_canvas_cache : CanvasSurfaceHandle ,
@@ -155,15 +148,12 @@ impl NodeRuntime {
155148
156149 node_graph_errors : Vec :: new ( ) ,
157150 node_graph_warnings : Vec :: new ( ) ,
158- path_nodes : Vec :: new ( ) ,
159151 thumbnails : Thumbnails :: new ( ) ,
160152 observer : Observer :: default ( ) ,
161153 observations_changed : false ,
162154
163155 preprocessor : preprocessor:: Preprocessor :: new ( ) ,
164156
165- vector_modify : Default :: default ( ) ,
166- vector_evaluations : Default :: default ( ) ,
167157 #[ cfg( all( target_family = "wasm" , feature = "gpu" ) ) ]
168158 wasm_canvas_cache : CanvasSurfaceHandle :: new ( ) ,
169159 #[ cfg( all( target_family = "wasm" , feature = "gpu" ) ) ]
@@ -376,7 +366,6 @@ impl NodeRuntime {
376366 result : ExecutionResult :: Panic ( payload) ,
377367 responses : VecDeque :: new ( ) ,
378368 dropped_thumbnails : Vec :: new ( ) ,
379- vector_modify : HashMap :: new ( ) ,
380369 observations : HashMap :: new ( ) ,
381370 } ;
382371 self . sender . send ( NodeGraphUpdate :: ExecutionResponse ( Box :: new ( response) ) ) . expect ( "Failed to send response" ) ;
@@ -388,15 +377,14 @@ impl NodeRuntime {
388377
389378 async fn respond ( & mut self , execution_id : u64 , result : ExecutionResult ) {
390379 let mut responses = VecDeque :: new ( ) ;
391- let dropped_thumbnails = self . process_path_nodes_and_thumbnails ( & mut responses) . await ;
380+ let dropped_thumbnails = self . update_thumbnails ( & mut responses) . await ;
392381 let observations = self . observer . evaluate ( & self . executor , self . old_graph . as_ref ( ) ) ;
393382
394383 let response = ExecutionResponse {
395384 execution_id,
396385 result,
397386 responses,
398387 dropped_thumbnails,
399- vector_modify : self . vector_modify . clone ( ) ,
400388 observations,
401389 } ;
402390 self . sender . send ( NodeGraphUpdate :: ExecutionResponse ( Box :: new ( response) ) ) . expect ( "Failed to send response" ) ;
@@ -429,17 +417,6 @@ impl NodeRuntime {
429417 Err ( CompileError :: Message ( message) ) => return Err ( ( ResolvedDocumentNodeTypesDelta :: default ( ) , message) ) ,
430418 } ;
431419 self . node_graph_warnings = warnings;
432- self . path_nodes = proto_network
433- . nodes
434- . iter ( )
435- . filter ( |( _, node) | node. identifier == path:: IDENTIFIER )
436- . filter_map ( |( _, node) | {
437- let path_node = * node. original_location . path . as_ref ( ) ?. last ( ) ?;
438- let ConstructionArgs :: Nodes ( inputs) = & node. construction_args else { return None } ;
439-
440- Some ( ( path_node, * inputs. get ( path:: ContentInput :: INDEX ) ?) )
441- } )
442- . collect ( ) ;
443420
444421 assert_ne ! ( proto_network. nodes. len( ) , 0 , "No proto nodes exist?" ) ;
445422 let result = self . executor . update ( proto_network) . map_err ( |( types, e) | {
@@ -470,32 +447,9 @@ impl NodeRuntime {
470447 EvaluationErrors ( errors. into ( ) )
471448 }
472449
473- /// Updates state data , giving back the layers whose thumbnails were dropped because they no longer have content to show.
474- async fn process_path_nodes_and_thumbnails ( & mut self , responses : & mut VecDeque < FrontendMessage > ) -> Vec < NodeId > {
450+ /// Renders the stale thumbnails , giving back the layers whose thumbnails were dropped because they no longer have content to show.
451+ async fn update_thumbnails ( & mut self , responses : & mut VecDeque < FrontendMessage > ) -> Vec < NodeId > {
475452 let dropped_thumbnails = self . thumbnails . drop_sourceless ( ) ;
476-
477- for & ( path_node, content_node) in & self . path_nodes {
478- let tree = self . executor . tree ( ) ;
479- let Ok ( Some ( context) ) = tree. last_context ( content_node) else { continue } ;
480- let context_hash = context_hash ( & context) ;
481- if self . vector_evaluations . get ( & path_node) == Some ( & ( content_node, context_hash) ) {
482- continue ;
483- }
484-
485- let Some ( output) = tree. evaluate ( content_node, & context) . ok ( ) . and_then ( evaluated_output) else {
486- continue ;
487- } ;
488- let geometry = if let Some ( list) = output. downcast_ref :: < List < Vector > > ( ) {
489- VectorGeometry :: new ( list. element ( 0 ) . cloned ( ) . unwrap_or_default ( ) , paths_from_list_row_attributes ( list, 0 ) . cloned ( ) . unwrap_or_default ( ) )
490- } else if let Some ( item) = output. downcast_ref :: < Item < Vector > > ( ) {
491- VectorGeometry :: from_item ( item)
492- } else {
493- continue ;
494- } ;
495- self . vector_modify . insert ( path_node, geometry) ;
496- self . vector_evaluations . insert ( path_node, ( content_node, context_hash) ) ;
497- }
498-
499453 self . thumbnails . render_stale ( & self . executor , & self . editor_api , responses) . await ;
500454
501455 dropped_thumbnails
0 commit comments