2009-05-29 09:53:46 +00:00
|
|
|
|
2009-05-21 21:23:36 +00:00
|
|
|
import bpy
|
|
|
|
|
|
|
|
class DataButtonsPanel(bpy.types.Panel):
|
|
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
|
|
__region_type__ = "WINDOW"
|
|
|
|
__context__ = "data"
|
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-03 00:17:35 +00:00
|
|
|
return (context.mesh != None)
|
2009-05-21 21:23:36 +00:00
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
class DATA_PT_mesh(DataButtonsPanel):
|
|
|
|
__idname__ = "DATA_PT_mesh"
|
|
|
|
__label__ = "Mesh"
|
2009-06-13 21:22:21 +00:00
|
|
|
|
|
|
|
def poll(self, context):
|
2009-06-18 14:20:25 +00:00
|
|
|
return (context.object and context.object.type == 'MESH')
|
2009-05-21 21:23:36 +00:00
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
def draw(self, context):
|
2009-06-13 21:22:21 +00:00
|
|
|
layout = self.layout
|
|
|
|
|
2009-06-07 13:36:12 +00:00
|
|
|
ob = context.object
|
|
|
|
mesh = context.mesh
|
|
|
|
space = context.space_data
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.65)
|
|
|
|
|
|
|
|
if ob:
|
2009-06-23 00:19:10 +00:00
|
|
|
split.template_ID(ob, "data")
|
2009-06-07 13:36:12 +00:00
|
|
|
split.itemS()
|
|
|
|
elif mesh:
|
2009-06-23 00:19:10 +00:00
|
|
|
split.template_ID(space, "pin_id")
|
2009-06-07 13:36:12 +00:00
|
|
|
split.itemS()
|
|
|
|
|
|
|
|
if mesh:
|
|
|
|
layout.itemS()
|
2009-05-21 21:23:36 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
2009-05-29 09:53:46 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(mesh, "autosmooth")
|
|
|
|
colsub = col.column()
|
|
|
|
colsub.active = mesh.autosmooth
|
|
|
|
colsub.itemR(mesh, "autosmooth_angle", text="Angle")
|
2009-05-21 21:23:36 +00:00
|
|
|
sub = split.column()
|
|
|
|
sub.itemR(mesh, "vertex_normal_flip")
|
|
|
|
sub.itemR(mesh, "double_sided")
|
2009-05-24 12:37:55 +00:00
|
|
|
|
2009-06-24 14:16:56 +00:00
|
|
|
layout.itemR(mesh, "texco_mesh")
|
|
|
|
|
|
|
|
|
|
|
|
class DATA_PT_materials(DataButtonsPanel):
|
|
|
|
__idname__ = "DATA_PT_materials"
|
|
|
|
__label__ = "Materials"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
return (context.object and context.object.type in ('MESH', 'CURVE', 'FONT', 'SURFACE'))
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
|
2009-06-24 18:39:00 +00:00
|
|
|
row.template_list(ob, "materials", "active_material_index")
|
2009-06-24 14:16:56 +00:00
|
|
|
|
|
|
|
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="")
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
|
|
|
|
|
|
|
row.itemO("OBJECT_OT_material_slot_assign", text="Assign");
|
|
|
|
row.itemO("OBJECT_OT_material_slot_select", text="Select");
|
|
|
|
row.itemO("OBJECT_OT_material_slot_deselect", text="Deselect");
|
|
|
|
|
2009-06-27 01:15:31 +00:00
|
|
|
layout.itemS()
|
|
|
|
|
|
|
|
box= layout.box()
|
|
|
|
|
|
|
|
row = box.row()
|
|
|
|
row.template_list(ob, "materials", "active_material_index", compact=True)
|
|
|
|
|
|
|
|
subrow = row.row(align=True)
|
|
|
|
subrow.itemO("OBJECT_OT_material_slot_add", icon="ICON_ZOOMIN", text="")
|
|
|
|
subrow.itemO("OBJECT_OT_material_slot_remove", icon="ICON_ZOOMOUT", text="")
|
|
|
|
|
|
|
|
|
2009-06-18 14:20:25 +00:00
|
|
|
bpy.types.register(DATA_PT_mesh)
|
2009-06-24 14:16:56 +00:00
|
|
|
bpy.types.register(DATA_PT_materials)
|
|
|
|
|