Thanks a lot, this is a cool addon
I would like to add some menus above the search box, but i don’t know how to do it
From the chat gpt I got that in general the menus are added to the modifiers tab.
I would appreciate your help.
Blockquote
import bpy
from bpy.types import PanelPanel for modifiers, materials, UV maps, and vertex groups
class NPModifiersAndMaterialsPanel(bpy.types.Panel):
bl_label = “Modifiers, Materials & Vertex Groups” # General title for the entire panel
bl_idname = “NP_PT_Modifiers_And_Materials”
bl_space_type = ‘PROPERTIES’
bl_region_type = ‘WINDOW’
bl_context = “modifier” # Panel context (for modifiers)def draw(self, context): layout = self.layout obj = context.object if obj: # === Modifiers === #for modifier in obj.modifiers: # row = layout.row() # row.prop(modifier, "name", text="") # row.prop(modifier, "show_viewport") # === Materials === row = layout.row() row.template_list("MATERIAL_UL_matslots", "", obj, "material_slots", obj, "active_material_index", rows=2) col = row.column(align=True) col.operator("object.material_slot_add", icon='ADD', text="") col.operator("object.material_slot_remove", icon='REMOVE', text="") col.separator() col.menu("MATERIAL_MT_context_menu", icon='DOWNARROW_HLT', text="") if len(obj.material_slots) > 1: col.separator() col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN' row = layout.row() row.template_ID(obj, "active_material", new="material.new") # === UV Maps === if obj.type == 'MESH': me = obj.data row = layout.row() col = row.column() col.template_list("MESH_UL_uvmaps", "uvmaps", me, "uv_layers", me.uv_layers, "active_index", rows=2) col = row.column(align=True) col.operator("mesh.uv_texture_add", icon='ADD', text="") col.operator("mesh.uv_texture_remove", icon='REMOVE', text="") else: layout.label(text="This is not a mesh object", icon='ERROR') # === Vertex Groups === if obj.type == 'MESH': group = obj.vertex_groups.active rows = 3 if group: rows = 5 row = layout.row() row.template_list("MESH_UL_vgroups", "", obj, "vertex_groups", obj.vertex_groups, "active_index", rows=rows) col = row.column(align=True) col.operator("object.vertex_group_add", icon='ADD', text="") props = col.operator("object.vertex_group_remove", icon='REMOVE', text="") props.all_unlocked = props.all = False col.separator() col.menu("MESH_MT_vertex_group_context_menu", icon='DOWNARROW_HLT', text="") if group: col.separator() col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN' if ( obj.vertex_groups and (obj.mode == 'EDIT' or (obj.mode == 'WEIGHT_PAINT' and obj.type == 'MESH' and obj.data.use_paint_mask_vertex)) ): row = layout.row() sub = row.row(align=True) sub.operator("object.vertex_group_assign", text="Assign") sub.operator("object.vertex_group_remove_from", text="Remove") sub = row.row(align=True) sub.operator("object.vertex_group_select", text="Select") sub.operator("object.vertex_group_deselect", text="Deselect") layout.prop(context.tool_settings, "vertex_group_weight", text="Weight") else: layout.label(text="No active object", icon='ERROR')
Register the panel
def register():
bpy.utils.register_class(NPModifiersAndMaterialsPanel)def unregister():
bpy.utils.unregister_class(NPModifiersAndMaterialsPanel)if name == “main”:
register()