pep8 compliance cleanups.
[blender.git] / release / scripts / ui / space_graph.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21
22
23 class GRAPH_HT_header(bpy.types.Header):
24     bl_space_type = 'GRAPH_EDITOR'
25
26     def draw(self, context):
27         layout = self.layout
28
29         st = context.space_data
30
31         row = layout.row(align=True)
32         row.template_header()
33
34         if context.area.show_menus:
35             sub = row.row(align=True)
36
37             sub.menu("GRAPH_MT_view")
38             sub.menu("GRAPH_MT_select")
39             sub.menu("GRAPH_MT_channel")
40             sub.menu("GRAPH_MT_key")
41
42         layout.prop(st, "mode", text="")
43
44         layout.template_dopesheet_filter(st.dopesheet)
45
46         layout.prop(st, "autosnap", text="")
47         layout.prop(st, "pivot_point", text="", icon_only=True)
48
49         row = layout.row(align=True)
50         row.operator("graph.copy", text="", icon='ICON_COPYDOWN')
51         row.operator("graph.paste", text="", icon='ICON_PASTEDOWN')
52
53         row = layout.row(align=True)
54         # these likely need new icons
55         row.operator("graph.ghost_curves_create", text="", icon='ICON_GHOST_ENABLED')
56         row.operator("graph.ghost_curves_clear", text="", icon='ICON_GHOST_DISABLED')
57
58
59 class GRAPH_MT_view(bpy.types.Menu):
60     bl_label = "View"
61
62     def draw(self, context):
63         layout = self.layout
64
65         st = context.space_data
66
67         layout.column()
68
69         layout.separator()
70         layout.operator("graph.properties")
71
72         layout.prop(st, "show_cframe_indicator")
73         layout.prop(st, "show_cursor")
74         layout.prop(st, "show_sliders")
75         layout.prop(st, "automerge_keyframes")
76
77         layout.separator()
78         layout.operator("graph.handles_view_toggle")
79         layout.prop(st, "only_selected_curves_handles")
80         layout.prop(st, "only_selected_keyframe_handles")
81         layout.operator("anim.time_toggle")
82
83         layout.separator()
84         layout.operator("anim.previewrange_set")
85         layout.operator("anim.previewrange_clear")
86         layout.operator("graph.previewrange_set")
87
88         layout.separator()
89         layout.operator("graph.frame_jump")
90         layout.operator("graph.view_all")
91
92         layout.separator()
93         layout.operator("screen.area_dupli")
94         layout.operator("screen.screen_full_area")
95
96
97 class GRAPH_MT_select(bpy.types.Menu):
98     bl_label = "Select"
99
100     def draw(self, context):
101         layout = self.layout
102
103         layout.column()
104         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
105         layout.operator("graph.select_all_toggle")
106         layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
107
108         layout.separator()
109         layout.operator("graph.select_border")
110         layout.operator("graph.select_border", text="Border Axis Range").axis_range = True
111
112         layout.separator()
113         layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS'
114         layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA'
115
116         layout.operator("graph.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
117         layout.operator("graph.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
118
119
120 class GRAPH_MT_channel(bpy.types.Menu):
121     bl_label = "Channel"
122
123     def draw(self, context):
124         layout = self.layout
125
126         layout.column()
127         layout.operator("anim.channels_setting_toggle")
128         layout.operator("anim.channels_setting_enable")
129         layout.operator("anim.channels_setting_disable")
130
131         layout.separator()
132         layout.operator("anim.channels_editable_toggle")
133
134         layout.separator()
135         layout.operator("anim.channels_expand")
136         layout.operator("anim.channels_collapse")
137
138
139 class GRAPH_MT_key(bpy.types.Menu):
140     bl_label = "Key"
141
142     def draw(self, context):
143         layout = self.layout
144
145         layout.column()
146         layout.menu("GRAPH_MT_key_transform", text="Transform")
147
148         layout.operator_menu_enum("graph.snap", property="type", text="Snap")
149         layout.operator_menu_enum("graph.mirror", property="type", text="Mirror")
150
151         layout.separator()
152         layout.operator("graph.keyframe_insert")
153         layout.operator("graph.fmodifier_add")
154
155         layout.separator()
156         layout.operator("graph.duplicate")
157         layout.operator("graph.delete")
158
159         layout.separator()
160         layout.operator_menu_enum("graph.handle_type", property="type", text="Handle Type")
161         layout.operator_menu_enum("graph.interpolation_type", property="type", text="Interpolation Mode")
162         layout.operator_menu_enum("graph.extrapolation_type", property="type", text="Extrapolation Mode")
163
164         layout.separator()
165         layout.operator("graph.clean")
166         layout.operator("graph.sample")
167         layout.operator("graph.bake")
168
169         layout.separator()
170         layout.operator("graph.copy")
171         layout.operator("graph.paste")
172
173
174 class GRAPH_MT_key_transform(bpy.types.Menu):
175     bl_label = "Transform"
176
177     def draw(self, context):
178         layout = self.layout
179
180         layout.column()
181         layout.operator("tfm.translate", text="Grab/Move")
182         layout.operator("tfm.transform", text="Extend").mode = 'TIME_EXTEND'
183         layout.operator("tfm.rotate", text="Rotate")
184         layout.operator("tfm.resize", text="Scale")
185
186
187 bpy.types.register(GRAPH_HT_header) # header/menu classes
188 bpy.types.register(GRAPH_MT_view)
189 bpy.types.register(GRAPH_MT_select)
190 bpy.types.register(GRAPH_MT_channel)
191 bpy.types.register(GRAPH_MT_key)
192 bpy.types.register(GRAPH_MT_key_transform)