2009-05-29 09:53:46 +00:00
|
|
|
|
2009-05-21 21:23:36 +00:00
|
|
|
import bpy
|
|
|
|
|
|
|
|
class DataButtonsPanel(bpy.types.Panel):
|
2009-08-22 08:48:01 +00:00
|
|
|
__space_type__ = 'PROPERTIES'
|
|
|
|
__region_type__ = 'WINDOW'
|
2009-05-21 21:23:36 +00:00
|
|
|
__context__ = "data"
|
|
|
|
|
|
|
|
def poll(self, context):
|
2009-09-01 00:33:39 +00:00
|
|
|
return (context.mesh)
|
2009-05-21 21:23:36 +00:00
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
class DATA_PT_context_mesh(DataButtonsPanel):
|
2009-07-26 03:54:17 +00:00
|
|
|
__show_header__ = False
|
2009-06-13 21:22:21 +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()
|
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
class DATA_PT_normals(DataButtonsPanel):
|
|
|
|
__label__ = "Normals"
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
mesh = context.mesh
|
2009-05-21 21:23:36 +00:00
|
|
|
|
2009-07-09 16:09:44 +00:00
|
|
|
split = layout.split()
|
|
|
|
|
|
|
|
col = split.column()
|
|
|
|
col.itemR(mesh, "autosmooth")
|
2009-07-27 20:39:10 +00:00
|
|
|
sub = col.column()
|
|
|
|
sub.active = mesh.autosmooth
|
|
|
|
sub.itemR(mesh, "autosmooth_angle", text="Angle")
|
|
|
|
|
2009-08-06 23:34:14 +00:00
|
|
|
col = split.column()
|
|
|
|
col.itemR(mesh, "vertex_normal_flip")
|
|
|
|
col.itemR(mesh, "double_sided")
|
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
class DATA_PT_vertex_groups(DataButtonsPanel):
|
|
|
|
__label__ = "Vertex Groups"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
return (context.object and context.object.type in ('MESH', 'LATTICE'))
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
ob = context.object
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index")
|
|
|
|
|
|
|
|
col = row.column(align=True)
|
2009-08-22 08:48:01 +00:00
|
|
|
col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
|
|
|
|
col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="")
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-08-22 08:48:01 +00:00
|
|
|
col.itemO("object.vertex_group_copy", icon='ICON_BLANK1', text="")
|
2009-07-01 22:25:49 +00:00
|
|
|
if ob.data.users > 1:
|
2009-08-22 08:48:01 +00:00
|
|
|
col.itemO("object.vertex_group_copy_to_linked", icon='ICON_BLANK1', text="")
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
group = ob.active_vertex_group
|
|
|
|
if group:
|
|
|
|
row = layout.row()
|
|
|
|
row.itemR(group, "name")
|
|
|
|
|
2009-08-21 02:51:56 +00:00
|
|
|
if ob.mode == 'EDIT':
|
2009-08-12 22:16:47 +00:00
|
|
|
row = layout.row()
|
|
|
|
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.itemO("object.vertex_group_assign", text="Assign")
|
|
|
|
sub.itemO("object.vertex_group_remove_from", text="Remove")
|
|
|
|
|
|
|
|
sub = row.row(align=True)
|
|
|
|
sub.itemO("object.vertex_group_select", text="Select")
|
|
|
|
sub.itemO("object.vertex_group_deselect", text="Deselect")
|
2009-07-01 22:25:49 +00:00
|
|
|
|
|
|
|
layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
|
|
|
|
|
|
|
|
class DATA_PT_shape_keys(DataButtonsPanel):
|
|
|
|
__label__ = "Shape Keys"
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
return (context.object and context.object.type in ('MESH', 'LATTICE'))
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
ob = context.object
|
|
|
|
key = ob.data.shape_keys
|
2009-07-03 15:23:33 +00:00
|
|
|
kb = ob.active_shape_key
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
row = layout.row()
|
2009-08-29 17:13:06 +00:00
|
|
|
row.template_list(key, "keys", ob, "active_shape_key_index", rows=2)
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
col = row.column()
|
|
|
|
|
|
|
|
subcol = col.column(align=True)
|
2009-08-22 08:48:01 +00:00
|
|
|
subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="")
|
|
|
|
subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
|
2009-07-03 15:23:33 +00:00
|
|
|
|
|
|
|
if kb:
|
|
|
|
col.itemS()
|
|
|
|
|
|
|
|
subcol = col.column(align=True)
|
2009-08-22 08:48:01 +00:00
|
|
|
subcol.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
|
|
|
|
subcol.itemR(kb, "mute", icon='ICON_MUTE_IPO_ON', text="")
|
2009-07-03 15:23:33 +00:00
|
|
|
|
|
|
|
if key.relative:
|
|
|
|
row = layout.row()
|
|
|
|
row.itemR(key, "relative")
|
|
|
|
row.itemL()
|
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
row = layout.row()
|
|
|
|
row.itemR(kb, "name")
|
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
if ob.active_shape_key_index != 0:
|
2009-08-01 17:50:51 +00:00
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
row = layout.row()
|
2009-08-01 17:50:51 +00:00
|
|
|
row.enabled = ob.shape_key_lock == False
|
|
|
|
row.itemR(kb, "value", slider=True)
|
|
|
|
|
|
|
|
split = layout.split()
|
2009-08-12 22:16:47 +00:00
|
|
|
sub = split.column(align=True)
|
2009-08-01 17:50:51 +00:00
|
|
|
sub.enabled = ob.shape_key_lock == False
|
|
|
|
sub.itemL(text="Range:")
|
|
|
|
sub.itemR(kb, "slider_min", text="Min")
|
|
|
|
sub.itemR(kb, "slider_max", text="Max")
|
|
|
|
|
|
|
|
sub = split.column()
|
|
|
|
sub.itemL(text="Blend:")
|
|
|
|
sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="")
|
|
|
|
sub.item_pointerR(kb, "relative_key", key, "keys", text="")
|
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
else:
|
|
|
|
row = layout.row()
|
|
|
|
row.itemR(key, "relative")
|
|
|
|
row.itemR(key, "slurph")
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-27 20:39:10 +00:00
|
|
|
layout.itemR(kb, "name")
|
2009-07-21 00:55:20 +00:00
|
|
|
|
2009-08-21 02:51:56 +00:00
|
|
|
if ob.mode == 'EDIT':
|
2009-07-01 22:25:49 +00:00
|
|
|
layout.enabled = False
|
|
|
|
|
|
|
|
class DATA_PT_uv_texture(DataButtonsPanel):
|
|
|
|
__label__ = "UV Texture"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
me = context.mesh
|
|
|
|
|
|
|
|
row = layout.row()
|
2009-07-21 00:55:20 +00:00
|
|
|
col = row.column()
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
|
2009-07-01 22:25:49 +00:00
|
|
|
|
|
|
|
col = row.column(align=True)
|
2009-08-22 08:48:01 +00:00
|
|
|
col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="")
|
|
|
|
col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="")
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
lay = me.active_uv_texture
|
|
|
|
if lay:
|
|
|
|
layout.itemR(lay, "name")
|
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
class DATA_PT_vertex_colors(DataButtonsPanel):
|
|
|
|
__label__ = "Vertex Colors"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-27 20:39:10 +00:00
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
me = context.mesh
|
|
|
|
|
|
|
|
row = layout.row()
|
2009-07-21 00:55:20 +00:00
|
|
|
col = row.column()
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
|
2009-07-01 22:25:49 +00:00
|
|
|
|
|
|
|
col = row.column(align=True)
|
2009-08-22 08:48:01 +00:00
|
|
|
col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="")
|
|
|
|
col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="")
|
2009-06-27 01:15:31 +00:00
|
|
|
|
2009-07-21 00:55:20 +00:00
|
|
|
lay = me.active_vertex_color
|
|
|
|
if lay:
|
|
|
|
layout.itemR(lay, "name")
|
|
|
|
|
2009-07-09 09:42:34 +00:00
|
|
|
bpy.types.register(DATA_PT_context_mesh)
|
2009-07-21 00:55:20 +00:00
|
|
|
bpy.types.register(DATA_PT_normals)
|
2009-07-01 22:25:49 +00:00
|
|
|
bpy.types.register(DATA_PT_vertex_groups)
|
|
|
|
bpy.types.register(DATA_PT_shape_keys)
|
|
|
|
bpy.types.register(DATA_PT_uv_texture)
|
|
|
|
bpy.types.register(DATA_PT_vertex_colors)
|