@@ -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:: utility_types:: network_interface:: resolved_types:: ResolvedDocumentNodeTypes ;
1313use crate :: messages:: portfolio:: document:: utility_types:: wires:: { GraphWireStyle , WirePath , WirePathUpdate , build_vector_wire} ;
@@ -18,7 +18,6 @@ use glam::{DAffine2, DVec2, IVec2};
1818use graph_craft:: Type ;
1919use graph_craft:: document:: value:: TaggedValue ;
2020use graph_craft:: document:: { DocumentNode , DocumentNodeImplementation , NodeId , NodeInput , NodeNetwork , OldDocumentNodeImplementation , OldNodeNetwork } ;
21- use graph_craft:: proto:: NODE_METADATA ;
2221use graphene_std:: ContextDependencies ;
2322use graphene_std:: math:: quad:: Quad ;
2423use graphene_std:: subpath:: Subpath ;
@@ -470,33 +469,6 @@ impl NodeNetworkInterface {
470469 node_template
471470 }
472471
473- /// Try and get the [`DocumentNodeDefinition`] for a node
474- pub fn node_definition ( & self , node_id : & NodeId , network_path : & [ NodeId ] ) -> Option < & DocumentNodeDefinition > {
475- let implementation = self . implementation ( node_id, network_path) ?;
476- match implementation {
477- DocumentNodeImplementation :: Network ( _) => {
478- let metadata = self . node_metadata ( node_id, network_path) ?;
479- let metadata = metadata. persistent_metadata . network_metadata . as_ref ( ) ?;
480- let reference = metadata. persistent_metadata . reference . clone ( ) ?;
481- let identifier = DefinitionIdentifier :: Network ( reference. clone ( ) ) ;
482- let Some ( definition) = resolve_document_node_type ( & identifier) else {
483- log:: error!( "Could not get definition for node id {node_id} with reference {reference}" ) ;
484- return None ;
485- } ;
486- Some ( definition)
487- }
488- DocumentNodeImplementation :: ProtoNode ( proto_node_identifier) => {
489- let identifier = DefinitionIdentifier :: ProtoNode ( proto_node_identifier. clone ( ) ) ;
490- let Some ( definition) = resolve_document_node_type ( & identifier) else {
491- log:: error!( "Could not get definition for node id {node_id} with proto_node_identifier {proto_node_identifier}" ) ;
492- return None ;
493- } ;
494- Some ( definition)
495- }
496- DocumentNodeImplementation :: Extract => None ,
497- }
498- }
499-
500472 pub fn input_from_connector ( & self , input_connector : & InputConnector , network_path : & [ NodeId ] ) -> Option < & NodeInput > {
501473 let Some ( network) = self . nested_network ( network_path) else {
502474 log:: error!( "Could not get network in input_from_connector" ) ;
@@ -956,7 +928,7 @@ impl NodeNetworkInterface {
956928 . persistent_metadata
957929 . reference
958930 . clone ( )
959- . map ( |reference| DefinitionIdentifier :: Network ( reference ) )
931+ . map ( DefinitionIdentifier :: Network )
960932 }
961933 DocumentNodeImplementation :: ProtoNode ( protonode_id) => Some ( DefinitionIdentifier :: ProtoNode ( protonode_id. clone ( ) ) ) ,
962934 _ => None ,
@@ -1044,7 +1016,7 @@ impl NodeNetworkInterface {
10441016 /// The uneditable name in the properties panel which represents the function name of the node implementation
10451017 pub fn implementation_name ( & self , node_id : & NodeId , network_path : & [ NodeId ] ) -> String {
10461018 self . reference ( & node_id, network_path)
1047- . map ( |identifier| default_display_name ( & identifier) )
1019+ . map ( |identifier| implementation_name_from_identifier ( & identifier) )
10481020 . unwrap_or ( "Custom Node" . to_string ( ) )
10491021 }
10501022
@@ -3795,7 +3767,9 @@ impl NodeNetworkInterface {
37953767 let Some ( metadata) = self . node_metadata_mut ( node_id, network_path) else { return } ;
37963768 for added_input_index in metadata. persistent_metadata . input_metadata . len ( ) ..number_of_inputs {
37973769 let input_metadata = self
3798- . node_definition ( node_id, network_path)
3770+ . reference ( node_id, network_path)
3771+ . as_ref ( )
3772+ . and_then ( resolve_document_node_type)
37993773 . and_then ( |definition| definition. node_template . persistent_node_metadata . input_metadata . get ( added_input_index) )
38003774 . cloned ( ) ;
38013775 let Some ( metadata) = self . node_metadata_mut ( node_id, network_path) else { return } ;
@@ -6277,7 +6251,8 @@ struct InputTransientMetadata {
62776251/// Persistent metadata for each node in the network, which must be included when creating, serializing, and deserializing saving a node.
62786252#[ derive( Default , Debug , Clone , PartialEq , serde:: Serialize , serde:: Deserialize ) ]
62796253pub struct DocumentNodePersistentMetadata {
6280- /// 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.
6254+ /// 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.
6255+ /// This is empty for all newly created nodes, except protonodes with #[skip_impl]
62816256 #[ serde( default ) ]
62826257 pub display_name : String ,
62836258 /// 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