@@ -9,11 +9,9 @@ use glam::{DVec2, IVec2};
99use graph_craft:: document:: DocumentNode ;
1010use graph_craft:: document:: { DocumentNodeImplementation , NodeInput , value:: TaggedValue } ;
1111use graphene_std:: ProtoNodeIdentifier ;
12- use graphene_std:: subpath:: Subpath ;
1312use graphene_std:: text:: { TextAlign , TypesettingConfig } ;
1413use graphene_std:: transform:: ScaleType ;
1514use graphene_std:: uuid:: NodeId ;
16- use graphene_std:: vector:: Vector ;
1715use graphene_std:: vector:: style:: { PaintOrder , StrokeAlign } ;
1816use std:: collections:: HashMap ;
1917use std:: f64:: consts:: PI ;
@@ -1113,80 +1111,6 @@ fn migrate_node(node_id: &NodeId, node: &DocumentNode, network_path: &[NodeId],
11131111 document. network_interface . set_input ( & InputConnector :: node ( * node_id, 9 ) , old_inputs[ 4 ] . clone ( ) , network_path) ;
11141112 }
11151113
1116- // Upgrade the old "Spline" node to the new "Spline" node
1117- if reference == DefinitionIdentifier :: ProtoNode ( graphene_std:: vector:: spline:: IDENTIFIER )
1118- || reference == DefinitionIdentifier :: ProtoNode ( ProtoNodeIdentifier :: new ( "graphene_core::vector::generator_nodes::SplineNode" ) )
1119- || reference == DefinitionIdentifier :: ProtoNode ( ProtoNodeIdentifier :: new ( "graphene_core::vector::SplineNode" ) )
1120- || reference == DefinitionIdentifier :: ProtoNode ( ProtoNodeIdentifier :: new ( "graphene_core::vector::SplinesFromPointsNode" ) )
1121- {
1122- // Retrieve the proto node identifier and verify it is the old "Spline" node, otherwise skip it if this is the new "Spline" node
1123- let identifier = document
1124- . network_interface
1125- . implementation ( node_id, network_path)
1126- . and_then ( |implementation| implementation. get_proto_node ( ) ) ;
1127- if identifier. map ( |identifier| identifier. as_str ( ) ) != Some ( "graphene_core::vector::generator_nodes::SplineNode" ) {
1128- return None ;
1129- }
1130-
1131- // Obtain the document node for the given node ID, extract the vector points, and create a Vector path from the list of points
1132- let node = document. network_interface . document_node ( node_id, network_path) ?;
1133- let Some ( TaggedValue :: VecDVec2 ( points) ) = node. inputs . get ( 1 ) . and_then ( |tagged_value| tagged_value. as_value ( ) ) else {
1134- log:: error!( "The old Spline node's input at index 1 is not a TaggedValue::VecDVec2" ) ;
1135- return None ;
1136- } ;
1137- let vector = Vector :: from_subpath ( Subpath :: from_anchors ( points. to_vec ( ) , false ) ) ;
1138-
1139- // Retrieve the output connectors linked to the "Spline" node's output connector
1140- let Some ( spline_outputs) = document. network_interface . outward_wires ( network_path) ?. get ( & OutputConnector :: node ( * node_id, 0 ) ) . cloned ( ) else {
1141- log:: error!( "Vec of InputConnector Spline node is connected to its output connector 0." ) ;
1142- return None ;
1143- } ;
1144-
1145- // Get the node's current position in the graph
1146- let Some ( node_position) = document. network_interface . position ( node_id, network_path) else {
1147- log:: error!( "Could not get position of spline node." ) ;
1148- return None ;
1149- } ;
1150-
1151- // Get the "Path" node definition and fill it in with the Vector path and default vector modification
1152- let Some ( path_node_type) = resolve_network_node_type ( "Path" ) else {
1153- log:: error!( "Path node does not exist." ) ;
1154- return None ;
1155- } ;
1156- let modification = Box :: new ( graphene_std:: vector:: VectorModification :: create_from_vector ( & vector) ) ;
1157- let path_node = path_node_type. node_template_input_override ( [ None , Some ( NodeInput :: value ( TaggedValue :: VectorModification ( modification) , false ) ) ] ) ;
1158-
1159- // Get the "Spline" node definition and wire it up with the "Path" node as input
1160- let Some ( spline_node_type) = resolve_proto_node_type ( graphene_std:: vector:: spline:: IDENTIFIER ) else {
1161- log:: error!( "Spline node does not exist." ) ;
1162- return None ;
1163- } ;
1164- let spline_node = spline_node_type. node_template_input_override ( [ Some ( NodeInput :: node ( NodeId ( 1 ) , 0 ) ) ] ) ;
1165-
1166- // Create a new node group with the "Path" and "Spline" nodes and generate new node IDs for them
1167- let nodes = vec ! [ ( NodeId ( 1 ) , path_node) , ( NodeId ( 0 ) , spline_node) ] ;
1168- let new_ids = nodes. iter ( ) . map ( |( id, _) | ( * id, NodeId :: new ( ) ) ) . collect :: < HashMap < _ , _ > > ( ) ;
1169- let new_spline_id = * new_ids. get ( & NodeId ( 0 ) ) ?;
1170- let new_path_id = * new_ids. get ( & NodeId ( 1 ) ) ?;
1171-
1172- // Remove the old "Spline" node from the document
1173- document. network_interface . delete_nodes ( vec ! [ * node_id] , false , network_path) ;
1174-
1175- // Insert the new "Path" and "Spline" nodes into the network interface with generated IDs
1176- document. network_interface . insert_node_group ( nodes. clone ( ) , new_ids, network_path) ;
1177-
1178- // Reposition the new "Spline" node to match the original "Spline" node's position
1179- document. network_interface . shift_node ( & new_spline_id, node_position, network_path) ;
1180-
1181- // Reposition the new "Path" node with an offset relative to the original "Spline" node's position
1182- document. network_interface . shift_node ( & new_path_id, node_position + IVec2 :: new ( -7 , 0 ) , network_path) ;
1183-
1184- // Redirect each output connection from the old node to the new "Spline" node's output connector
1185- for input_connector in spline_outputs {
1186- document. network_interface . set_input ( & input_connector, NodeInput :: node ( new_spline_id, 0 ) , network_path) ;
1187- }
1188- }
1189-
11901114 // Upgrade Text node to include line height and character spacing, which were previously hardcoded to 1, from https://github.com/GraphiteEditor/Graphite/pull/2016
11911115 if reference == DefinitionIdentifier :: ProtoNode ( graphene_std:: text:: text:: IDENTIFIER ) && inputs_count == 8 {
11921116 let mut template: NodeTemplate = resolve_document_node_type ( & reference) ?. default_node_template ( ) ;
0 commit comments