4 class DataButtonsPanel(bpy.types.Panel):
5 __space_type__ = 'PROPERTIES'
6 __region_type__ = 'WINDOW'
9 def poll(self, context):
10 return (context.mesh != None)
12 class DATA_PT_context_mesh(DataButtonsPanel):
13 __show_header__ = False
15 def draw(self, context):
20 space = context.space_data
22 split = layout.split(percentage=0.65)
25 split.template_ID(ob, "data")
28 split.template_ID(space, "pin_id")
31 class DATA_PT_normals(DataButtonsPanel):
34 def draw(self, context):
39 split = layout.split()
42 col.itemR(mesh, "autosmooth")
44 sub.active = mesh.autosmooth
45 sub.itemR(mesh, "autosmooth_angle", text="Angle")
48 col.itemR(mesh, "vertex_normal_flip")
49 col.itemR(mesh, "double_sided")
51 class DATA_PT_vertex_groups(DataButtonsPanel):
52 __label__ = "Vertex Groups"
54 def poll(self, context):
55 return (context.object and context.object.type in ('MESH', 'LATTICE'))
57 def draw(self, context):
63 row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index")
65 col = row.column(align=True)
66 col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
67 col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="")
69 col.itemO("object.vertex_group_copy", icon='ICON_BLANK1', text="")
71 col.itemO("object.vertex_group_copy_to_linked", icon='ICON_BLANK1', text="")
73 group = ob.active_vertex_group
76 row.itemR(group, "name")
81 sub = row.row(align=True)
82 sub.itemO("object.vertex_group_assign", text="Assign")
83 sub.itemO("object.vertex_group_remove_from", text="Remove")
85 sub = row.row(align=True)
86 sub.itemO("object.vertex_group_select", text="Select")
87 sub.itemO("object.vertex_group_deselect", text="Deselect")
89 layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
91 class DATA_PT_shape_keys(DataButtonsPanel):
92 __label__ = "Shape Keys"
94 def poll(self, context):
95 return (context.object and context.object.type in ('MESH', 'LATTICE'))
97 def draw(self, context):
101 key = ob.data.shape_keys
102 kb = ob.active_shape_key
105 row.template_list(key, "keys", ob, "active_shape_key_index")
109 subcol = col.column(align=True)
110 subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="")
111 subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
116 subcol = col.column(align=True)
117 subcol.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
118 subcol.itemR(kb, "mute", icon='ICON_MUTE_IPO_ON', text="")
122 row.itemR(key, "relative")
126 row.itemR(kb, "name")
128 if ob.active_shape_key_index != 0:
131 row.enabled = ob.shape_key_lock == False
132 row.itemR(kb, "value", slider=True)
134 split = layout.split()
135 sub = split.column(align=True)
136 sub.enabled = ob.shape_key_lock == False
137 sub.itemL(text="Range:")
138 sub.itemR(kb, "slider_min", text="Min")
139 sub.itemR(kb, "slider_max", text="Max")
142 sub.itemL(text="Blend:")
143 sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="")
144 sub.item_pointerR(kb, "relative_key", key, "keys", text="")
148 row.itemR(key, "relative")
149 row.itemR(key, "slurph")
151 layout.itemR(kb, "name")
153 if ob.mode == 'EDIT':
154 layout.enabled = False
156 class DATA_PT_uv_texture(DataButtonsPanel):
157 __label__ = "UV Texture"
159 def draw(self, context):
167 col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
169 col = row.column(align=True)
170 col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="")
171 col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="")
173 lay = me.active_uv_texture
175 layout.itemR(lay, "name")
177 class DATA_PT_vertex_colors(DataButtonsPanel):
178 __label__ = "Vertex Colors"
180 def draw(self, context):
188 col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
190 col = row.column(align=True)
191 col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="")
192 col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="")
194 lay = me.active_vertex_color
196 layout.itemR(lay, "name")
198 bpy.types.register(DATA_PT_context_mesh)
199 bpy.types.register(DATA_PT_normals)
200 bpy.types.register(DATA_PT_vertex_groups)
201 bpy.types.register(DATA_PT_shape_keys)
202 bpy.types.register(DATA_PT_uv_texture)
203 bpy.types.register(DATA_PT_vertex_colors)