| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | import bpy | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2009-05-28 23:45:50 +00:00
										 |  |  | class BoneButtonsPanel(bpy.types.Panel): | 
					
						
							| 
									
										
										
										
											2009-08-22 08:48:01 +00:00
										 |  |  | 	__space_type__ = 'PROPERTIES' | 
					
						
							|  |  |  | 	__region_type__ = 'WINDOW' | 
					
						
							| 
									
										
										
										
											2009-05-20 02:17:53 +00:00
										 |  |  | 	__context__ = "bone" | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							| 
									
										
										
										
											2009-06-19 14:56:49 +00:00
										 |  |  | 		return (context.bone or context.edit_bone) | 
					
						
							| 
									
										
										
										
											2009-05-20 02:17:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | class BONE_PT_context_bone(BoneButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-07-26 03:54:17 +00:00
										 |  |  | 	__show_header__ = False | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 		bone = context.bone | 
					
						
							|  |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | 		row = layout.row() | 
					
						
							| 
									
										
										
										
											2009-08-22 08:48:01 +00:00
										 |  |  | 		row.itemL(text="", icon='ICON_BONE_DATA') | 
					
						
							| 
									
										
										
										
											2009-07-21 00:55:20 +00:00
										 |  |  | 		row.itemR(bone, "name", text="") | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | class BONE_PT_transform(BoneButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-07-14 12:32:19 +00:00
										 |  |  | 	__label__ = "Transform" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		ob = context.object | 
					
						
							| 
									
										
										
										
											2009-07-14 12:32:19 +00:00
										 |  |  | 		bone = context.bone | 
					
						
							|  |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 			row = layout.row() | 
					
						
							|  |  |  | 			row.column().itemR(bone, "head") | 
					
						
							|  |  |  | 			row.column().itemR(bone, "tail") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			col = row.column() | 
					
						
							|  |  |  | 			sub = col.column(align=True) | 
					
						
							|  |  |  | 			sub.itemL(text="Roll:") | 
					
						
							|  |  |  | 			sub.itemR(bone, "roll", text="") | 
					
						
							|  |  |  | 			sub.itemL() | 
					
						
							|  |  |  | 			sub.itemR(bone, "locked") | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		else: | 
					
						
							|  |  |  | 			pchan = ob.pose.pose_channels[context.bone.name] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			row = layout.row() | 
					
						
							|  |  |  | 			col = row.column() | 
					
						
							|  |  |  | 			col.itemR(pchan, "location") | 
					
						
							|  |  |  | 			col.active = not (bone.parent and bone.connected) | 
					
						
							| 
									
										
										
										
											2009-07-14 12:32:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 			col = row.column() | 
					
						
							|  |  |  | 			if pchan.rotation_mode == 'QUATERNION': | 
					
						
							| 
									
										
										
										
											2009-09-28 10:19:20 +00:00
										 |  |  | 				col.itemR(pchan, "rotation_quaternion", text="Rotation") | 
					
						
							| 
									
										
										
										
											2009-09-11 12:05:09 +00:00
										 |  |  | 			elif pchan.rotation_mode == 'AXIS_ANGLE': | 
					
						
							| 
									
										
										
										
											2009-09-28 10:19:20 +00:00
										 |  |  | 				#col.itemL(text="Rotation") | 
					
						
							|  |  |  | 				#col.itemR(pchan, "rotation_angle", text="Angle") | 
					
						
							|  |  |  | 				#col.itemR(pchan, "rotation_axis", text="Axis") | 
					
						
							|  |  |  | 				col.itemR(pchan, "rotation_axis_angle", text="Rotation") | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 			else: | 
					
						
							| 
									
										
										
										
											2009-09-28 10:19:20 +00:00
										 |  |  | 				col.itemR(pchan, "rotation_euler", text="Rotation") | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			row.column().itemR(pchan, "scale") | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			layout.itemR(pchan, "rotation_mode") | 
					
						
							| 
									
										
										
										
											2009-09-12 12:30:23 +00:00
										 |  |  | 				 | 
					
						
							|  |  |  | class BONE_PT_transform_locks(BoneButtonsPanel): | 
					
						
							|  |  |  | 	__label__ = "Transform Locks" | 
					
						
							| 
									
										
										
										
											2009-09-19 19:40:38 +00:00
										 |  |  | 	__default_closed__ = True | 
					
						
							| 
									
										
										
										
											2009-09-12 12:30:23 +00:00
										 |  |  | 	 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							|  |  |  | 		return context.bone | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		ob = context.object | 
					
						
							|  |  |  | 		bone = context.bone | 
					
						
							|  |  |  | 		pchan = ob.pose.pose_channels[context.bone.name] | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row = layout.row() | 
					
						
							|  |  |  | 		col = row.column() | 
					
						
							|  |  |  | 		col.itemR(pchan, "lock_location") | 
					
						
							|  |  |  | 		col.active = not (bone.parent and bone.connected) | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		col = row.column() | 
					
						
							|  |  |  | 		if pchan.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'): | 
					
						
							|  |  |  | 			col.itemR(pchan, "lock_rotations_4d", text="Lock Rotation") | 
					
						
							|  |  |  | 			if pchan.lock_rotations_4d: | 
					
						
							|  |  |  | 				col.itemR(pchan, "lock_rotation_w", text="W") | 
					
						
							|  |  |  | 			col.itemR(pchan, "lock_rotation", text="") | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			col.itemR(pchan, "lock_rotation", text="Rotation") | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		row.column().itemR(pchan, "lock_scale") | 
					
						
							| 
									
										
										
										
											2009-07-14 12:32:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | class BONE_PT_relations(BoneButtonsPanel): | 
					
						
							|  |  |  | 	__label__ = "Relations" | 
					
						
							| 
									
										
										
										
											2009-05-20 02:17:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		ob = context.object | 
					
						
							| 
									
										
										
										
											2009-06-13 21:22:21 +00:00
										 |  |  | 		bone = context.bone | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-09-01 00:33:39 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-06-19 14:56:49 +00:00
										 |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							| 
									
										
										
										
											2009-09-03 12:20:59 +00:00
										 |  |  | 			pchan = None | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		else: | 
					
						
							|  |  |  | 			pchan = ob.pose.pose_channels[context.bone.name] | 
					
						
							| 
									
										
										
										
											2009-05-20 02:17:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		split = layout.split() | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Layers:") | 
					
						
							|  |  |  | 		col.itemR(bone, "layer", text="") | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		col.itemS() | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		if ob and pchan: | 
					
						
							|  |  |  | 			col.itemL(text="Bone Group:") | 
					
						
							|  |  |  | 			col.item_pointerR(pchan, "bone_group", ob.pose, "bone_groups", text="") | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Parent:") | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		if context.bone: | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 			col.itemR(bone, "parent", text="") | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		else: | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 			col.item_pointerR(bone, "parent", arm, "edit_bones", text="") | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 		sub = col.column() | 
					
						
							|  |  |  | 		sub.active = bone.parent != None | 
					
						
							|  |  |  | 		sub.itemR(bone, "connected") | 
					
						
							|  |  |  | 		sub.itemR(bone, "hinge", text="Inherit Rotation") | 
					
						
							|  |  |  | 		sub.itemR(bone, "inherit_scale", text="Inherit Scale") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | class BONE_PT_display(BoneButtonsPanel): | 
					
						
							|  |  |  | 	__label__ = "Display" | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	def poll(self, context): | 
					
						
							|  |  |  | 		return context.bone | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 		ob = context.object | 
					
						
							|  |  |  | 		bone = context.bone | 
					
						
							|  |  |  | 		arm = context.armature | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							|  |  |  | 			pchan = None | 
					
						
							|  |  |  | 		else: | 
					
						
							|  |  |  | 			pchan = ob.pose.pose_channels[context.bone.name] | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 		 | 
					
						
							|  |  |  | 		if ob and pchan: | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 			split = layout.split() | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 			col = split.column() | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			col.itemR(bone, "draw_wire", text="Wireframe") | 
					
						
							|  |  |  | 			col.itemR(bone, "hidden", text="Hide") | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 			 | 
					
						
							|  |  |  | 			col = split.column() | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-08-23 12:53:55 +00:00
										 |  |  | 			col.itemL(text="Custom Shape:") | 
					
						
							|  |  |  | 			col.itemR(pchan, "custom_shape", text="") | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | class BONE_PT_deform(BoneButtonsPanel): | 
					
						
							|  |  |  | 	__label__ = "Deform" | 
					
						
							| 
									
										
										
										
											2009-07-14 22:11:25 +00:00
										 |  |  | 	__default_closed__ = True | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def draw_header(self, context): | 
					
						
							|  |  |  | 		bone = context.bone | 
					
						
							| 
									
										
										
										
											2009-09-01 00:33:39 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							|  |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-09-01 00:33:39 +00:00
										 |  |  | 		self.layout.itemR(bone, "deform", text="") | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	def draw(self, context): | 
					
						
							|  |  |  | 		layout = self.layout | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 		bone = context.bone | 
					
						
							| 
									
										
										
										
											2009-09-01 00:33:39 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 		if not bone: | 
					
						
							|  |  |  | 			bone = context.edit_bone | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  | 		layout.active = bone.deform | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 		split = layout.split() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Envelope:") | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		sub = col.column(align=True) | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 		sub.itemR(bone, "envelope_distance", text="Distance") | 
					
						
							|  |  |  | 		sub.itemR(bone, "envelope_weight", text="Weight") | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		col.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		sub = col.column(align=True) | 
					
						
							|  |  |  | 		sub.itemL(text="Radius:") | 
					
						
							|  |  |  | 		sub.itemR(bone, "head_radius", text="Head") | 
					
						
							|  |  |  | 		sub.itemR(bone, "tail_radius", text="Tail") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		col = split.column() | 
					
						
							|  |  |  | 		col.itemL(text="Curved Bones:") | 
					
						
							| 
									
										
										
										
											2009-07-27 20:39:10 +00:00
										 |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		sub = col.column(align=True) | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 		sub.itemR(bone, "bbone_segments", text="Segments") | 
					
						
							|  |  |  | 		sub.itemR(bone, "bbone_in", text="Ease In") | 
					
						
							|  |  |  | 		sub.itemR(bone, "bbone_out", text="Ease Out") | 
					
						
							|  |  |  | 		 | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | 		col.itemL(text="Offset:") | 
					
						
							|  |  |  | 		col.itemR(bone, "cyclic_offset") | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-19 15:38:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | bpy.types.register(BONE_PT_context_bone) | 
					
						
							| 
									
										
										
										
											2009-07-14 17:59:26 +00:00
										 |  |  | bpy.types.register(BONE_PT_transform) | 
					
						
							| 
									
										
										
										
											2009-09-12 12:30:23 +00:00
										 |  |  | bpy.types.register(BONE_PT_transform_locks) | 
					
						
							| 
									
										
										
										
											2009-10-03 11:19:14 +00:00
										 |  |  | bpy.types.register(BONE_PT_relations) | 
					
						
							|  |  |  | bpy.types.register(BONE_PT_display) | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | bpy.types.register(BONE_PT_deform) |