1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17 # ##### END GPL LICENSE BLOCK #####
22 from bpy.types import Header, Menu
25 class GRAPH_HT_header(Header):
26 bl_space_type = 'GRAPH_EDITOR'
28 def draw(self, context):
29 from bl_ui.space_dopesheet import dopesheet_filter
33 st = context.space_data
35 row = layout.row(align=True)
38 GRAPH_MT_editor_menus.draw_collapsible(context, layout)
40 layout.prop(st, "mode", text="")
42 dopesheet_filter(layout, context)
44 layout.prop(st, "use_auto_view_selected", text="Auto View")
46 layout.prop(st, "use_normalization", text="Normalize")
48 row.active = st.use_normalization
49 row.prop(st, "use_auto_normalization", text="Auto")
51 layout.prop(st, "auto_snap", text="")
52 layout.prop(st, "pivot_point", icon_only=True)
54 row = layout.row(align=True)
55 row.operator("graph.copy", text="", icon='COPYDOWN')
56 row.operator("graph.paste", text="", icon='PASTEDOWN')
57 row.operator("graph.paste", text="", icon='PASTEFLIPDOWN').flipped = True
59 row = layout.row(align=True)
60 if st.has_ghost_curves:
61 row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
63 row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
66 class GRAPH_MT_editor_menus(Menu):
67 bl_idname = "GRAPH_MT_editor_menus"
70 def draw(self, context):
71 self.draw_menus(self.layout, context)
74 def draw_menus(layout, context):
75 layout.menu("GRAPH_MT_view")
76 layout.menu("GRAPH_MT_select")
77 layout.menu("GRAPH_MT_marker")
78 layout.menu("GRAPH_MT_channel")
79 layout.menu("GRAPH_MT_key")
82 class GRAPH_MT_view(Menu):
85 def draw(self, context):
88 st = context.space_data
90 layout.operator("graph.properties", icon='MENU_PANEL')
93 layout.prop(st, "use_realtime_update")
94 layout.prop(st, "show_frame_indicator")
95 layout.prop(st, "show_cursor")
96 layout.prop(st, "show_sliders")
97 layout.prop(st, "show_group_colors")
98 layout.prop(st, "use_auto_merge_keyframes")
101 layout.prop(st, "use_beauty_drawing")
105 layout.prop(st, "show_handles")
107 layout.prop(st, "use_only_selected_curves_handles")
108 layout.prop(st, "use_only_selected_keyframe_handles")
110 layout.prop(st, "show_seconds")
111 layout.prop(st, "show_locked_time")
114 layout.operator("anim.previewrange_set")
115 layout.operator("anim.previewrange_clear")
116 layout.operator("graph.previewrange_set")
119 layout.operator("graph.view_all")
120 layout.operator("graph.view_selected")
123 layout.operator("screen.area_dupli")
124 layout.operator("screen.screen_full_area", text="Toggle Maximize Area")
125 layout.operator("screen.screen_full_area").use_hide_panels = True
128 class GRAPH_MT_select(Menu):
131 def draw(self, context):
134 # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
135 layout.operator("graph.select_all_toggle").invert = False
136 layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
139 props = layout.operator("graph.select_border")
140 props.axis_range = False
141 props.include_handles = False
142 props = layout.operator("graph.select_border", text="Border Axis Range")
143 props.axis_range = True
144 props.include_handles = False
145 props = layout.operator("graph.select_border", text="Border (Include Handles)")
146 props.axis_range = False
147 props.include_handles = True
150 layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS'
151 layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA'
153 layout.operator("graph.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
154 layout.operator("graph.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
157 props = layout.operator("graph.select_leftright", text="Before Current Frame")
160 props = layout.operator("graph.select_leftright", text="After Current Frame")
165 layout.operator("graph.select_more")
166 layout.operator("graph.select_less")
169 layout.operator("graph.select_linked")
172 class GRAPH_MT_marker(Menu):
175 def draw(self, context):
178 from bl_ui.space_time import marker_menu_generic
179 marker_menu_generic(layout)
181 # TODO: pose markers for action edit mode only?
184 class GRAPH_MT_channel(Menu):
187 def draw(self, context):
190 layout.operator_context = 'INVOKE_REGION_CHANNELS'
192 layout.operator("anim.channels_delete")
195 layout.operator("anim.channels_group")
196 layout.operator("anim.channels_ungroup")
199 layout.operator_menu_enum("anim.channels_setting_toggle", "type")
200 layout.operator_menu_enum("anim.channels_setting_enable", "type")
201 layout.operator_menu_enum("anim.channels_setting_disable", "type")
204 layout.operator("anim.channels_editable_toggle")
205 layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
208 layout.operator("graph.hide", text="Hide Selected Curves").unselected = False
209 layout.operator("graph.hide", text="Hide Unselected Curves").unselected = True
210 layout.operator("graph.reveal")
213 layout.operator("anim.channels_expand")
214 layout.operator("anim.channels_collapse")
217 layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
220 layout.operator("anim.channels_fcurves_enable")
223 class GRAPH_MT_key(Menu):
226 def draw(self, context):
229 layout.menu("GRAPH_MT_key_transform", text="Transform")
231 layout.operator_menu_enum("graph.snap", "type", text="Snap")
232 layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
235 layout.operator_menu_enum("graph.keyframe_insert", "type")
236 layout.operator_menu_enum("graph.fmodifier_add", "type")
237 layout.operator("graph.sound_bake")
240 layout.operator("graph.frame_jump")
243 layout.operator("graph.duplicate_move")
244 layout.operator("graph.delete")
247 layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
248 layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
249 layout.operator_menu_enum("graph.easing_type", "type", text="Easing Type")
252 layout.operator("graph.clean")
253 layout.operator("graph.smooth")
254 layout.operator("graph.sample")
255 layout.operator("graph.bake")
258 layout.operator("graph.copy")
259 layout.operator("graph.paste")
262 layout.operator("graph.euler_filter", text="Discontinuity (Euler) Filter")
265 class GRAPH_MT_key_transform(Menu):
266 bl_label = "Transform"
268 def draw(self, context):
271 layout.operator("transform.translate", text="Grab/Move")
272 layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
273 layout.operator("transform.rotate", text="Rotate")
274 layout.operator("transform.resize", text="Scale")
276 if __name__ == "__main__": # only for live edit.
277 bpy.utils.register_module(__name__)