@@ -73,23 +73,6 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
7373 self . cef_context . work ( ) ;
7474
7575 let ( _has_run, texture) = futures:: executor:: block_on ( graphite_editor:: node_graph_executor:: run_node_graph ( ) ) ;
76- if _has_run {
77- let mut responses = VecDeque :: new ( ) ;
78- let err = self . editor . poll_node_graph_evaluation ( & mut responses) ;
79- if let Err ( e) = err {
80- tracing:: error!( "Error poling node graph: {}" , e) ;
81- }
82- let frontend_messages = responses
83- . into_iter ( )
84- . flat_map ( |response| if let Message :: Frontend ( frontend) = response { Some ( frontend) } else { None } )
85- . collect ( ) ;
86- self . send_messages_to_editor ( frontend_messages) ;
87- }
88- if let Some ( texture) = texture
89- && let Some ( graphics_state) = & mut self . graphics_state
90- {
91- graphics_state. bind_viewport_texture ( texture. texture . as_ref ( ) ) ;
92- }
9376
9477 event_loop. set_control_flow ( ControlFlow :: WaitUntil ( wait_until) ) ;
9578 }
@@ -225,6 +208,24 @@ impl ApplicationHandler<CustomEvent> for WinitApp {
225208 }
226209 self . dispatch_message ( message) ;
227210 }
211+ CustomEvent :: NodeGraphRan { texture } => {
212+ if let Some ( texture) = texture
213+ && let Some ( graphics_state) = & mut self . graphics_state
214+ {
215+ graphics_state. bind_viewport_texture ( texture. texture . as_ref ( ) ) ;
216+ }
217+ let mut responses = VecDeque :: new ( ) ;
218+ let err = self . editor . poll_node_graph_evaluation ( & mut responses) ;
219+ if let Err ( e) = err {
220+ if e != "No active document" {
221+ tracing:: error!( "Error poling node graph: {}" , e) ;
222+ }
223+ }
224+
225+ for message in responses {
226+ self . dispatch_message ( message) ;
227+ }
228+ }
228229 }
229230 }
230231
0 commit comments