I didn’t know this one, but you can use his code and complete matalogue to have only one addon for shaders.
I started the code yesterday, it’s really simple right now.
import bpy
class CreateMat(bpy.types.Operator):
bl_idname = “my_operator.create_mat”
bl_label = “Create Mat”
bl_description = “”
bl_options = {“REGISTER”}
@classmethod
def poll(cls, context):
return True
def execute(self, context):
bpy.ops.object.material_slot_add()
bpy.ops.material.new()
mat_index = len(bpy.data.materials)-1
ob = bpy.context.active_object
ob.material_slots[ob.active_material_index].material = bpy.data.materials[mat_index]
return {"FINISHED"}
class GestionMaterialMenu(bpy.types.Menu):
bl_label = “Gestion Material Menu”
bl_idname = “OBJECT_MT_Gestion_Material_menu”
def draw(self, context):
layout = self.layout
layout.operator("my_operator.create_mat", text="New Material", icon='MATERIAL')
layout.operator("object.material_slot_remove", text="Delete Material", icon='CANCEL')
layout.operator("object.material_slot_move", text="Move UP", icon='TRIA_UP').direction='UP'
layout.operator("object.material_slot_move", text="Move Down", icon='TRIA_DOWN').direction='DOWN'
def register():
bpy.utils.register_module(name)
def unregister():
bpy.utils.unregister_module(name)
if name == “main”:
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=GestionMaterialMenu.bl_idname)