Patch from William
[blender-staging.git] / release / ui / buttons_data_bone.py
1
2 import bpy
3  
4 class BoneButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "bone"
8         
9         def poll(self, context):
10                 return (context.bone or context.edit_bone)
11
12 class BONE_PT_context(BoneButtonsPanel):
13         __idname__ = "BONE_PT_context"
14         __label__ = " "
15
16         def draw(self, context):
17                 layout = self.layout
18                 bone = context.bone
19                 if not bone:
20                         bone = context.edit_bone
21                 
22                 split = layout.split(percentage=0.06)
23                 split.itemL(text="", icon="ICON_BONE_DATA")
24                 split.itemR(bone, "name", text="")
25
26 class BONE_PT_bone(BoneButtonsPanel):
27         __idname__ = "BONE_PT_bone"
28         __label__ = "Bone"
29
30
31         def draw(self, context):
32                 layout = self.layout
33                 bone = context.bone
34                 if not bone:
35                         bone = context.edit_bone
36
37                 split = layout.split()
38
39                 sub = split.column()
40                 sub.itemR(bone, "parent")
41                 sub.itemR(bone, "connected")
42
43                 sub.itemL(text="Layers:")
44                 sub.template_layers(bone, "layer")
45
46                 sub = split.column()
47
48                 sub.itemL(text="Inherit:")
49                 sub.itemR(bone, "hinge", text="Rotation")
50                 sub.itemR(bone, "inherit_scale", text="Scale")
51                 
52                 sub.itemL(text="Display:")
53                 sub.itemR(bone, "draw_wire", text="Wireframe")
54                 sub.itemR(bone, "hidden", text="Hide")
55
56
57                 
58 class BONE_PT_deform(BoneButtonsPanel):
59         __idname__ = "BONE_PT_deform"
60         __label__ = "Deform"
61
62         def draw_header(self, context):
63                 layout = self.layout
64                 bone = context.bone
65                 if not bone:
66                         bone = context.edit_bone
67                         
68                 layout.itemR(bone, "deform", text="")
69
70         def draw(self, context):
71                 layout = self.layout
72                 bone = context.bone
73                 if not bone:
74                         bone = context.edit_bone
75         
76                 layout.active = bone.deform
77                         
78                 split = layout.split()
79
80                 sub = split.column()
81                 sub.itemL(text="Envelope:")
82                 sub.itemR(bone, "envelope_distance", text="Distance")
83                 sub.itemR(bone, "envelope_weight", text="Weight")
84                 sub.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
85                 sub = split.column()
86                 
87                 sub.itemL(text="Curved Bones:")
88                 sub.itemR(bone, "bbone_segments", text="Segments")
89                 sub.itemR(bone, "bbone_in", text="Ease In")
90                 sub.itemR(bone, "bbone_out", text="Ease Out")
91                 
92                 sub.itemR(bone, "cyclic_offset")
93
94
95 bpy.types.register(BONE_PT_context)
96 bpy.types.register(BONE_PT_bone)
97 bpy.types.register(BONE_PT_deform)