| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | # ##### BEGIN GPL LICENSE BLOCK ##### | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  | #  modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  | #  as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  | #  of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2009-11-03 07:23:02 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | #  This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | #  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | #  GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											2009-11-03 07:23:02 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | #  You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | #  along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  | #  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # ##### END GPL LICENSE BLOCK ##### | 
					
						
							| 
									
										
										
										
											2009-10-31 20:16:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | # <pep8 compliant> | 
					
						
							| 
									
										
										
										
											2009-05-21 21:23:36 +00:00
										 |  |  | import bpy | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-21 21:23:36 +00:00
										 |  |  | class DataButtonsPanel(bpy.types.Panel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_space_type = 'PROPERTIES' | 
					
						
							|  |  |  |     bl_region_type = 'WINDOW' | 
					
						
							|  |  |  |     bl_context = "data" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def poll(self, context): | 
					
						
							|  |  |  |         return context.mesh | 
					
						
							| 
									
										
										
										
											2009-05-21 21:23:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | class DATA_PT_context_mesh(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "" | 
					
						
							|  |  |  |     bl_show_header = False | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ob = context.object | 
					
						
							|  |  |  |         mesh = context.mesh | 
					
						
							|  |  |  |         space = context.space_data | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split(percentage=0.65) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ob: | 
					
						
							|  |  |  |             split.template_ID(ob, "data") | 
					
						
							|  |  |  |             split.itemS() | 
					
						
							|  |  |  |         elif mesh: | 
					
						
							|  |  |  |             split.template_ID(space, "pin_id") | 
					
						
							|  |  |  |             split.itemS() | 
					
						
							| 
									
										
										
										
											2009-06-07 13:36:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | class DATA_PT_normals(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Normals" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         mesh = context.mesh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(mesh, "autosmooth") | 
					
						
							|  |  |  |         sub = col.column() | 
					
						
							|  |  |  |         sub.active = mesh.autosmooth | 
					
						
							|  |  |  |         sub.itemR(mesh, "autosmooth_angle", text="Angle") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(mesh, "vertex_normal_flip") | 
					
						
							|  |  |  |         col.itemR(mesh, "double_sided") | 
					
						
							| 
									
										
										
										
											2009-08-06 23:34:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-07 09:23:29 +00:00
										 |  |  | class DATA_PT_settings(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Settings" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         mesh = context.mesh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(mesh, "texture_mesh") | 
					
						
							| 
									
										
										
										
											2009-10-07 09:23:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | class DATA_PT_vertex_groups(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Vertex Groups" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def poll(self, context): | 
					
						
							|  |  |  |         return (context.object and context.object.type in ('MESH', 'LATTICE')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ob = context.object | 
					
						
							|  |  |  |         group = ob.active_vertex_group | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         rows = 2 | 
					
						
							|  |  |  |         if group: | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  |             rows = 5 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         row = layout.row() | 
					
						
							|  |  |  |         row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = row.column(align=True) | 
					
						
							|  |  |  |         col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="") | 
					
						
							|  |  |  |         col.itemO("object.vertex_group_remove", icon='ICON_ZOOMOUT', text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col.itemO("object.vertex_group_copy", icon='ICON_COPY_ID', text="") | 
					
						
							|  |  |  |         if ob.data.users > 1: | 
					
						
							|  |  |  |             col.itemO("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if group: | 
					
						
							|  |  |  |             row = layout.row() | 
					
						
							|  |  |  |             row.itemR(group, "name") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0: | 
					
						
							|  |  |  |             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") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             layout.itemR(context.tool_settings, "vertex_group_weight", text="Weight") | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | class DATA_PT_shape_keys(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Shape Keys" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def poll(self, context): | 
					
						
							|  |  |  |         return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ob = context.object | 
					
						
							|  |  |  |         key = ob.data.shape_keys | 
					
						
							|  |  |  |         kb = ob.active_shape_key | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         enable_edit = ob.mode != 'EDIT' | 
					
						
							|  |  |  |         enable_edit_value = False | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ob.shape_key_lock == False: | 
					
						
							|  |  |  |             if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode): | 
					
						
							|  |  |  |                 enable_edit_value = True | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         row = layout.row() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         rows = 2 | 
					
						
							|  |  |  |         if kb: | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  |             rows = 5 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = row.column() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |         sub = col.column(align=True) | 
					
						
							|  |  |  |         sub.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="") | 
					
						
							|  |  |  |         sub.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         if kb: | 
					
						
							|  |  |  |             col.itemS() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |             sub = col.column(align=True) | 
					
						
							|  |  |  |             sub.item_enumO("object.shape_key_move", "type", 'UP', icon='ICON_TRIA_UP', text="") | 
					
						
							|  |  |  |             sub.item_enumO("object.shape_key_move", "type", 'DOWN', icon='ICON_TRIA_DOWN', text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             split = layout.split(percentage=0.4) | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |             row = split.row() | 
					
						
							|  |  |  |             row.enabled = enable_edit | 
					
						
							|  |  |  |             row.itemR(key, "relative") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |             row = split.row() | 
					
						
							|  |  |  |             row.alignment = 'RIGHT' | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |             sub = row.row(align=True) | 
					
						
							|  |  |  |             subsub = sub.row(align=True) | 
					
						
							|  |  |  |             subsub.active = enable_edit_value | 
					
						
							| 
									
										
										
										
											2009-11-02 13:20:14 +00:00
										 |  |  |             if ob.shape_key_lock: | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |                 subsub.itemR(ob, "shape_key_lock", icon='ICON_PINNED', text="") | 
					
						
							| 
									
										
										
										
											2009-11-02 13:20:14 +00:00
										 |  |  |             else: | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |                 subsub.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="") | 
					
						
							| 
									
										
										
										
											2009-11-02 13:20:14 +00:00
										 |  |  |             if kb.mute: | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |                 subsub.itemR(kb, "mute", icon='ICON_MUTE_IPO_ON', text="") | 
					
						
							| 
									
										
										
										
											2009-11-02 13:20:14 +00:00
										 |  |  |             else: | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |                 subsub.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="") | 
					
						
							|  |  |  |             sub.itemR(ob, "shape_key_edit_mode", text="") | 
					
						
							| 
									
										
										
										
											2009-11-07 22:07:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  |             sub = row.row(align=True) | 
					
						
							|  |  |  |             sub.itemO("object.shape_key_mirror", icon='ICON_ARROW_LEFTRIGHT', text="") | 
					
						
							|  |  |  |             sub.itemO("object.shape_key_clear", icon='ICON_X', text="") | 
					
						
							| 
									
										
										
										
											2009-11-07 22:07:46 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             row = layout.row() | 
					
						
							|  |  |  |             row.itemR(kb, "name") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if key.relative: | 
					
						
							|  |  |  |                 if ob.active_shape_key_index != 0: | 
					
						
							|  |  |  |                     row = layout.row() | 
					
						
							|  |  |  |                     row.active = enable_edit_value | 
					
						
							|  |  |  |                     row.itemR(kb, "value") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     split = layout.split() | 
					
						
							| 
									
										
										
										
											2009-11-08 11:07:00 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                     col = split.column(align=True) | 
					
						
							|  |  |  |                     col.active = enable_edit_value | 
					
						
							|  |  |  |                     col.itemL(text="Range:") | 
					
						
							|  |  |  |                     col.itemR(kb, "slider_min", text="Min") | 
					
						
							|  |  |  |                     col.itemR(kb, "slider_max", text="Max") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     col = split.column(align=True) | 
					
						
							|  |  |  |                     col.active = enable_edit_value | 
					
						
							|  |  |  |                     col.itemL(text="Blend:") | 
					
						
							|  |  |  |                     col.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="") | 
					
						
							|  |  |  |                     col.item_pointerR(kb, "relative_key", key, "keys", text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             else: | 
					
						
							|  |  |  |                 row = layout.row() | 
					
						
							|  |  |  |                 row.active = enable_edit_value | 
					
						
							|  |  |  |                 row.itemR(key, "slurph") | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | class DATA_PT_uv_texture(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "UV Texture" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         me = context.mesh | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         row = layout.row() | 
					
						
							|  |  |  |         col = row.column() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col.template_list(me, "uv_textures", me, "active_uv_texture_index", rows=2) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = row.column(align=True) | 
					
						
							|  |  |  |         col.itemO("mesh.uv_texture_add", icon='ICON_ZOOMIN', text="") | 
					
						
							|  |  |  |         col.itemO("mesh.uv_texture_remove", icon='ICON_ZOOMOUT', text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         lay = me.active_uv_texture | 
					
						
							|  |  |  |         if lay: | 
					
						
							|  |  |  |             layout.itemR(lay, "name") | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | class DATA_PT_vertex_colors(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Vertex Colors" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         me = context.mesh | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         row = layout.row() | 
					
						
							|  |  |  |         col = row.column() | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         col.template_list(me, "vertex_colors", me, "active_vertex_color_index", rows=2) | 
					
						
							| 
									
										
										
										
											2009-07-01 22:25:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         col = row.column(align=True) | 
					
						
							|  |  |  |         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-10-31 19:31:45 +00:00
										 |  |  |         lay = me.active_vertex_color | 
					
						
							|  |  |  |         if lay: | 
					
						
							|  |  |  |             layout.itemR(lay, "name") | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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-10-07 09:23:29 +00:00
										 |  |  | bpy.types.register(DATA_PT_settings) | 
					
						
							| 
									
										
										
										
											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) |