@@ -6,6 +6,7 @@ use crate::messages::layout::utility_types::widget_prelude::*;
6
6
use crate :: messages:: portfolio:: document:: utility_types:: network_interface:: InputConnector ;
7
7
use crate :: messages:: prelude:: * ;
8
8
9
+ use dyn_any:: DynAny ;
9
10
use graph_craft:: document:: value:: TaggedValue ;
10
11
use graph_craft:: document:: { DocumentNode , DocumentNodeImplementation , NodeId , NodeInput } ;
11
12
use graph_craft:: imaginate_input:: { ImaginateMaskStartingFill , ImaginateSamplingMethod } ;
@@ -2128,24 +2129,30 @@ pub(crate) fn generate_node_properties(node_id: NodeId, context: &mut NodeProper
2128
2129
2129
2130
let mut number_options = ( None , None , None ) ;
2130
2131
let input_type = match implementation {
2131
- DocumentNodeImplementation :: ProtoNode ( proto_node_identifier) => {
2132
+ DocumentNodeImplementation :: ProtoNode ( proto_node_identifier) => ' early_return : {
2132
2133
if let Some ( field) = graphene_core:: registry:: NODE_METADATA
2133
2134
. lock ( )
2134
2135
. unwrap ( )
2135
2136
. get ( & proto_node_identifier. name . clone ( ) . into_owned ( ) )
2136
2137
. and_then ( |metadata| metadata. fields . get ( input_index) )
2137
2138
{
2138
2139
number_options = ( field. number_min , field. number_max , field. number_mode_range ) ;
2140
+ if let Some ( ref default) = field. default_type {
2141
+ break ' early_return default. clone ( ) ;
2142
+ }
2139
2143
}
2140
2144
let Some ( implementations) = & interpreted_executor:: node_registry:: NODE_REGISTRY . get ( proto_node_identifier) else {
2141
2145
log:: error!( "Could not get implementation for protonode {proto_node_identifier:?}" ) ;
2142
2146
return Vec :: new ( ) ;
2143
2147
} ;
2144
2148
let proto_node_identifier = proto_node_identifier. clone ( ) ;
2145
- let input_type = implementations
2149
+ let mut input_types = implementations
2146
2150
. keys ( )
2147
2151
. filter_map ( |item| item. inputs . get ( input_index) )
2148
- . find ( |item| property_from_type ( node_id, input_index, item, number_options, context) . is_ok ( ) ) ;
2152
+ . filter ( |ty| property_from_type ( node_id, input_index, ty, number_options, context) . is_ok ( ) )
2153
+ . collect :: < Vec < _ > > ( ) ;
2154
+ input_types. sort_by_key ( |ty| ty. type_name ( ) ) ;
2155
+ let input_type = input_types. first ( ) . cloned ( ) ;
2149
2156
let Some ( input_type) = input_type else {
2150
2157
log:: error!( "Could not get input type for protonode {proto_node_identifier:?} at index {input_index:?}" ) ;
2151
2158
return Vec :: new ( ) ;
0 commit comments