rename operators TFM_OT_* --> TRANSFORM_OT_*
[blender.git] / release / scripts / 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 import bpy
20
21
22 class NLA_HT_header(bpy.types.Header):
23     bl_space_type = 'NLA_EDITOR'
24
25     def draw(self, context):
26         layout = self.layout
27
28         st = context.space_data
29
30         row = layout.row(align=True)
31         row.template_header()
32
33         if context.area.show_menus:
34             sub = row.row(align=True)
35
36             sub.menu("NLA_MT_view")
37             sub.menu("NLA_MT_select")
38             sub.menu("NLA_MT_edit")
39             sub.menu("NLA_MT_add")
40
41         layout.template_dopesheet_filter(st.dopesheet)
42
43         layout.prop(st, "autosnap", text="")
44
45
46 class NLA_MT_view(bpy.types.Menu):
47     bl_label = "View"
48
49     def draw(self, context):
50         layout = self.layout
51
52         st = context.space_data
53
54         layout.column()
55
56         layout.operator("nla.properties", icon='MENU_PANEL')
57
58         layout.separator()
59         layout.prop(st, "show_cframe_indicator")
60
61         if st.show_seconds:
62             layout.operator("anim.time_toggle", text="Show Frames")
63         else:
64             layout.operator("anim.time_toggle", text="Show Seconds")
65
66         layout.prop(st, "show_strip_curves")
67
68         layout.separator()
69         layout.operator("anim.previewrange_set")
70         layout.operator("anim.previewrange_clear")
71
72         layout.separator()
73         layout.operator("screen.area_dupli")
74         layout.operator("screen.screen_full_area")
75
76
77 class NLA_MT_select(bpy.types.Menu):
78     bl_label = "Select"
79
80     def draw(self, context):
81         layout = self.layout
82
83         layout.column()
84         # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
85         layout.operator("nla.select_all_toggle")
86         layout.operator("nla.select_all_toggle", text="Invert Selection").invert = True
87
88         layout.separator()
89         layout.operator("nla.select_border")
90         layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
91
92
93 class NLA_MT_edit(bpy.types.Menu):
94     bl_label = "Edit"
95
96     def draw(self, context):
97         layout = self.layout
98
99         scene = context.scene
100
101         layout.column()
102         layout.menu("NLA_MT_edit_transform", text="Transform")
103
104         layout.operator_menu_enum("nla.snap", property="type", text="Snap")
105
106         layout.separator()
107         layout.operator("nla.duplicate")
108         layout.operator("nla.split")
109         layout.operator("nla.delete")
110
111         layout.separator()
112         layout.operator("nla.mute_toggle")
113
114         layout.separator()
115         layout.operator("nla.apply_scale")
116         layout.operator("nla.clear_scale")
117
118         layout.separator()
119         layout.operator("nla.move_up")
120         layout.operator("nla.move_down")
121
122         layout.separator()
123         # TODO: names of these tools for 'tweakmode' need changing?
124         if scene.nla_tweakmode_on:
125             layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
126         else:
127             layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions")
128
129
130 class NLA_MT_add(bpy.types.Menu):
131     bl_label = "Add"
132
133     def draw(self, context):
134         layout = self.layout
135
136         layout.column()
137         layout.operator("nla.actionclip_add")
138         layout.operator("nla.transition_add")
139
140         layout.separator()
141         layout.operator("nla.meta_add")
142         layout.operator("nla.meta_remove")
143
144         layout.separator()
145         layout.operator("nla.tracks_add")
146         layout.operator("nla.tracks_add", text="Add Tracks Above Selected").above_selected = True
147
148
149 class NLA_MT_edit_transform(bpy.types.Menu):
150     bl_label = "Transform"
151
152     def draw(self, context):
153         layout = self.layout
154
155         layout.column()
156         layout.operator("transform.translate", text="Grab/Move")
157         layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
158         layout.operator("transform.resize", text="Scale")
159
160
161 bpy.types.register(NLA_HT_header) # header/menu classes
162 bpy.types.register(NLA_MT_view)
163 bpy.types.register(NLA_MT_select)
164 bpy.types.register(NLA_MT_edit)
165 bpy.types.register(NLA_MT_add)
166 bpy.types.register(NLA_MT_edit_transform)