| 
									
										
										
										
											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-19 15:38:36 +00:00
										 |  |  | import bpy | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  | narrowui = 180 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-14 13:35:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38: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.armature | 
					
						
							| 
									
										
										
										
											2009-05-20 02:17:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | class DATA_PT_context_arm(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 | 
					
						
							|  |  |  |         arm = context.armature | 
					
						
							|  |  |  |         space = context.space_data | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-11-14 13:35:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             split = layout.split(percentage=0.65) | 
					
						
							|  |  |  |             if ob: | 
					
						
							|  |  |  |                 split.template_ID(ob, "data") | 
					
						
							|  |  |  |                 split.itemS() | 
					
						
							|  |  |  |             elif arm: | 
					
						
							|  |  |  |                 split.template_ID(space, "pin_id") | 
					
						
							|  |  |  |                 split.itemS() | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             layout.template_ID(ob, "data") | 
					
						
							| 
									
										
										
										
											2009-06-07 13:36:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | class DATA_PT_skeleton(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Skeleton" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         layout.itemR(arm, "pose_position", expand=True) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemL(text="Layers:") | 
					
						
							|  |  |  |         col.itemR(arm, "layer", text="") | 
					
						
							|  |  |  |         col.itemL(text="Protected Layers:") | 
					
						
							|  |  |  |         col.itemR(arm, "layer_protection", text="") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             col = split.column() | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         col.itemL(text="Deform:") | 
					
						
							|  |  |  |         col.itemR(arm, "deform_vertexgroups", text="Vertex Groups") | 
					
						
							|  |  |  |         col.itemR(arm, "deform_envelope", text="Envelopes") | 
					
						
							|  |  |  |         col.itemR(arm, "deform_quaternion", text="Quaternion") | 
					
						
							|  |  |  |         col.itemR(arm, "deform_bbone_rest", text="B-Bones Rest") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | class DATA_PT_display(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Display" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             layout.row().itemR(arm, "drawtype", expand=True) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             layout.row().itemR(arm, "drawtype", text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(arm, "draw_names", text="Names") | 
					
						
							|  |  |  |         col.itemR(arm, "draw_axes", text="Axes") | 
					
						
							|  |  |  |         col.itemR(arm, "draw_custom_bone_shapes", text="Shapes") | 
					
						
							| 
									
										
										
										
											2009-11-14 13:35:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             col = split.column() | 
					
						
							|  |  |  |         col.itemR(arm, "draw_group_colors", text="Colors") | 
					
						
							|  |  |  |         col.itemR(arm, "delay_deform", text="Delay Refresh") | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-21 10:18:08 +00:00
										 |  |  | class DATA_PT_bone_groups(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Bone Groups" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def poll(self, context): | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  |         return (context.object and context.object.type == 'ARMATURE' and context.object.pose) | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ob = context.object | 
					
						
							|  |  |  |         pose = ob.pose | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         row = layout.row() | 
					
						
							|  |  |  |         row.template_list(pose, "bone_groups", pose, "active_bone_group_index", rows=2) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = row.column(align=True) | 
					
						
							|  |  |  |         col.active = (ob.proxy == None) | 
					
						
							|  |  |  |         col.itemO("pose.group_add", icon='ICON_ZOOMIN', text="") | 
					
						
							|  |  |  |         col.itemO("pose.group_remove", icon='ICON_ZOOMOUT', text="") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         group = pose.active_bone_group | 
					
						
							|  |  |  |         if group: | 
					
						
							|  |  |  |             col = layout.column() | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  |             col.active = (ob.proxy == None) | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |             col.itemR(group, "name") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |             split = layout.split() | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  |             split.active = (ob.proxy == None) | 
					
						
							| 
									
										
										
										
											2009-11-14 13:35:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |             col = split.column() | 
					
						
							|  |  |  |             col.itemR(group, "color_set") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |             if group.color_set: | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |                 if col2: | 
					
						
							|  |  |  |                     col = split.column() | 
					
						
							|  |  |  |                 col.template_triColorSet(group, "colors") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         row = layout.row(align=True) | 
					
						
							|  |  |  |         row.active = (ob.proxy == None) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         row.itemO("pose.group_assign", text="Assign") | 
					
						
							|  |  |  |         row.itemO("pose.group_remove", text="Remove") #row.itemO("pose.bone_group_remove_from", text="Remove") | 
					
						
							|  |  |  |         #row.itemO("object.bone_group_select", text="Select") | 
					
						
							|  |  |  |         #row.itemO("object.bone_group_deselect", text="Deselect") | 
					
						
							| 
									
										
										
										
											2009-07-21 10:18:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | class DATA_PT_paths(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Paths" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             layout.itemR(arm, "paths_type", expand=True) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             layout.itemR(arm, "paths_type", text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         sub = col.column(align=True) | 
					
						
							|  |  |  |         if (arm.paths_type == 'CURRENT_FRAME'): | 
					
						
							|  |  |  |             sub.itemR(arm, "path_before_current", text="Before") | 
					
						
							|  |  |  |             sub.itemR(arm, "path_after_current", text="After") | 
					
						
							|  |  |  |         elif (arm.paths_type == 'RANGE'): | 
					
						
							|  |  |  |             sub.itemR(arm, "path_start_frame", text="Start") | 
					
						
							|  |  |  |             sub.itemR(arm, "path_end_frame", text="End") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         sub.itemR(arm, "path_size", text="Step") | 
					
						
							|  |  |  |         col.row().itemR(arm, "paths_location", expand=True) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             col = split.column() | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         col.itemL(text="Display:") | 
					
						
							|  |  |  |         col.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers") | 
					
						
							|  |  |  |         col.itemR(arm, "paths_highlight_keyframes", text="Keyframes") | 
					
						
							|  |  |  |         col.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         layout.itemS() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemO("pose.paths_calculate", text="Calculate Paths") | 
					
						
							| 
									
										
										
										
											2009-11-14 13:35:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             col = split.column() | 
					
						
							|  |  |  |         col.itemO("pose.paths_clear", text="Clear Paths") | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | class DATA_PT_ghost(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Ghost" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         col2 = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             layout.itemR(arm, "ghost_type", expand=True) | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             layout.itemR(arm, "ghost_type", text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         sub = col.column(align=True) | 
					
						
							|  |  |  |         if arm.ghost_type == 'RANGE': | 
					
						
							|  |  |  |             sub.itemR(arm, "ghost_start_frame", text="Start") | 
					
						
							|  |  |  |             sub.itemR(arm, "ghost_end_frame", text="End") | 
					
						
							|  |  |  |             sub.itemR(arm, "ghost_size", text="Step") | 
					
						
							|  |  |  |         elif arm.ghost_type == 'CURRENT_FRAME': | 
					
						
							|  |  |  |             sub.itemR(arm, "ghost_step", text="Range") | 
					
						
							|  |  |  |             sub.itemR(arm, "ghost_size", text="Step") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-12 21:44:35 +00:00
										 |  |  |         if col2: | 
					
						
							|  |  |  |             col = split.column() | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |         col.itemL(text="Display:") | 
					
						
							|  |  |  |         col.itemR(arm, "ghost_only_selected", text="Selected Only") | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | bpy.types.register(DATA_PT_context_arm) | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | bpy.types.register(DATA_PT_skeleton) | 
					
						
							|  |  |  | bpy.types.register(DATA_PT_display) | 
					
						
							| 
									
										
										
										
											2009-07-21 10:18:08 +00:00
										 |  |  | bpy.types.register(DATA_PT_bone_groups) | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | bpy.types.register(DATA_PT_paths) | 
					
						
							| 
									
										
										
										
											2009-06-18 14:20:25 +00:00
										 |  |  | bpy.types.register(DATA_PT_ghost) |