@@ -372,14 +372,14 @@ def _set_settings_defaults(self, node: Node) -> None:
372372 version_lt_max = bpy .app .version < min (attr_info .max_version_ , node_info .max_version_ )
373373
374374 is_version_valid = version_gte_min and version_lt_max
375- if not hasattr (node , attr_name ):
376- if is_version_valid :
377- self .report ({'WARNING' },
378- f"NodeToPython: Couldn't find attribute "
379- f"\" { attr_name } \" for node { node .name } of type "
380- f"{ node .bl_idname } " )
375+ if not is_version_valid :
381376 continue
382- elif not is_version_valid :
377+
378+ if not hasattr (node , attr_name ):
379+ self .report ({'WARNING' },
380+ f"NodeToPython: Couldn't find attribute "
381+ f"\" { attr_name } \" for node { node .name } of type "
382+ f"{ node .bl_idname } " )
383383 continue
384384
385385 attr = getattr (node , attr_name , None )
@@ -474,6 +474,11 @@ def _set_group_socket_defaults(self, socket_interface: NodeSocketInterface,
474474
475475 if socket_interface .type not in self .default_sockets_v3 :
476476 return
477+
478+ if not hasattr (socket_interface , "default_value" ):
479+ self .report ({'WARNING' },
480+ f"Socket { socket_interface .type } had no default value" )
481+ return
477482
478483 if socket_interface .type == 'RGBA' :
479484 dv = vec4_to_py_str (socket_interface .default_value )
@@ -692,6 +697,32 @@ def _create_socket(self, socket: NodeTreeInterfaceSocket,
692697 description = str_to_py_str (socket .description )
693698 self ._write (f"{ socket_var } .description = { description } " )
694699
700+ # layer selection field
701+ if socket .layer_selection_field :
702+ self ._write (f"{ socket_var } .layer_selection_field = True" )
703+
704+ if bpy .app .version >= (4 , 2 , 0 ):
705+ # is inspect output
706+ if socket .is_inspect_output :
707+ self ._write (f"{ socket_var } .is_inspect_output = True" )
708+
709+ if bpy .app .version >= (4 , 5 , 0 ):
710+ # default input
711+ default_input = enum_to_py_str (socket .default_input )
712+ self ._write (f"{ socket_var } .default_input = { default_input } " )
713+
714+ # is panel toggle
715+ if socket .is_panel_toggle :
716+ self ._write (f"{ socket_var } .is_panel_toggle = True" )
717+
718+ # menu expanded
719+ if socket .menu_expanded :
720+ self ._write (f"{ socket_var } .menu_expanded = True" )
721+
722+ # structure type
723+ structure_type = enum_to_py_str (socket .structure_type )
724+ self ._write (f"{ socket_var } .structure_type = { structure_type } " )
725+
695726 self ._write ("" , 0 )
696727
697728 def _create_panel (self , panel : NodeTreeInterfacePanel ,
@@ -775,7 +806,7 @@ def _process_items(self, parent: NodeTreeInterfacePanel,
775806
776807 items_processed .add (item )
777808
778- if item .item_type == 'SOCKET' :
809+ if item .item_type in { 'SOCKET' , 'PANEL_TOGGLE' } :
779810 self ._create_socket (item , parent , panel_dict , ntp_nt )
780811
781812 elif item .item_type == 'PANEL' :
0 commit comments