11use crate :: consts:: FILE_SAVE_SUFFIX ;
22use crate :: messages:: frontend:: utility_types:: { ExportBounds , FileType } ;
33use crate :: messages:: portfolio:: document:: node_graph:: document_node_definitions:: wrap_network_in_scope;
4- use crate :: messages:: portfolio:: document:: utility_types:: document_metadata:: LayerNodeIdentifier ;
54use crate :: messages:: prelude:: * ;
65
76use graph_craft:: concrete;
@@ -12,23 +11,19 @@ use graph_craft::proto::GraphErrors;
1211use graph_craft:: wasm_application_io:: EditorPreferences ;
1312use graphene_core:: application_io:: { NodeGraphUpdateMessage , NodeGraphUpdateSender , RenderConfig } ;
1413use graphene_core:: memo:: IORecord ;
15- use graphene_core:: raster:: ImageFrame ;
16- use graphene_core:: renderer:: { ClickTarget , GraphicElementRendered , ImageRenderMode , RenderParams , SvgRender } ;
14+ use graphene_core:: renderer:: { GraphicElementRendered , ImageRenderMode , RenderParams , SvgRender } ;
1715use graphene_core:: renderer:: { RenderSvgSegmentList , SvgSegment } ;
1816use graphene_core:: text:: FontCache ;
19- use graphene_core:: transform:: { Footprint , Transform } ;
17+ use graphene_core:: transform:: Footprint ;
2018use graphene_core:: vector:: style:: ViewMode ;
21- use graphene_core:: vector:: VectorData ;
22- use graphene_core:: { Color , GraphicElement , SurfaceFrame } ;
19+ use graphene_core:: SurfaceFrame ;
2320use graphene_std:: renderer:: format_transform_matrix;
2421use graphene_std:: wasm_application_io:: { WasmApplicationIo , WasmEditorApi } ;
2522use interpreted_executor:: dynamic_executor:: { DynamicExecutor , IntrospectError , ResolvedDocumentNodeTypesDelta } ;
2623
27- use core:: hash;
2824use glam:: { DAffine2 , DVec2 , UVec2 } ;
2925use once_cell:: sync:: Lazy ;
3026use spin:: Mutex ;
31- use std:: hash:: Hash ;
3227use std:: sync:: mpsc:: { Receiver , Sender } ;
3328use std:: sync:: Arc ;
3429
@@ -50,10 +45,6 @@ pub struct NodeRuntime {
5045 // TODO: Remove, it doesn't need to be persisted anymore
5146 /// The current renders of the thumbnails for layer nodes.
5247 thumbnail_renders : HashMap < NodeId , Vec < SvgSegment > > ,
53- /// The current click targets for layer nodes.
54- click_targets : HashMap < NodeId , Vec < ClickTarget > > ,
55- /// Vector data in Path nodes.
56- vector_modify : HashMap < NodeId , VectorData > ,
5748}
5849
5950/// Messages passed from the editor thread to the node runtime thread.
@@ -83,8 +74,6 @@ pub struct ExecutionResponse {
8374 execution_id : u64 ,
8475 result : Result < TaggedValue , String > ,
8576 responses : VecDeque < FrontendMessage > ,
86- new_click_targets : HashMap < LayerNodeIdentifier , Vec < ClickTarget > > ,
87- new_vector_modify : HashMap < NodeId , VectorData > ,
8877 transform : DAffine2 ,
8978}
9079
@@ -143,8 +132,6 @@ impl NodeRuntime {
143132 monitor_nodes : Vec :: new ( ) ,
144133
145134 thumbnail_renders : Default :: default ( ) ,
146- click_targets : HashMap :: new ( ) ,
147- vector_modify : HashMap :: new ( ) ,
148135 }
149136 }
150137
@@ -224,8 +211,6 @@ impl NodeRuntime {
224211 execution_id,
225212 result,
226213 responses,
227- new_click_targets : self . click_targets . clone ( ) . into_iter ( ) . map ( |( id, targets) | ( LayerNodeIdentifier :: new_unchecked ( id) , targets) ) . collect ( ) ,
228- new_vector_modify : self . vector_modify . clone ( ) ,
229214 transform,
230215 } ) ;
231216 }
@@ -297,37 +282,17 @@ impl NodeRuntime {
297282 } ;
298283
299284 if let Some ( io) = introspected_data. downcast_ref :: < IORecord < Footprint , graphene_core:: GraphicElement > > ( ) {
300- Self :: process_graphic_element ( & mut self . thumbnail_renders , & mut self . click_targets , parent_network_node_id, & io. output , responses, update_thumbnails)
285+ Self :: process_graphic_element ( & mut self . thumbnail_renders , parent_network_node_id, & io. output , responses, update_thumbnails)
301286 } else if let Some ( io) = introspected_data. downcast_ref :: < IORecord < Footprint , graphene_core:: Artboard > > ( ) {
302- Self :: process_graphic_element ( & mut self . thumbnail_renders , & mut self . click_targets , parent_network_node_id, & io. output , responses, update_thumbnails)
303- } else if let Some ( record) = introspected_data. downcast_ref :: < IORecord < Footprint , VectorData > > ( ) {
304- // Insert the vector modify if we are dealing with vector data
305- self . vector_modify . insert ( parent_network_node_id, record. output . clone ( ) ) ;
287+ Self :: process_graphic_element ( & mut self . thumbnail_renders , parent_network_node_id, & io. output , responses, update_thumbnails)
306288 }
307-
308- // If this is `VectorData`, `ImageFrame`, or `GraphicElement` data:
309- // Update the stored upstream transforms for this layer/node.
310- // if let Some(transform) = {
311- // fn try_downcast<T: Transform + 'static>(value: &dyn std::any::Any) -> Option<(Footprint, DAffine2)> {
312- // let io_data = value.downcast_ref::<IORecord<Footprint, T>>()?;
313- // let transform = io_data.output.transform();
314- // Some((io_data.input, transform))
315- // }
316- // None.or_else(|| try_downcast::<VectorData>(introspected_data.as_ref()))
317- // .or_else(|| try_downcast::<ImageFrame<Color>>(introspected_data.as_ref()))
318- // .or_else(|| try_downcast::<GraphicElement>(introspected_data.as_ref()))
319- // .or_else(|| try_downcast::<graphene_core::Artboard>(introspected_data.as_ref()))
320- // } {
321- // self.upstream_transforms.insert(parent_network_node_id, transform);
322- // }
323289 }
324290 }
325291
326292 // If this is `GraphicElement` data:
327293 // Regenerate click targets and thumbnails for the layers in the graph, modifying the state and updating the UI.
328294 fn process_graphic_element (
329295 thumbnail_renders : & mut HashMap < NodeId , Vec < SvgSegment > > ,
330- click_targets : & mut HashMap < NodeId , Vec < ClickTarget > > ,
331296 parent_network_node_id : NodeId ,
332297 graphic_element : & impl GraphicElementRendered ,
333298 responses : & mut VecDeque < FrontendMessage > ,
@@ -569,9 +534,7 @@ impl NodeGraphExecutor {
569534 let ExecutionResponse {
570535 execution_id,
571536 result,
572- new_click_targets,
573537 responses : existing_responses,
574- new_vector_modify,
575538 transform,
576539 } = execution_response;
577540
0 commit comments