@@ -7,7 +7,7 @@ use super::misc::PTZ;
77use super :: nodes:: SelectedNodes ;
88use crate :: consts:: { EXPORTS_TO_RIGHT_EDGE_PIXEL_GAP , EXPORTS_TO_TOP_EDGE_PIXEL_GAP , GRID_SIZE , IMPORTS_TO_LEFT_EDGE_PIXEL_GAP , IMPORTS_TO_TOP_EDGE_PIXEL_GAP } ;
99use crate :: messages:: portfolio:: document:: graph_operation:: utility_types:: ModifyInputsContext ;
10- use crate :: messages:: portfolio:: document:: node_graph:: document_node_definitions:: { DefinitionIdentifier , DocumentNodeDefinition , default_display_name , resolve_document_node_type} ;
10+ use crate :: messages:: portfolio:: document:: node_graph:: document_node_definitions:: { DefinitionIdentifier , implementation_name_from_identifier , resolve_document_node_type} ;
1111use crate :: messages:: portfolio:: document:: node_graph:: utility_types:: { Direction , FrontendClickTargets , FrontendGraphDataType , FrontendGraphInput , FrontendGraphOutput } ;
1212use crate :: messages:: portfolio:: document:: overlays:: utility_functions:: text_width;
1313use crate :: messages:: portfolio:: document:: utility_types:: network_interface:: resolved_types:: ResolvedDocumentNodeTypes ;
@@ -19,7 +19,6 @@ use glam::{DAffine2, DVec2, IVec2};
1919use graph_craft:: Type ;
2020use graph_craft:: document:: value:: TaggedValue ;
2121use graph_craft:: document:: { DocumentNode , DocumentNodeImplementation , NodeId , NodeInput , NodeNetwork , OldDocumentNodeImplementation , OldNodeNetwork } ;
22- use graph_craft:: proto:: NODE_METADATA ;
2322use graphene_std:: ContextDependencies ;
2423use graphene_std:: math:: quad:: Quad ;
2524use graphene_std:: subpath:: Subpath ;
@@ -471,33 +470,6 @@ impl NodeNetworkInterface {
471470 node_template
472471 }
473472
474- /// Try and get the [`DocumentNodeDefinition`] for a node
475- pub fn node_definition ( & self , node_id : & NodeId , network_path : & [ NodeId ] ) -> Option < & DocumentNodeDefinition > {
476- let implementation = self . implementation ( node_id, network_path) ?;
477- match implementation {
478- DocumentNodeImplementation :: Network ( _) => {
479- let metadata = self . node_metadata ( node_id, network_path) ?;
480- let metadata = metadata. persistent_metadata . network_metadata . as_ref ( ) ?;
481- let reference = metadata. persistent_metadata . reference . clone ( ) ?;
482- let identifier = DefinitionIdentifier :: Network ( reference. clone ( ) ) ;
483- let Some ( definition) = resolve_document_node_type ( & identifier) else {
484- log:: error!( "Could not get definition for node id {node_id} with reference {reference}" ) ;
485- return None ;
486- } ;
487- Some ( definition)
488- }
489- DocumentNodeImplementation :: ProtoNode ( proto_node_identifier) => {
490- let identifier = DefinitionIdentifier :: ProtoNode ( proto_node_identifier. clone ( ) ) ;
491- let Some ( definition) = resolve_document_node_type ( & identifier) else {
492- log:: error!( "Could not get definition for node id {node_id} with proto_node_identifier {proto_node_identifier}" ) ;
493- return None ;
494- } ;
495- Some ( definition)
496- }
497- DocumentNodeImplementation :: Extract => None ,
498- }
499- }
500-
501473 pub fn input_from_connector ( & self , input_connector : & InputConnector , network_path : & [ NodeId ] ) -> Option < & NodeInput > {
502474 let Some ( network) = self . nested_network ( network_path) else {
503475 log:: error!( "Could not get network in input_from_connector" ) ;
@@ -957,7 +929,7 @@ impl NodeNetworkInterface {
957929 . persistent_metadata
958930 . reference
959931 . clone ( )
960- . map ( |reference| DefinitionIdentifier :: Network ( reference ) )
932+ . map ( DefinitionIdentifier :: Network )
961933 }
962934 DocumentNodeImplementation :: ProtoNode ( protonode_id) => Some ( DefinitionIdentifier :: ProtoNode ( protonode_id. clone ( ) ) ) ,
963935 _ => None ,
@@ -1045,7 +1017,7 @@ impl NodeNetworkInterface {
10451017 /// The uneditable name in the properties panel which represents the function name of the node implementation
10461018 pub fn implementation_name ( & self , node_id : & NodeId , network_path : & [ NodeId ] ) -> String {
10471019 self . reference ( & node_id, network_path)
1048- . map ( |identifier| default_display_name ( & identifier) )
1020+ . map ( |identifier| implementation_name_from_identifier ( & identifier) )
10491021 . unwrap_or ( "Custom Node" . to_string ( ) )
10501022 }
10511023
@@ -3755,7 +3727,9 @@ impl NodeNetworkInterface {
37553727 let Some ( metadata) = self . node_metadata_mut ( node_id, network_path) else { return } ;
37563728 for added_input_index in metadata. persistent_metadata . input_metadata . len ( ) ..number_of_inputs {
37573729 let input_metadata = self
3758- . node_definition ( node_id, network_path)
3730+ . reference ( node_id, network_path)
3731+ . as_ref ( )
3732+ . and_then ( resolve_document_node_type)
37593733 . and_then ( |definition| definition. node_template . persistent_node_metadata . input_metadata . get ( added_input_index) )
37603734 . cloned ( ) ;
37613735 let Some ( metadata) = self . node_metadata_mut ( node_id, network_path) else { return } ;
@@ -6254,7 +6228,8 @@ struct InputTransientMetadata {
62546228/// Persistent metadata for each node in the network, which must be included when creating, serializing, and deserializing saving a node.
62556229#[ derive( Default , Debug , Clone , PartialEq , serde:: Serialize , serde:: Deserialize ) ]
62566230pub struct DocumentNodePersistentMetadata {
6257- /// A name chosen by the user for this instance of the node. Empty indicates no given name, in which case the reference name is displayed to the user in italics.
6231+ /// A name chosen by the user for this instance of the node. Empty indicates no given name, in which case the implementation name is displayed to the user in italics.
6232+ /// This is empty for all newly created nodes, except protonodes with #[skip_impl]
62586233 #[ serde( default ) ]
62596234 pub display_name : String ,
62606235 /// Stores metadata to override the properties in the properties panel for each input. These can either be generated automatically based on the type, or with a custom function.
0 commit comments