X-Git-Url: https://git.blender.org/gitweb/gitweb.cgi/blender-staging.git/blobdiff_plain/eab7905a9e03c9d8cb5a250f893be4f78cc04dde..9f592e4f625c302a56ea337e71d21221273eb938:/release/ui/buttons_material.py diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index 8b0ef82b628..fb7f86c514b 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -21,10 +21,10 @@ class MATERIAL_PT_preview(MaterialButtonsPanel): mat = context.material layout.template_preview(mat) - -class MATERIAL_PT_material(MaterialButtonsPanel): - __idname__= "MATERIAL_PT_material" - __label__ = "Material" + +class MATERIAL_PT_context(MaterialButtonsPanel): + __idname__= "MATERIAL_PT_context" + __label__ = " " def poll(self, context): return (context.material or context.material_slot) @@ -37,18 +37,40 @@ class MATERIAL_PT_material(MaterialButtonsPanel): slot = context.material_slot space = context.space_data + row = layout.row() + + row.template_list(ob, "materials", ob, "active_material_index") + + col = row.column(align=True) + col.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="") + col.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="") + split = layout.split(percentage=0.65) if ob and slot: split.template_ID(slot, "material", new="MATERIAL_OT_new") - split.itemR(ob, "active_material_index", text="Active") + #split.itemR(ob, "active_material_index", text="Active") elif mat: split.template_ID(space, "pin_id") split.itemS() - if mat: - layout.itemS() + +class MATERIAL_PT_material(MaterialButtonsPanel): + __idname__= "MATERIAL_PT_material" + __label__ = "Material" + + def poll(self, context): + return (context.material or context.material_slot) + + def draw(self, context): + layout = self.layout + mat = context.material + ob = context.object + slot = context.material_slot + space = context.space_data + + if mat: layout.itemR(mat, "type", expand=True) layout.itemR(mat, "alpha", slider=True) @@ -413,6 +435,8 @@ class MATERIAL_PT_halo(MaterialButtonsPanel): colsub.itemR(halo, "flare_seed", text="Seed") colsub.itemR(halo, "flares_sub", text="Sub") + +bpy.types.register(MATERIAL_PT_context) bpy.types.register(MATERIAL_PT_preview) bpy.types.register(MATERIAL_PT_material) bpy.types.register(MATERIAL_PT_diffuse)