1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
23 class DataButtonsPanel(bpy.types.Panel):
24 bl_space_type = 'PROPERTIES'
25 bl_region_type = 'WINDOW'
28 def poll(self, context):
32 class DATA_PT_context_mesh(DataButtonsPanel):
34 bl_show_header = False
36 def draw(self, context):
41 space = context.space_data
43 split = layout.split(percentage=0.65)
46 split.template_ID(ob, "data")
49 split.template_ID(space, "pin_id")
53 class DATA_PT_normals(DataButtonsPanel):
56 def draw(self, context):
61 split = layout.split()
64 col.itemR(mesh, "autosmooth")
66 sub.active = mesh.autosmooth
67 sub.itemR(mesh, "autosmooth_angle", text="Angle")
70 col.itemR(mesh, "vertex_normal_flip")
71 col.itemR(mesh, "double_sided")
74 class DATA_PT_settings(DataButtonsPanel):
77 def draw(self, context):
82 split = layout.split()
85 col.itemR(mesh, "texture_mesh")
88 class DATA_PT_vertex_groups(DataButtonsPanel):
89 bl_label = "Vertex Groups"
91 def poll(self, context):
92 return (context.object and context.object.type in ('MESH', 'LATTICE'))
94 def draw(self, context):
98 group = ob.active_vertex_group
105 row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows)
107 col = row.column(align=True)
108 col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
109 col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="")
111 col.itemO("object.vertex_group_copy", icon='ICON_COPY_ID', text="")
112 if ob.data.users > 1:
113 col.itemO("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="")
117 row.itemR(group, "name")
119 if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
122 sub = row.row(align=True)
123 sub.itemO("object.vertex_group_assign", text="Assign")
124 sub.itemO("object.vertex_group_remove_from", text="Remove")
126 sub = row.row(align=True)
127 sub.itemO("object.vertex_group_select", text="Select")
128 sub.itemO("object.vertex_group_deselect", text="Deselect")
130 layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight")
133 class DATA_PT_shape_keys(DataButtonsPanel):
134 bl_label = "Shape Keys"
136 def poll(self, context):
137 return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE'))
139 def draw(self, context):
143 key = ob.data.shape_keys
144 kb = ob.active_shape_key
146 enable_edit = ob.mode != 'EDIT'
147 enable_edit_value = False
149 if ob.shape_key_lock == False:
150 if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode):
151 enable_edit_value = True
158 row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows)
162 subcol = col.column(align=True)
163 subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="")
164 subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
169 subcol = col.column(align=True)
170 subcol.item_enumO("object.shape_key_move", "type", 'UP', icon='ICON_TRIA_UP', text="")
171 subcol.item_enumO("object.shape_key_move", "type", 'DOWN', icon='ICON_TRIA_DOWN', text="")
173 split = layout.split(percentage=0.4)
175 sub.enabled = enable_edit
176 sub.itemR(key, "relative")
179 sub.alignment = 'RIGHT'
181 subrow = sub.row(align=True)
182 subrow.active = enable_edit_value
183 if ob.shape_key_lock:
184 subrow.itemR(ob, "shape_key_lock", icon='ICON_PINNED', text="")
186 subrow.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
188 subrow.itemR(kb, "mute", icon='ICON_MUTE_IPO_ON', text="")
190 subrow.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="")
191 subrow.itemO("object.shape_key_clear", icon='ICON_X', text="")
193 sub.itemO("object.shape_key_mirror", icon='ICON_MOD_MIRROR', text="")
195 sub.itemR(ob, "shape_key_edit_mode", text="")
198 row.itemR(kb, "name")
201 if ob.active_shape_key_index != 0:
203 row.active = enable_edit_value
204 row.itemR(kb, "value")
206 split = layout.split()
207 sub = split.column(align=True)
208 sub.active = enable_edit_value
209 sub.itemL(text="Range:")
210 sub.itemR(kb, "slider_min", text="Min")
211 sub.itemR(kb, "slider_max", text="Max")
213 sub = split.column(align=True)
214 sub.active = enable_edit_value
215 sub.itemL(text="Blend:")
216 sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="")
217 sub.item_pointerR(kb, "relative_key", key, "keys", text="")
221 row.active = enable_edit_value
222 row.itemR(key, "slurph")
225 class DATA_PT_uv_texture(DataButtonsPanel):
226 bl_label = "UV Texture"
228 def draw(self, context):
236 col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2)
238 col = row.column(align=True)
239 col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="")
240 col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="")
242 lay = me.active_uv_texture
244 layout.itemR(lay, "name")
247 class DATA_PT_vertex_colors(DataButtonsPanel):
248 bl_label = "Vertex Colors"
250 def draw(self, context):
258 col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2)
260 col = row.column(align=True)
261 col.itemO("mesh.vertex_color_add", icon='ICON_ZOOMIN', text="")
262 col.itemO("mesh.vertex_color_remove", icon='ICON_ZOOMOUT', text="")
264 lay = me.active_vertex_color
266 layout.itemR(lay, "name")
268 bpy.types.register(DATA_PT_context_mesh)
269 bpy.types.register(DATA_PT_normals)
270 bpy.types.register(DATA_PT_settings)
271 bpy.types.register(DATA_PT_vertex_groups)
272 bpy.types.register(DATA_PT_shape_keys)
273 bpy.types.register(DATA_PT_uv_texture)
274 bpy.types.register(DATA_PT_vertex_colors)