@@ -122,6 +122,28 @@ def draw_item(self,context,layout,data,item,icon,active_data,active_propname,ind
122122 layout .alignment = 'CENTER'
123123 layout .label (text = item .name ,icon = icon )
124124
125+ class MCFG_OT_NewConfig (bpy .types .Operator ):
126+ # Description string
127+ '''Create new model config node tree'''
128+
129+ # Mandatory variables
130+ bl_label = "New Config"
131+ bl_idname = "mcfg.newconfig"
132+
133+ # Standard functions
134+ @classmethod
135+ def poll (cls , context ):
136+ return context .space_data .type == 'NODE_EDITOR' and context .space_data .tree_type == 'MCFG_N_Tree'
137+
138+ def execute (self ,context ):
139+
140+ editorSpace = context .space_data
141+ newTree = bpy .data .node_groups .new ("Model Config" ,'MCFG_N_Tree' )
142+ newTree .use_fake_user = True
143+ editorSpace .node_tree = newTree
144+
145+ return {'FINISHED' }
146+
125147class MCFG_OT_BonesFromModel (bpy .types .Operator ):
126148 # Description string
127149 '''Create bones from model selections'''
@@ -653,4 +675,20 @@ def draw_menu(self,context):
653675 layout .separator ()
654676 layout .label (text = "Arma 3 model config editor" )
655677 layout .menu ("MCFG_MT_TemplatesNodeScript" )
656- layout .menu ("MCFG_MT_TemplatesSetupPresets" )
678+ layout .menu ("MCFG_MT_TemplatesSetupPresets" )
679+
680+ # Original node editor header draw function
681+ orig_node_header = bpy .types .NODE_HT_header .draw
682+
683+ def draw_header_override (self ,context ): # THIS STILL NEEDS TO BE LOOKED INTO REGARDING ADDON CONFLICTS
684+ from bl_ui .space_node import NODE_MT_editor_menus
685+
686+ if context .space_data .type != 'NODE_EDITOR' or context .space_data .tree_type != 'MCFG_N_Tree' :
687+ orig_node_header (self ,context )
688+ return
689+
690+ self .layout .template_header ()
691+ NODE_MT_editor_menus .draw_collapsible (context ,self .layout )
692+ self .layout .separator_spacer ()
693+ self .layout .template_ID (context .space_data ,"node_tree" ,new = "mcfg.newconfig" ,open = "mcfg.import" )
694+ self .layout .separator_spacer ()
0 commit comments