adca70e90dd8b0e388f653fd1ec1d89b76433502
[blender.git] / release / ui / buttons_data_armature.py
1
2 import bpy
3  
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "data"
8         
9         def poll(self, context):
10                 return (context.armature != None)
11
12 class DATA_PT_context_arm(DataButtonsPanel):
13         __idname__ = "DATA_PT_context_arm"
14         __no_header__ = True
15         
16         def draw(self, context):
17                 layout = self.layout
18                 
19                 ob = context.object
20                 arm = context.armature
21                 space = context.space_data
22
23                 split = layout.split(percentage=0.65)
24
25                 if ob:
26                         split.template_ID(ob, "data")
27                         split.itemS()
28                 elif arm:
29                         split.template_ID(space, "pin_id")
30                         split.itemS()
31
32 class DATA_PT_skeleton(DataButtonsPanel):
33         __idname__ = "DATA_PT_skeleton"
34         __label__ = "Skeleton"
35         
36         def draw(self, context):
37                 layout = self.layout
38                 
39                 ob = context.object
40                 arm = context.armature
41                 space = context.space_data
42
43
44                 if arm:
45                         layout.itemR(arm, "rest_position")
46
47                         split = layout.split()
48
49                         sub = split.column()
50                         sub.itemL(text="Deform:")
51                         sub.itemR(arm, "deform_vertexgroups", text="Vertes Groups")
52                         sub.itemR(arm, "deform_envelope", text="Envelopes")
53                         sub.itemR(arm, "deform_quaternion", text="Quaternion")
54                         sub.itemR(arm, "deform_bbone_rest", text="B-Bones Rest")
55                         #sub.itemR(arm, "x_axis_mirror")
56                         #sub.itemR(arm, "auto_ik")
57                         
58                         sub = split.column()
59                         sub.itemL(text="Layers:")
60                         sub.template_layers(arm, "layer")
61                         sub.itemL(text="Protected Layers:")
62                         sub.template_layers(arm, "layer_protection")
63
64 class DATA_PT_display(DataButtonsPanel):
65         __idname__ = "DATA_PT_display"
66         __label__ = "Display"
67         
68         def draw(self, context):
69                 layout = self.layout
70                 arm = context.armature
71
72                 split = layout.split()
73
74                 sub = split.column()
75                 sub.itemR(arm, "drawtype", text="Style")
76                 sub.itemR(arm, "delay_deform", text="Delay Refresh")
77
78                 sub = split.column()
79                 sub.itemR(arm, "draw_names", text="Names")
80                 sub.itemR(arm, "draw_axes", text="Axes")
81                 sub.itemR(arm, "draw_custom_bone_shapes", text="Shapes")
82                 sub.itemR(arm, "draw_group_colors", text="Colors")
83
84 class DATA_PT_paths(DataButtonsPanel):
85         __idname__ = "DATA_PT_paths"
86         __label__ = "Paths"
87
88         def draw(self, context):
89                 layout = self.layout
90                 arm = context.armature
91
92                 split = layout.split()
93                 
94                 sub = split.column()
95                 sub.itemR(arm, "paths_show_around_current_frame", text="Around Frame")
96                 if (arm.paths_show_around_current_frame):
97                         sub.itemR(arm, "path_before_current", text="Before")
98                         sub.itemR(arm, "path_after_current", text="After")
99                 else:
100                         sub.itemR(arm, "path_start_frame", text="Start")
101                         sub.itemR(arm, "path_end_frame", text="End")
102
103                 sub.itemR(arm, "path_size", text="Step")        
104                 sub.itemR(arm, "paths_calculate_head_positions", text="Head")
105                 
106                 sub = split.column()
107                 sub.itemL(text="Show:")
108                 sub.itemR(arm, "paths_show_frame_numbers", text="Frame Numbers")
109                 sub.itemR(arm, "paths_highlight_keyframes", text="Keyframes")
110                 sub.itemR(arm, "paths_show_keyframe_numbers", text="Keyframe Numbers")
111
112 class DATA_PT_ghost(DataButtonsPanel):
113         __idname__ = "DATA_PT_ghost"
114         __label__ = "Ghost"
115
116         def draw(self, context):
117                 layout = self.layout
118                 arm = context.armature
119
120                 split = layout.split()
121
122                 sub = split.column()
123                 sub.itemR(arm, "ghost_type", text="Scope")
124                 if arm.ghost_type == 'RANGE':
125                         sub.itemR(arm, "ghost_start_frame", text="Start")
126                         sub.itemR(arm, "ghost_end_frame", text="End")
127                         sub.itemR(arm, "ghost_size", text="Step")
128                 elif arm.ghost_type == 'CURRENT_FRAME':
129                         sub.itemR(arm, "ghost_step", text="Range")
130                         sub.itemR(arm, "ghost_size", text="Step")
131
132                 sub = split.column()
133                 sub.itemR(arm, "ghost_only_selected", text="Selected Only")
134
135 bpy.types.register(DATA_PT_context_arm)
136 bpy.types.register(DATA_PT_skeleton)
137 bpy.types.register(DATA_PT_display)
138 bpy.types.register(DATA_PT_paths)
139 bpy.types.register(DATA_PT_ghost)