Removed UI for point cache users.
[blender.git] / release / scripts / startup / bl_ui / space_nla.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 NLA_HT_header(Header):
26     bl_space_type = 'NLA_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         NLA_MT_editor_menus.draw_collapsible(context, layout)
39
40         dopesheet_filter(layout, context)
41
42         layout.prop(st, "auto_snap", text="")
43
44
45 class NLA_MT_editor_menus(Menu):
46     bl_idname = "NLA_MT_editor_menus"
47     bl_label = ""
48
49     def draw(self, context):
50         self.draw_menus(self.layout, context)
51
52     @staticmethod
53     def draw_menus(layout, context):
54         layout.menu("NLA_MT_view")
55         layout.menu("NLA_MT_select")
56         layout.menu("NLA_MT_marker")
57         layout.menu("NLA_MT_edit")
58         layout.menu("NLA_MT_add")
59
60
61 class NLA_MT_view(Menu):
62     bl_label = "View"
63
64     def draw(self, context):
65         layout = self.layout
66
67         st = context.space_data
68
69         layout.operator("nla.properties", icon='MENU_PANEL')
70
71         layout.separator()
72
73         layout.prop(st, "use_realtime_update")
74         layout.prop(st, "show_frame_indicator")
75
76         layout.prop(st, "show_seconds")
77         layout.prop(st, "show_locked_time")
78
79         layout.prop(st, "show_strip_curves")
80
81         layout.separator()
82         layout.operator("anim.previewrange_set")
83         layout.operator("anim.previewrange_clear")
84         layout.operator("nla.previewrange_set")
85
86         layout.separator()
87         layout.operator("nla.view_all")
88         layout.operator("nla.view_selected")
89         layout.operator("nla.view_frame")
90
91         layout.separator()
92         layout.operator("screen.area_dupli")
93         layout.operator("screen.screen_full_area", text="Toggle Maximize Area")
94         layout.operator("screen.screen_full_area").use_hide_panels = True
95
96
97 class NLA_MT_select(Menu):
98     bl_label = "Select"
99
100     def draw(self, context):
101         layout = self.layout
102
103         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
104         layout.operator("nla.select_all_toggle").invert = False
105         layout.operator("nla.select_all_toggle", text="Invert Selection").invert = True
106
107         layout.separator()
108         layout.operator("nla.select_border").axis_range = False
109         layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
110
111         layout.separator()
112         props = layout.operator("nla.select_leftright", text="Before Current Frame")
113         props.extend = False
114         props.mode = 'LEFT'
115         props = layout.operator("nla.select_leftright", text="After Current Frame")
116         props.extend = False
117         props.mode = 'RIGHT'
118
119
120 class NLA_MT_marker(Menu):
121     bl_label = "Marker"
122
123     def draw(self, context):
124         layout = self.layout
125
126         from bl_ui.space_time import marker_menu_generic
127         marker_menu_generic(layout)
128
129
130 class NLA_MT_edit(Menu):
131     bl_label = "Edit"
132
133     def draw(self, context):
134         layout = self.layout
135
136         scene = context.scene
137
138         layout.menu("NLA_MT_edit_transform", text="Transform")
139
140         layout.operator_menu_enum("nla.snap", "type", text="Snap")
141
142         layout.separator()
143         layout.operator("nla.duplicate", text="Duplicate").linked = False
144         layout.operator("nla.duplicate", text="Linked Duplicate").linked = True
145         layout.operator("nla.split")
146         layout.operator("nla.delete")
147
148         layout.separator()
149         layout.operator("nla.mute_toggle")
150
151         layout.separator()
152         layout.operator("nla.apply_scale")
153         layout.operator("nla.clear_scale")
154         layout.operator("nla.action_sync_length").active = False
155
156         layout.separator()
157         layout.operator("nla.make_single_user")
158
159         layout.separator()
160         layout.operator("nla.swap")
161         layout.operator("nla.move_up")
162         layout.operator("nla.move_down")
163
164         # TODO: this really belongs more in a "channel" (or better, "track") menu
165         layout.separator()
166         layout.operator_menu_enum("anim.channels_move", "direction", text="Track Ordering...")
167         layout.operator("anim.channels_clean_empty")
168
169         layout.separator()
170         # TODO: names of these tools for 'tweak-mode' need changing?
171         if scene.is_nla_tweakmode:
172             layout.operator("nla.tweakmode_exit", text="Stop Editing Stashed Action").isolate_action = True
173             layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
174         else:
175             layout.operator("nla.tweakmode_enter", text="Start Editing Stashed Action").isolate_action = True
176             layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions")
177
178
179 class NLA_MT_add(Menu):
180     bl_label = "Add"
181
182     def draw(self, context):
183         layout = self.layout
184
185         layout.operator("nla.actionclip_add")
186         layout.operator("nla.transition_add")
187         layout.operator("nla.soundclip_add")
188
189         layout.separator()
190         layout.operator("nla.meta_add")
191         layout.operator("nla.meta_remove")
192
193         layout.separator()
194         layout.operator("nla.tracks_add").above_selected = False
195         layout.operator("nla.tracks_add", text="Add Tracks Above Selected").above_selected = True
196
197         layout.separator()
198         layout.operator("nla.selected_objects_add")
199
200
201 class NLA_MT_edit_transform(Menu):
202     bl_label = "Transform"
203
204     def draw(self, context):
205         layout = self.layout
206
207         layout.operator("transform.translate", text="Grab/Move")
208         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
209         layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
210
211 if __name__ == "__main__":  # only for live edit.
212     bpy.utils.register_module(__name__)