remove use of gettext: _("...") style translation now its handled by rna.
[blender.git] / release / scripts / startup / bl_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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20
21 import bpy
22 from bpy.types import Header, Menu
23
24
25 class GRAPH_HT_header(Header):
26     bl_space_type = 'GRAPH_EDITOR'
27
28     def draw(self, context):
29         from bl_ui.space_dopesheet import dopesheet_filter
30
31         layout = self.layout
32
33         st = context.space_data
34
35         row = layout.row(align=True)
36         row.template_header()
37
38         if context.area.show_menus:
39             row.menu("GRAPH_MT_view")
40             row.menu("GRAPH_MT_select")
41             row.menu("GRAPH_MT_marker")
42             row.menu("GRAPH_MT_channel")
43             row.menu("GRAPH_MT_key")
44
45         layout.prop(st, "mode", text="")
46
47         dopesheet_filter(layout, context)
48
49         layout.prop(st, "auto_snap", text="")
50         layout.prop(st, "pivot_point", text="", icon_only=True)
51
52         row = layout.row(align=True)
53         row.operator("graph.copy", text="", icon='COPYDOWN')
54         row.operator("graph.paste", text="", icon='PASTEDOWN')
55
56         row = layout.row(align=True)
57         if st.has_ghost_curves:
58             row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
59         else:
60             row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
61
62
63 class GRAPH_MT_view(Menu):
64     bl_label = "View"
65
66     def draw(self, context):
67         layout = self.layout
68
69         st = context.space_data
70
71         layout.operator("graph.properties", icon='MENU_PANEL')
72         layout.separator()
73
74         layout.prop(st, "use_realtime_update")
75         layout.prop(st, "show_frame_indicator")
76         layout.prop(st, "show_cursor")
77         layout.prop(st, "show_sliders")
78         layout.prop(st, "use_auto_merge_keyframes")
79
80         layout.separator()
81         layout.prop(st, "use_beauty_drawing")
82
83         layout.separator()
84         if st.show_handles:
85             layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
86         else:
87             layout.operator("graph.handles_view_toggle", icon='CHECKBOX_DEHLT', text="Show All Handles")
88         layout.prop(st, "use_only_selected_curves_handles")
89         layout.prop(st, "use_only_selected_keyframe_handles")
90         layout.operator("anim.time_toggle")
91
92         layout.separator()
93         layout.operator("anim.previewrange_set")
94         layout.operator("anim.previewrange_clear")
95         layout.operator("graph.previewrange_set")
96
97         layout.separator()
98         layout.operator("graph.frame_jump")
99         layout.operator("graph.view_all")
100         layout.operator("graph.view_selected")
101
102         layout.separator()
103         layout.operator("screen.area_dupli")
104         layout.operator("screen.screen_full_area")
105
106
107 class GRAPH_MT_select(Menu):
108     bl_label = "Select"
109
110     def draw(self, context):
111         layout = self.layout
112
113         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
114         layout.operator("graph.select_all_toggle")
115         layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
116
117         layout.separator()
118         layout.operator("graph.select_border")
119         layout.operator("graph.select_border", text="Border Axis Range").axis_range = True
120         layout.operator("graph.select_border", text="Border (Include Handles)").include_handles = True
121
122         layout.separator()
123         layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS'
124         layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA'
125
126         layout.operator("graph.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
127         layout.operator("graph.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
128
129         layout.separator()
130         layout.operator("graph.select_leftright", text="Before Current Frame").mode = 'LEFT'
131         layout.operator("graph.select_leftright", text="After Current Frame").mode = 'RIGHT'
132
133         layout.separator()
134         layout.operator("graph.select_more")
135         layout.operator("graph.select_less")
136
137         layout.separator()
138         layout.operator("graph.select_linked")
139
140
141 class GRAPH_MT_marker(Menu):
142     bl_label = "Marker"
143
144     def draw(self, context):
145         layout = self.layout
146
147         #layout.operator_context = 'EXEC_REGION_WIN'
148
149         layout.operator("marker.add", "Add Marker")
150         layout.operator("marker.duplicate", text="Duplicate Marker")
151         layout.operator("marker.delete", text="Delete Marker")
152
153         layout.separator()
154
155         layout.operator("marker.rename", text="Rename Marker")
156         layout.operator("marker.move", text="Grab/Move Marker")
157
158         # TODO: pose markers for action edit mode only?
159
160
161 class GRAPH_MT_channel(Menu):
162     bl_label = "Channel"
163
164     def draw(self, context):
165         layout = self.layout
166
167         layout.operator_context = 'INVOKE_REGION_CHANNELS'
168
169         layout.operator("anim.channels_delete")
170
171         layout.separator()
172         layout.operator("anim.channels_setting_toggle")
173         layout.operator("anim.channels_setting_enable")
174         layout.operator("anim.channels_setting_disable")
175
176         layout.separator()
177         layout.operator("anim.channels_editable_toggle")
178         layout.operator("anim.channels_visibility_set")
179         layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
180
181         layout.separator()
182         layout.operator("anim.channels_expand")
183         layout.operator("anim.channels_collapse")
184
185         layout.separator()
186         layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
187
188         layout.separator()
189         layout.operator("anim.channels_fcurves_enable")
190
191
192 class GRAPH_MT_key(Menu):
193     bl_label = "Key"
194
195     def draw(self, context):
196         layout = self.layout
197
198         layout.menu("GRAPH_MT_key_transform", text="Transform")
199
200         layout.operator_menu_enum("graph.snap", "type", text="Snap")
201         layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
202
203         layout.separator()
204         layout.operator("graph.keyframe_insert")
205         layout.operator("graph.fmodifier_add")
206         layout.operator("graph.sound_bake")
207
208         layout.separator()
209         layout.operator("graph.duplicate_move")
210         layout.operator("graph.delete")
211
212         layout.separator()
213         layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
214         layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
215
216         layout.separator()
217         layout.operator("graph.clean")
218         layout.operator("graph.smooth")
219         layout.operator("graph.sample")
220         layout.operator("graph.bake")
221
222         layout.separator()
223         layout.operator("graph.copy")
224         layout.operator("graph.paste")
225
226         layout.separator()
227         layout.operator("graph.euler_filter", text="Discontinuity (Euler) Filter")
228
229
230 class GRAPH_MT_key_transform(Menu):
231     bl_label = "Transform"
232
233     def draw(self, context):
234         layout = self.layout
235
236         layout.operator("transform.translate", text="Grab/Move")
237         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
238         layout.operator("transform.rotate", text="Rotate")
239         layout.operator("transform.resize", text="Scale")
240
241 if __name__ == "__main__":  # only for live edit.
242     bpy.utils.register_module(__name__)