@@ -10,13 +10,13 @@ use crate::messages::portfolio::document::node_graph::utility_types::{ContextMen
1010use crate :: messages:: portfolio:: document:: utility_types:: document_metadata:: LayerNodeIdentifier ;
1111use crate :: messages:: portfolio:: document:: utility_types:: misc:: GroupFolderType ;
1212use crate :: messages:: portfolio:: document:: utility_types:: network_interface:: {
13- self , FlowType , InputConnector , NodeNetworkInterface , NodeTemplate , NodeTypePersistentMetadata , OutputConnector , Previewing , TypeSource ,
13+ self , FlowType , InputConnector , NodeNetworkInterface , NodeTemplate , NodeTypePersistentMetadata , OutputConnector , Previewing ,
1414} ;
1515use crate :: messages:: portfolio:: document:: utility_types:: nodes:: { CollapsedLayers , LayerPanelEntry } ;
1616use crate :: messages:: portfolio:: document:: utility_types:: wires:: { GraphWireStyle , WirePath , WirePathUpdate , build_vector_wire} ;
1717use crate :: messages:: prelude:: * ;
1818use crate :: messages:: tool:: common_functionality:: auto_panning:: AutoPanning ;
19- use crate :: messages:: tool:: common_functionality:: graph_modification_utils:: { self , get_clip_mode} ;
19+ use crate :: messages:: tool:: common_functionality:: graph_modification_utils:: get_clip_mode;
2020use crate :: messages:: tool:: common_functionality:: utility_functions:: make_path_editable_is_allowed;
2121use crate :: messages:: tool:: tool_messages:: tool_prelude:: { Key , MouseMotion } ;
2222use crate :: messages:: tool:: utility_types:: { HintData , HintGroup , HintInfo } ;
@@ -881,7 +881,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
881881 } ;
882882 let Some ( output_connector) = output_connector else { return } ;
883883 self . wire_in_progress_from_connector = network_interface. output_position ( & output_connector, selection_network_path) ;
884- self . wire_in_progress_type = FrontendGraphDataType :: from_type ( & network_interface. input_type ( clicked_input, breadcrumb_network_path) . 0 ) ;
884+ self . wire_in_progress_type = network_interface. input_type ( clicked_input, breadcrumb_network_path) . displayed_type ( ) ;
885885 return ;
886886 }
887887
@@ -891,8 +891,8 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
891891 self . initial_disconnecting = false ;
892892
893893 self . wire_in_progress_from_connector = network_interface. output_position ( & clicked_output, selection_network_path) ;
894- let ( output_type, source ) = & network_interface. output_type ( & clicked_output, breadcrumb_network_path) ;
895- self . wire_in_progress_type = FrontendGraphDataType :: displayed_type ( output_type , source ) ;
894+ let output_type = network_interface. output_type ( & clicked_output, breadcrumb_network_path) ;
895+ self . wire_in_progress_type = output_type . displayed_type ( ) ;
896896
897897 self . update_node_graph_hints ( responses) ;
898898 return ;
@@ -1210,21 +1210,17 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
12101210 }
12111211
12121212 // Get the output types from the network interface
1213- let ( output_type, type_source) = network_interface. output_type ( & output_connector, selection_network_path) ;
12141213 let Some ( network_metadata) = network_interface. network_metadata ( selection_network_path) else {
12151214 warn ! ( "No network_metadata" ) ;
12161215 return ;
12171216 } ;
12181217
1219- let compatible_type = match type_source {
1220- TypeSource :: RandomProtonodeImplementation | TypeSource :: Error ( _) => None ,
1221- _ => Some ( format ! ( "type:{}" , output_type. nested_type( ) ) ) ,
1222- } ;
1223-
12241218 let appear_right_of_mouse = if ipp. mouse . position . x > viewport. size ( ) . y ( ) - 173. { -173. } else { 0. } ;
12251219 let appear_above_mouse = if ipp. mouse . position . y > viewport. size ( ) . y ( ) - 34. { -34. } else { 0. } ;
12261220 let node_graph_shift = DVec2 :: new ( appear_right_of_mouse, appear_above_mouse) / network_metadata. persistent_metadata . navigation_metadata . node_graph_to_viewport . matrix2 . x_axis . x ;
12271221
1222+ let compatible_type = network_interface. output_type ( & output_connector, selection_network_path) . add_node_string ( ) ;
1223+
12281224 self . context_menu = Some ( ContextMenuInformation {
12291225 context_menu_coordinates : ( ( point. x + node_graph_shift. x ) as i32 , ( point. y + node_graph_shift. y ) as i32 ) ,
12301226 context_menu_data : ContextMenuData :: CreateNode { compatible_type } ,
@@ -1999,12 +1995,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
19991995 responses. add ( NodeGraphMessage :: SendGraph ) ;
20001996 }
20011997 NodeGraphMessage :: UpdateTypes { resolved_types, node_graph_errors } => {
2002- for ( path, node_type) in resolved_types. add {
2003- network_interface. resolved_types . types . insert ( path. to_vec ( ) , node_type) ;
2004- }
2005- for path in resolved_types. remove {
2006- network_interface. resolved_types . types . remove ( & path. to_vec ( ) ) ;
2007- }
1998+ network_interface. resolved_types . update ( resolved_types) ;
20081999 self . node_graph_errors = node_graph_errors;
20092000 }
20102001 NodeGraphMessage :: UpdateActionButtons => {
@@ -2118,16 +2109,7 @@ impl NodeGraphMessageHandler {
21182109 . popover_layout( {
21192110 // Showing only compatible types
21202111 let compatible_type = match ( selection_includes_layers, has_multiple_selection, selected_layer) {
2121- ( true , false , Some ( layer) ) => {
2122- let graph_layer = graph_modification_utils:: NodeGraphLayer :: new( layer, network_interface) ;
2123- let node_type = graph_layer. horizontal_layer_flow( ) . nth( 1 ) ;
2124- if let Some ( node_id) = node_type {
2125- let ( output_type, _) = network_interface. output_type( & OutputConnector :: node( node_id, 0 ) , & [ ] ) ;
2126- Some ( format!( "type:{}" , output_type. nested_type( ) ) )
2127- } else {
2128- None
2129- }
2130- }
2112+ ( true , false , Some ( layer) ) => network_interface. output_type( & OutputConnector :: node( layer. to_node( ) , 1 ) , & [ ] ) . add_node_string( ) ,
21312113 _ => None ,
21322114 } ;
21332115
@@ -2440,17 +2422,10 @@ impl NodeGraphMessageHandler {
24402422 . icon( Some ( "Node" . to_string( ) ) )
24412423 . tooltip( "Add an operation to the end of this layer's chain of nodes" )
24422424 . popover_layout( {
2443- let layer_identifier = LayerNodeIdentifier :: new( layer, context. network_interface) ;
2444- let compatible_type = {
2445- let graph_layer = graph_modification_utils:: NodeGraphLayer :: new( layer_identifier, context. network_interface) ;
2446- let node_type = graph_layer. horizontal_layer_flow( ) . nth( 1 ) ;
2447- if let Some ( node_id) = node_type {
2448- let ( output_type, _) = context. network_interface. output_type( & OutputConnector :: node( node_id, 0 ) , & [ ] ) ;
2449- Some ( format!( "type:{}" , output_type. nested_type( ) ) )
2450- } else {
2451- None
2452- }
2453- } ;
2425+ let compatible_type = context
2426+ . network_interface
2427+ . upstream_output_connector( & InputConnector :: node( layer, 1 ) , & [ ] )
2428+ . and_then( |upstream_output| context. network_interface. output_type( & upstream_output, & [ ] ) . add_node_string( ) ) ;
24542429
24552430 let mut node_chooser = NodeCatalog :: new( ) ;
24562431 node_chooser. intial_search = compatible_type. unwrap_or( "" . to_string( ) ) ;
0 commit comments