2009-05-19 15:38:36 +00:00
|
|
|
|
|
|
|
import bpy
|
|
|
|
|
2009-05-28 23:45:50 +00:00
|
|
|
class BoneButtonsPanel(bpy.types.Panel):
|
2009-05-20 02:17:53 +00:00
|
|
|
__space_type__ = "BUTTONS_WINDOW"
|
|
|
|
__region_type__ = "WINDOW"
|
|
|
|
__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):
|
|
|
|
__idname__ = "BONE_PT_context_bone"
|
2009-07-09 19:45:27 +00:00
|
|
|
__no_header__ = True
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
bone = context.bone
|
|
|
|
if not bone:
|
|
|
|
bone = context.edit_bone
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.06)
|
|
|
|
split.itemL(text="", icon="ICON_BONE_DATA")
|
|
|
|
split.itemR(bone, "name", text="")
|
|
|
|
|
2009-07-14 17:59:26 +00:00
|
|
|
class BONE_PT_transform(BoneButtonsPanel):
|
|
|
|
__idname__ = "BONE_PT_transform"
|
2009-07-14 12:32:19 +00:00
|
|
|
__label__ = "Transform"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-07-14 17:59:26 +00:00
|
|
|
ob = context.object
|
2009-07-14 12:32:19 +00:00
|
|
|
bone = context.bone
|
2009-07-14 17:59:26 +00:00
|
|
|
|
2009-07-14 12:32:19 +00:00
|
|
|
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")
|
|
|
|
sub.itemS()
|
|
|
|
else:
|
|
|
|
pchan = ob.pose.pose_channels[context.bone.name]
|
|
|
|
|
|
|
|
layout.itemR(pchan, "rotation_mode")
|
|
|
|
|
|
|
|
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':
|
|
|
|
col.itemR(pchan, "rotation", text="Rotation")
|
|
|
|
else:
|
|
|
|
col.itemR(pchan, "euler_rotation", text="Rotation")
|
|
|
|
|
|
|
|
row.column().itemR(pchan, "scale")
|
|
|
|
|
|
|
|
if pchan.rotation_mode == 'QUATERNION':
|
|
|
|
col = layout.column(align=True)
|
|
|
|
col.itemL(text="Euler:")
|
|
|
|
col.row().itemR(pchan, "euler_rotation", text="")
|
2009-07-14 12:32:19 +00:00
|
|
|
|
2009-05-28 23:45:50 +00:00
|
|
|
class BONE_PT_bone(BoneButtonsPanel):
|
|
|
|
__idname__ = "BONE_PT_bone"
|
2009-05-20 02:17:53 +00:00
|
|
|
__label__ = "Bone"
|
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
|
2009-05-20 02:17:53 +00:00
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2009-06-13 21:22:21 +00:00
|
|
|
bone = context.bone
|
2009-07-14 17:59:26 +00:00
|
|
|
arm = context.armature
|
2009-06-19 14:56:49 +00:00
|
|
|
if not bone:
|
|
|
|
bone = context.edit_bone
|
2009-05-20 02:17:53 +00:00
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
|
2009-05-19 15:38:36 +00:00
|
|
|
sub = split.column()
|
2009-07-14 17:59:26 +00:00
|
|
|
sub.itemL(text="Parent:")
|
|
|
|
if context.bone:
|
|
|
|
sub.itemR(bone, "parent", text="")
|
|
|
|
else:
|
|
|
|
sub.item_pointerR(bone, "parent", arm, "edit_bones", text="")
|
|
|
|
row = sub.row()
|
|
|
|
row.itemR(bone, "connected")
|
|
|
|
row.active = bone.parent != None
|
2009-07-09 09:07:25 +00:00
|
|
|
|
|
|
|
sub.itemL(text="Layers:")
|
|
|
|
sub.template_layers(bone, "layer")
|
|
|
|
|
|
|
|
sub = split.column()
|
2009-05-19 15:38:36 +00:00
|
|
|
|
|
|
|
sub.itemL(text="Inherit:")
|
2009-07-09 09:07:25 +00:00
|
|
|
sub.itemR(bone, "hinge", text="Rotation")
|
|
|
|
sub.itemR(bone, "inherit_scale", text="Scale")
|
|
|
|
|
|
|
|
sub.itemL(text="Display:")
|
|
|
|
sub.itemR(bone, "draw_wire", text="Wireframe")
|
|
|
|
sub.itemR(bone, "hidden", text="Hide")
|
|
|
|
|
2009-07-14 22:11:25 +00:00
|
|
|
class BONE_PT_inverse_kinematics(BoneButtonsPanel):
|
|
|
|
__idname__ = "BONE_PT_inverse_kinematics"
|
|
|
|
__label__ = "Inverse Kinematics"
|
|
|
|
__default_closed__ = True
|
|
|
|
|
|
|
|
def poll(self, context):
|
|
|
|
ob = context.object
|
|
|
|
bone = context.bone
|
|
|
|
|
|
|
|
if ob and context.bone:
|
|
|
|
pchan = ob.pose.pose_channels[context.bone.name]
|
|
|
|
return pchan.has_ik
|
|
|
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
ob = context.object
|
|
|
|
bone = context.bone
|
|
|
|
pchan = ob.pose.pose_channels[context.bone.name]
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
split.itemR(pchan, "ik_dof_x", text="X")
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_stiffness_x", text="Stiffness")
|
|
|
|
row.active = pchan.ik_dof_x
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_limit_x", text="Limit")
|
|
|
|
row.active = pchan.ik_dof_x
|
|
|
|
row = split.row(align=True)
|
|
|
|
row.itemR(pchan, "ik_min_x", text="")
|
|
|
|
row.itemR(pchan, "ik_max_x", text="")
|
|
|
|
row.active = pchan.ik_dof_x and pchan.ik_limit_x
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
split.itemR(pchan, "ik_dof_y", text="Y")
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_stiffness_y", text="Stiffness")
|
|
|
|
row.active = pchan.ik_dof_y
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_limit_y", text="Limit")
|
|
|
|
row.active = pchan.ik_dof_y
|
|
|
|
row = split.row(align=True)
|
|
|
|
row.itemR(pchan, "ik_min_y", text="")
|
|
|
|
row.itemR(pchan, "ik_max_y", text="")
|
|
|
|
row.active = pchan.ik_dof_y and pchan.ik_limit_y
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
split.itemR(pchan, "ik_dof_z", text="Z")
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_stiffness_z", text="Stiffness")
|
|
|
|
row.active = pchan.ik_dof_z
|
|
|
|
|
|
|
|
split = layout.split(percentage=0.25)
|
|
|
|
row = split.row()
|
|
|
|
row.itemR(pchan, "ik_limit_z", text="Limit")
|
|
|
|
row.active = pchan.ik_dof_z
|
|
|
|
row = split.row(align=True)
|
|
|
|
row.itemR(pchan, "ik_min_z", text="")
|
|
|
|
row.itemR(pchan, "ik_max_z", text="")
|
|
|
|
row.active = pchan.ik_dof_z and pchan.ik_limit_z
|
|
|
|
|
|
|
|
split = layout.split()
|
|
|
|
split.itemR(pchan, "ik_stretch", text="Stretch")
|
|
|
|
split.itemL()
|
|
|
|
|
2009-07-09 09:07:25 +00:00
|
|
|
class BONE_PT_deform(BoneButtonsPanel):
|
|
|
|
__idname__ = "BONE_PT_deform"
|
|
|
|
__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):
|
|
|
|
layout = self.layout
|
|
|
|
bone = context.bone
|
|
|
|
if not bone:
|
|
|
|
bone = context.edit_bone
|
|
|
|
|
|
|
|
layout.itemR(bone, "deform", text="")
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
bone = context.bone
|
|
|
|
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:")
|
|
|
|
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:")
|
|
|
|
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-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-06-19 14:56:49 +00:00
|
|
|
bpy.types.register(BONE_PT_bone)
|
2009-07-09 09:07:25 +00:00
|
|
|
bpy.types.register(BONE_PT_deform)
|
2009-07-14 22:11:25 +00:00
|
|
|
bpy.types.register(BONE_PT_inverse_kinematics)
|
2009-07-14 17:59:26 +00:00
|
|
|
|