2ebb4bf2f608c9836ebb3d24cc44d1a7fcb45ab5
[blender.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_bone(BoneButtonsPanel):
13         __idname__ = "BONE_PT_context_bone"
14         __no_header__ = True
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_transform_bone(BoneButtonsPanel):
27         __idname__ = "BONE_PT_transform_bone"
28         __label__ = "Transform"
29
30         def draw(self, context):
31                 layout = self.layout
32                 bone = context.bone
33                 if not bone:
34                         bone = context.edit_bone
35
36 #Seems to be missing from RNA?
37                 row = layout.row()
38                 row.column().itemR(bone, "location")
39                 row.column().itemR(bone, "rotation")
40                 row.column().itemR(bone, "scale")
41
42
43 class BONE_PT_bone(BoneButtonsPanel):
44         __idname__ = "BONE_PT_bone"
45         __label__ = "Bone"
46
47
48         def draw(self, context):
49                 layout = self.layout
50                 bone = context.bone
51                 if not bone:
52                         bone = context.edit_bone
53
54                 split = layout.split()
55
56                 sub = split.column()
57                 sub.itemR(bone, "parent")
58                 sub.itemR(bone, "connected")
59
60                 sub.itemL(text="Layers:")
61                 sub.template_layers(bone, "layer")
62
63                 sub = split.column()
64
65                 sub.itemL(text="Inherit:")
66                 sub.itemR(bone, "hinge", text="Rotation")
67                 sub.itemR(bone, "inherit_scale", text="Scale")
68                 
69                 sub.itemL(text="Display:")
70                 sub.itemR(bone, "draw_wire", text="Wireframe")
71                 sub.itemR(bone, "hidden", text="Hide")
72
73
74                 
75 class BONE_PT_deform(BoneButtonsPanel):
76         __idname__ = "BONE_PT_deform"
77         __label__ = "Deform"
78
79         def draw_header(self, context):
80                 layout = self.layout
81                 bone = context.bone
82                 if not bone:
83                         bone = context.edit_bone
84                         
85                 layout.itemR(bone, "deform", text="")
86
87         def draw(self, context):
88                 layout = self.layout
89                 bone = context.bone
90                 if not bone:
91                         bone = context.edit_bone
92         
93                 layout.active = bone.deform
94                         
95                 split = layout.split()
96
97                 sub = split.column()
98                 sub.itemL(text="Envelope:")
99                 sub.itemR(bone, "envelope_distance", text="Distance")
100                 sub.itemR(bone, "envelope_weight", text="Weight")
101                 sub.itemR(bone, "multiply_vertexgroup_with_envelope", text="Multiply")
102                 sub = split.column()
103                 
104                 sub.itemL(text="Curved Bones:")
105                 sub.itemR(bone, "bbone_segments", text="Segments")
106                 sub.itemR(bone, "bbone_in", text="Ease In")
107                 sub.itemR(bone, "bbone_out", text="Ease Out")
108                 
109                 sub.itemR(bone, "cyclic_offset")
110
111
112 bpy.types.register(BONE_PT_context_bone)
113 bpy.types.register(BONE_PT_transform_bone)
114 bpy.types.register(BONE_PT_bone)
115 bpy.types.register(BONE_PT_deform)