Project Pampa request: FCurves normalized display
[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, "use_normalization", text="Normalize")
50         row = layout.row()
51         row.active = st.use_normalization
52         row.prop(st, "use_auto_normalization", text="Auto")
53
54         layout.prop(st, "auto_snap", text="")
55         layout.prop(st, "pivot_point", text="", icon_only=True)
56
57         row = layout.row(align=True)
58         row.operator("graph.copy", text="", icon='COPYDOWN')
59         row.operator("graph.paste", text="", icon='PASTEDOWN')
60
61         row = layout.row(align=True)
62         if st.has_ghost_curves:
63             row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
64         else:
65             row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
66
67
68 class GRAPH_MT_view(Menu):
69     bl_label = "View"
70
71     def draw(self, context):
72         layout = self.layout
73
74         st = context.space_data
75
76         layout.operator("graph.properties", icon='MENU_PANEL')
77         layout.separator()
78
79         layout.prop(st, "use_realtime_update")
80         layout.prop(st, "show_frame_indicator")
81         layout.prop(st, "show_cursor")
82         layout.prop(st, "show_sliders")
83         layout.prop(st, "show_group_colors")
84         layout.prop(st, "use_auto_merge_keyframes")
85
86         layout.separator()
87         layout.prop(st, "use_beauty_drawing")
88
89         layout.separator()
90
91         layout.prop(st, "show_handles")
92
93         layout.prop(st, "use_only_selected_curves_handles")
94         layout.prop(st, "use_only_selected_keyframe_handles")
95
96         layout.prop(st, "show_seconds")
97
98         layout.separator()
99         layout.operator("anim.previewrange_set")
100         layout.operator("anim.previewrange_clear")
101         layout.operator("graph.previewrange_set")
102
103         layout.separator()
104         layout.operator("graph.view_all")
105         layout.operator("graph.view_selected")
106
107         layout.separator()
108         layout.operator("screen.area_dupli")
109         layout.operator("screen.screen_full_area")
110
111
112 class GRAPH_MT_select(Menu):
113     bl_label = "Select"
114
115     def draw(self, context):
116         layout = self.layout
117
118         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
119         layout.operator("graph.select_all_toggle").invert = False
120         layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
121
122         layout.separator()
123         layout.operator("graph.select_border")
124         layout.operator("graph.select_border", text="Border Axis Range").axis_range = True
125         layout.operator("graph.select_border", text="Border (Include Handles)").include_handles = True
126
127         layout.separator()
128         layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS'
129         layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA'
130
131         layout.operator("graph.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
132         layout.operator("graph.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
133
134         layout.separator()
135         layout.operator("graph.select_leftright", text="Before Current Frame").mode = 'LEFT'
136         layout.operator("graph.select_leftright", text="After Current Frame").mode = 'RIGHT'
137
138         layout.separator()
139         layout.operator("graph.select_more")
140         layout.operator("graph.select_less")
141
142         layout.separator()
143         layout.operator("graph.select_linked")
144
145
146 class GRAPH_MT_marker(Menu):
147     bl_label = "Marker"
148
149     def draw(self, context):
150         layout = self.layout
151
152         from bl_ui.space_time import marker_menu_generic
153         marker_menu_generic(layout)
154
155         # TODO: pose markers for action edit mode only?
156
157
158 class GRAPH_MT_channel(Menu):
159     bl_label = "Channel"
160
161     def draw(self, context):
162         layout = self.layout
163
164         layout.operator_context = 'INVOKE_REGION_CHANNELS'
165
166         layout.operator("anim.channels_delete")
167
168         layout.separator()
169         layout.operator("anim.channels_group")
170         layout.operator("anim.channels_ungroup")
171
172         layout.separator()
173         layout.operator_menu_enum("anim.channels_setting_toggle", "type")
174         layout.operator_menu_enum("anim.channels_setting_enable", "type")
175         layout.operator_menu_enum("anim.channels_setting_disable", "type")
176
177         layout.separator()
178         layout.operator("anim.channels_editable_toggle")
179         layout.operator("anim.channels_visibility_set")
180         layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
181
182         layout.separator()
183         layout.operator("anim.channels_expand")
184         layout.operator("anim.channels_collapse")
185
186         layout.separator()
187         layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
188
189         layout.separator()
190         layout.operator("anim.channels_fcurves_enable")
191
192
193 class GRAPH_MT_key(Menu):
194     bl_label = "Key"
195
196     def draw(self, context):
197         layout = self.layout
198
199         layout.menu("GRAPH_MT_key_transform", text="Transform")
200
201         layout.operator_menu_enum("graph.snap", "type", text="Snap")
202         layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
203
204         layout.separator()
205         layout.operator("graph.keyframe_insert")
206         layout.operator("graph.fmodifier_add")
207         layout.operator("graph.sound_bake")
208
209         layout.separator()
210         layout.operator("graph.frame_jump")
211
212         layout.separator()
213         layout.operator("graph.duplicate_move")
214         layout.operator("graph.delete")
215
216         layout.separator()
217         layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
218         layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
219
220         layout.separator()
221         layout.operator("graph.clean")
222         layout.operator("graph.smooth")
223         layout.operator("graph.sample")
224         layout.operator("graph.bake")
225
226         layout.separator()
227         layout.operator("graph.copy")
228         layout.operator("graph.paste")
229
230         layout.separator()
231         layout.operator("graph.euler_filter", text="Discontinuity (Euler) Filter")
232
233
234 class GRAPH_MT_key_transform(Menu):
235     bl_label = "Transform"
236
237     def draw(self, context):
238         layout = self.layout
239
240         layout.operator("transform.translate", text="Grab/Move")
241         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
242         layout.operator("transform.rotate", text="Rotate")
243         layout.operator("transform.resize", text="Scale")
244
245 if __name__ == "__main__":  # only for live edit.
246     bpy.utils.register_module(__name__)