4 class BoneButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
9 def poll(self, context):
10 return (context.bone or context.edit_bone)
12 class BONE_PT_context_bone(BoneButtonsPanel):
13 __idname__ = "BONE_PT_context_bone"
16 def draw(self, context):
20 bone = context.edit_bone
22 split = layout.split(percentage=0.06)
23 split.itemL(text="", icon="ICON_BONE_DATA")
24 split.itemR(bone, "name", text="")
26 class BONE_PT_transform(BoneButtonsPanel):
27 __idname__ = "BONE_PT_transform"
28 __label__ = "Transform"
30 def draw(self, context):
36 bone = context.edit_bone
39 row.column().itemR(bone, "head")
40 row.column().itemR(bone, "tail")
43 sub = col.column(align=True)
44 sub.itemL(text="Roll:")
45 sub.itemR(bone, "roll", text="")
47 sub.itemR(bone, "locked")
50 pchan = ob.pose.pose_channels[context.bone.name]
52 layout.itemR(pchan, "rotation_mode")
56 col.itemR(pchan, "location")
57 col.active = not (bone.parent and bone.connected)
60 if pchan.rotation_mode == 'QUATERNION':
61 col.itemR(pchan, "rotation", text="Rotation")
63 col.itemR(pchan, "euler_rotation", text="Rotation")
65 row.column().itemR(pchan, "scale")
67 if pchan.rotation_mode == 'QUATERNION':
68 col = layout.column(align=True)
69 col.itemL(text="Euler:")
70 col.row().itemR(pchan, "euler_rotation", text="")
72 class BONE_PT_bone(BoneButtonsPanel):
73 __idname__ = "BONE_PT_bone"
77 def draw(self, context):
80 arm = context.armature
82 bone = context.edit_bone
84 split = layout.split()
87 sub.itemL(text="Parent:")
89 sub.itemR(bone, "parent", text="")
91 sub.item_pointerR(bone, "parent", arm, "edit_bones", text="")
93 row.itemR(bone, "connected")
94 row.active = bone.parent != None
96 sub.itemL(text="Layers:")
97 sub.template_layers(bone, "layer")
101 sub.itemL(text="Inherit:")
102 sub.itemR(bone, "hinge", text="Rotation")
103 sub.itemR(bone, "inherit_scale", text="Scale")
105 sub.itemL(text="Display:")
106 sub.itemR(bone, "draw_wire", text="Wireframe")
107 sub.itemR(bone, "hidden", text="Hide")
109 class BONE_PT_deform(BoneButtonsPanel):
110 __idname__ = "BONE_PT_deform"
113 def draw_header(self, context):
117 bone = context.edit_bone
119 layout.itemR(bone, "deform", text="")
121 def draw(self, context):
125 bone = context.edit_bone
127 layout.active = bone.deform
129 split = layout.split()
132 col.itemL(text="Envelope:")
133 sub = col.column(align=True)
134 sub.itemR(bone, "envelope_distance", text="Distance")
135 sub.itemR(bone, "envelope_weight", text="Weight")
136 col.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
138 sub = col.column(align=True)
139 sub.itemL(text="Radius:")
140 sub.itemR(bone, "head_radius", text="Head")
141 sub.itemR(bone, "tail_radius", text="Tail")
144 col.itemL(text="Curved Bones:")
145 sub = col.column(align=True)
146 sub.itemR(bone, "bbone_segments", text="Segments")
147 sub.itemR(bone, "bbone_in", text="Ease In")
148 sub.itemR(bone, "bbone_out", text="Ease Out")
150 col.itemL(text="Offset:")
151 col.itemR(bone, "cyclic_offset")
153 bpy.types.register(BONE_PT_context_bone)
154 bpy.types.register(BONE_PT_transform)
155 bpy.types.register(BONE_PT_bone)
156 bpy.types.register(BONE_PT_deform)