make new rna variables more consistant with existing names.
[blender.git] / release / scripts / startup / bl_ui / space_sequencer.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 import bpy
21 from bpy.types import Header, Menu, Panel
22
23
24 def act_strip(context):
25     try:
26         return context.scene.sequence_editor.active_strip
27     except AttributeError:
28         return None
29
30
31 class SEQUENCER_HT_header(Header):
32     bl_space_type = 'SEQUENCE_EDITOR'
33
34     def draw(self, context):
35         layout = self.layout
36
37         st = context.space_data
38
39         row = layout.row(align=True)
40         row.template_header()
41
42         if context.area.show_menus:
43             row.menu("SEQUENCER_MT_view")
44
45             if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
46                 row.menu("SEQUENCER_MT_select")
47                 row.menu("SEQUENCER_MT_marker")
48                 row.menu("SEQUENCER_MT_add")
49                 row.menu("SEQUENCER_MT_strip")
50
51         layout.prop(st, "view_type", expand=True, text="")
52
53         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
54             layout.prop(st, "display_mode", expand=True, text="")
55
56         if st.view_type == 'SEQUENCER':
57             row = layout.row(align=True)
58             row.operator("sequencer.copy", text="", icon='COPYDOWN')
59             row.operator("sequencer.paste", text="", icon='PASTEDOWN')
60
61             layout.separator()
62             layout.operator("sequencer.refresh_all")
63             layout.template_running_jobs()
64         elif st.view_type == 'SEQUENCER_PREVIEW':
65             layout.separator()
66             layout.operator("sequencer.refresh_all")
67             layout.prop(st, "display_channel", text="Channel")
68         else:
69             layout.prop(st, "display_channel", text="Channel")
70
71             ed = context.scene.sequence_editor
72             if ed:
73                 row = layout.row(align=True)
74                 row.prop(ed, "show_overlay", text="", icon='GHOST_ENABLED')
75                 if ed.show_overlay:
76                     row.prop(ed, "overlay_frame", text="")
77                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
78
79
80 class SEQUENCER_MT_view_toggle(Menu):
81     bl_label = "View Type"
82
83     def draw(self, context):
84         layout = self.layout
85
86         layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
87         layout.operator("sequencer.view_toggle").type = 'PREVIEW'
88         layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
89
90
91 class SEQUENCER_MT_view(Menu):
92     bl_label = "View"
93
94     def draw(self, context):
95         layout = self.layout
96
97         st = context.space_data
98
99         layout.operator("sequencer.properties", icon='MENU_PANEL')
100
101         layout.separator()
102
103         if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
104             layout.operator("sequencer.view_all", text="View all Sequences")
105         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
106             layout.operator_context = 'INVOKE_REGION_PREVIEW'
107             layout.operator("sequencer.view_all_preview", text="Fit preview in window")
108             layout.operator("sequencer.view_zoom_ratio", text="Show preview 1:1").ratio = 1.0
109             layout.operator_context = 'INVOKE_DEFAULT'
110
111             # # XXX, invokes in the header view
112             # layout.operator("sequencer.view_ghost_border", text='Overlay Border')
113
114         layout.operator("sequencer.view_selected")
115
116         if st.show_frames:
117             layout.operator("anim.time_toggle", text="Show Seconds")
118         else:
119             layout.operator("anim.time_toggle", text="Show Frames")
120
121         layout.prop(st, "show_frame_indicator")
122         if st.display_mode == 'IMAGE':
123             layout.prop(st, "show_safe_margin")
124         if st.display_mode == 'WAVEFORM':
125             layout.prop(st, "show_separate_color")
126
127         layout.separator()
128         layout.prop(st, "use_marker_sync")
129         layout.separator()
130
131         layout.operator("screen.area_dupli")
132         layout.operator("screen.screen_full_area")
133
134
135 class SEQUENCER_MT_select(Menu):
136     bl_label = "Select"
137
138     def draw(self, context):
139         layout = self.layout
140
141         layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
142         layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
143         layout.separator()
144         layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
145         layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
146         layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
147         layout.separator()
148         layout.operator("sequencer.select_linked")
149         layout.operator("sequencer.select_all_toggle")
150         layout.operator("sequencer.select_inverse")
151
152
153 class SEQUENCER_MT_marker(Menu):
154     bl_label = "Marker"
155
156     def draw(self, context):
157         layout = self.layout
158
159         #layout.operator_context = 'EXEC_REGION_WIN'
160
161         layout.operator("marker.add", "Add Marker")
162         layout.operator("marker.duplicate", text="Duplicate Marker")
163         layout.operator("marker.delete", text="Delete Marker")
164
165         layout.separator()
166
167         layout.operator("marker.rename", text="Rename Marker")
168         layout.operator("marker.move", text="Grab/Move Marker")
169
170         #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
171
172
173 class SEQUENCER_MT_change(Menu):
174     bl_label = "Change"
175
176     def draw(self, context):
177         layout = self.layout
178
179         layout.operator_context = 'INVOKE_REGION_WIN'
180
181         layout.operator_menu_enum("sequencer.change_effect_input", "swap")
182         layout.operator_menu_enum("sequencer.change_effect_type", "type")
183         layout.operator("sequencer.change_path", text="Path/Files")
184
185
186 class SEQUENCER_MT_add(Menu):
187     bl_label = "Add"
188
189     def draw(self, context):
190         layout = self.layout
191         layout.operator_context = 'INVOKE_REGION_WIN'
192
193         if len(bpy.data.scenes) > 10:
194             layout.operator_context = 'INVOKE_DEFAULT'
195             layout.operator("sequencer.scene_strip_add", text="Scene...")
196         else:
197             layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
198
199         layout.operator("sequencer.movie_strip_add", text="Movie")
200         layout.operator("sequencer.image_strip_add", text="Image")
201         layout.operator("sequencer.sound_strip_add", text="Sound")
202
203         layout.menu("SEQUENCER_MT_add_effect")
204
205
206 class SEQUENCER_MT_add_effect(Menu):
207     bl_label = "Effect Strip..."
208
209     def draw(self, context):
210         layout = self.layout
211         layout.operator_context = 'INVOKE_REGION_WIN'
212
213         layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
214         layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
215         layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
216         layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
217         layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
218         layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
219         layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
220         layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
221         layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
222         layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
223         layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
224         layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
225         layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
226         layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
227         layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
228         layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT'
229
230
231 class SEQUENCER_MT_strip(Menu):
232     bl_label = "Strip"
233
234     def draw(self, context):
235         layout = self.layout
236
237         layout.operator_context = 'INVOKE_REGION_WIN'
238
239         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
240         layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
241         #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
242         layout.separator()
243
244         layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
245         layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
246         layout.operator("sequencer.images_separate")
247         layout.operator("sequencer.offset_clear")
248         layout.operator("sequencer.deinterlace_selected_movies")
249         layout.operator("sequencer.rebuild_proxy")
250         layout.separator()
251
252         layout.operator("sequencer.duplicate")
253         layout.operator("sequencer.delete")
254
255         strip = act_strip(context)
256
257         if strip:
258             stype = strip.type
259
260             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
261             if stype == 'EFFECT':
262                 pass
263                 # layout.separator()
264                 # layout.operator("sequencer.effect_change")
265                 # layout.operator("sequencer.effect_reassign_inputs")
266             elif stype == 'IMAGE':
267                 layout.separator()
268                 # layout.operator("sequencer.image_change")
269                 layout.operator("sequencer.rendersize")
270             elif stype == 'SCENE':
271                 pass
272                 # layout.separator()
273                 # layout.operator("sequencer.scene_change", text="Change Scene")
274             elif stype == 'MOVIE':
275                 layout.separator()
276                 # layout.operator("sequencer.movie_change")
277                 layout.operator("sequencer.rendersize")
278
279         layout.separator()
280
281         layout.operator("sequencer.meta_make")
282         layout.operator("sequencer.meta_separate")
283
284         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
285         #       uiItemS(layout);
286         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
287         #}
288
289         layout.separator()
290         layout.operator("sequencer.reload")
291         layout.operator("sequencer.reassign_inputs")
292         layout.operator("sequencer.swap_inputs")
293         layout.separator()
294         layout.operator("sequencer.lock")
295         layout.operator("sequencer.unlock")
296         layout.operator("sequencer.mute")
297         layout.operator("sequencer.unmute")
298
299         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
300
301         layout.operator("sequencer.snap")
302
303         layout.operator_menu_enum("sequencer.swap", "side")
304
305         layout.separator()
306
307         layout.operator("sequencer.swap_data")
308         layout.menu("SEQUENCER_MT_change")
309
310
311 class SequencerButtonsPanel():
312     bl_space_type = 'SEQUENCE_EDITOR'
313     bl_region_type = 'UI'
314
315     @staticmethod
316     def has_sequencer(context):
317         return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
318
319     @classmethod
320     def poll(cls, context):
321         return cls.has_sequencer(context) and (act_strip(context) is not None)
322
323
324 class SequencerButtonsPanel_Output():
325     bl_space_type = 'SEQUENCE_EDITOR'
326     bl_region_type = 'UI'
327
328     @staticmethod
329     def has_preview(context):
330         return (context.space_data.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'})
331
332     @classmethod
333     def poll(cls, context):
334         return cls.has_preview(context)
335
336
337 class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
338     bl_label = "Edit Strip"
339
340     def draw(self, context):
341         layout = self.layout
342         scene = context.scene
343         frame_current = scene.frame_current
344         strip = act_strip(context)
345
346         split = layout.split(percentage=0.3)
347         split.label(text="Name:")
348         split.prop(strip, "name", text="")
349
350         split = layout.split(percentage=0.3)
351         split.label(text="Type:")
352         split.prop(strip, "type", text="")
353
354         split = layout.split(percentage=0.3)
355         split.label(text="Blend:")
356         split.prop(strip, "blend_type", text="")
357
358         row = layout.row(align=True)
359         sub = row.row()
360         sub.active = (not strip.mute)
361         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
362         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
363         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
364
365         col = layout.column()
366         sub = col.column()
367         sub.enabled = not strip.lock
368         sub.prop(strip, "channel")
369         sub.prop(strip, "frame_start")
370         sub.prop(strip, "frame_final_duration")
371
372         col = layout.column(align=True)
373         row = col.row()
374         row.label(text="Final Length" + ": %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
375         row = col.row()
376         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
377         row.label(text="Playhead" + ": %d" % (frame_current - strip.frame_start))
378
379         col.label(text="Frame Offset" + " %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
380         col.label(text="Frame Still" + " %d:%d" % (strip.frame_still_start, strip.frame_still_end))
381
382         elem = False
383
384         if strip.type == 'IMAGE':
385             elem = strip.getStripElem(frame_current)
386         elif strip.type == 'MOVIE':
387             elem = strip.elements[0]
388
389         if elem and elem.orig_width > 0 and elem.orig_height > 0:
390             col.label(text="Orig Dim" + ": %dx%d" % (elem.orig_width, elem.orig_height))
391         else:
392             col.label(text="Orig Dim: None")
393
394
395 class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
396     bl_label = "Effect Strip"
397
398     @classmethod
399     def poll(cls, context):
400         if not cls.has_sequencer(context):
401             return False
402
403         strip = act_strip(context)
404         if not strip:
405             return False
406
407         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
408                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
409                               'PLUGIN',
410                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
411                               'MULTICAM', 'ADJUSTMENT'}
412
413     def draw(self, context):
414         layout = self.layout
415
416         strip = act_strip(context)
417         if strip.input_count > 0:
418             col = layout.column()
419             col.prop(strip, "input_1")
420             if strip.input_count > 1:
421                 col.prop(strip, "input_2")
422             if strip.input_count > 2:
423                 col.prop(strip, "input_3")
424
425         if strip.type == 'COLOR':
426             layout.prop(strip, "color")
427
428         elif strip.type == 'WIPE':
429
430             col = layout.column()
431             col.prop(strip, "transition_type")
432             col.label(text="Direction:")
433             col.row().prop(strip, "direction", expand=True)
434
435             col = layout.column()
436             col.prop(strip, "blur_width", slider=True)
437             if strip.transition_type in {'SINGLE', 'DOUBLE'}:
438                 col.prop(strip, "angle")
439
440         elif strip.type == 'GLOW':
441             flow = layout.column_flow()
442             flow.prop(strip, "threshold", slider=True)
443             flow.prop(strip, "clamp", slider=True)
444             flow.prop(strip, "boost_factor")
445             flow.prop(strip, "blur_radius")
446
447             row = layout.row()
448             row.prop(strip, "quality", slider=True)
449             row.prop(strip, "use_only_boost")
450
451         elif strip.type == 'SPEED':
452             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
453             if not strip.use_default_fade:
454                 layout.prop(strip, "use_as_speed")
455                 if strip.use_as_speed:
456                     layout.prop(strip, "speed_factor")
457                 else:
458                     layout.prop(strip, "speed_factor", text="Frame number")
459                     layout.prop(strip, "scale_to_length")
460
461             #doesn't work currently
462             #layout.prop(strip, "use_frame_blend")
463
464         elif strip.type == 'TRANSFORM':
465             self.draw_panel_transform(strip)
466
467         elif strip.type == "MULTICAM":
468             layout.prop(strip, "multicam_source")
469
470             row = layout.row(align=True)
471             sub = row.row()
472             sub.scale_x = 2.0
473
474             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
475
476             row.label("Cut To")
477             for i in range(1, strip.channel):
478                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
479
480         col = layout.column(align=True)
481         if strip.type == 'SPEED':
482             col.prop(strip, "multiply_speed")
483         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
484                 col.prop(strip, "use_default_fade", "Default fade")
485                 if not strip.use_default_fade:
486                     col.prop(strip, "effect_fader", text="Effect fader")
487
488         layout.prop(strip, "use_translation", text="Image Offset:")
489         if strip.use_translation:
490             col = layout.column(align=True)
491             col.prop(strip.transform, "offset_x", text="X")
492             col.prop(strip.transform, "offset_y", text="Y")
493
494         layout.prop(strip, "use_crop", text="Image Crop:")
495         if strip.use_crop:
496             col = layout.column(align=True)
497             col.prop(strip.crop, "max_y")
498             col.prop(strip.crop, "min_x")
499             col.prop(strip.crop, "min_y")
500             col.prop(strip.crop, "max_x")
501
502     def draw_panel_transform(self, strip):
503         layout = self.layout
504         col = layout.column()
505
506         col.prop(strip, "interpolation")
507         col.prop(strip, "translation_unit")
508         col = layout.column(align=True)
509         col.label(text="Position:")
510         col.prop(strip, "translate_start_x", text="X")
511         col.prop(strip, "translate_start_y", text="Y")
512
513         layout.separator()
514
515         col = layout.column(align=True)
516         col.prop(strip, "use_uniform_scale")
517         if (strip.use_uniform_scale):
518             col = layout.column(align=True)
519             col.prop(strip, "scale_start_x", text="Scale")
520         else:
521             col = layout.column(align=True)
522             col.label(text="Scale:")
523             col.prop(strip, "scale_start_x", text="X")
524             col.prop(strip, "scale_start_y", text="Y")
525
526         layout.separator()
527
528         col = layout.column(align=True)
529         col.label(text="Rotation:")
530         col.prop(strip, "rotation_start", text="Rotation")
531
532
533 class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
534     bl_label = "Strip Input"
535
536     @classmethod
537     def poll(cls, context):
538         if not cls.has_sequencer(context):
539             return False
540
541         strip = act_strip(context)
542         if not strip:
543             return False
544
545         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
546                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
547                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
548                               'PLUGIN',
549                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
550                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
551
552     def draw(self, context):
553         layout = self.layout
554
555         strip = act_strip(context)
556
557         seq_type = strip.type
558
559         # draw a filename if we have one
560         if seq_type == 'IMAGE':
561             split = layout.split(percentage=0.2)
562             col = split.column()
563             col.label(text="Path:")
564             col = split.column()
565             col.prop(strip, "directory", text="")
566
567             # Current element for the filename
568
569             elem = strip.getStripElem(context.scene.frame_current)
570             if elem:
571                 split = layout.split(percentage=0.2)
572                 col = split.column()
573                 col.label(text="File:")
574                 col = split.column()
575                 col.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
576
577             # also accessible from the menu
578             layout.operator("sequencer.change_path")
579
580         elif seq_type == 'MOVIE':
581             split = layout.split(percentage=0.2)
582             col = split.column()
583             col.label(text="Path:")
584             col = split.column()
585             col.prop(strip, "filepath", text="")
586             col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
587             col.prop(strip, "stream_index", text="Stream Index")
588
589         # TODO, sound???
590         # end drawing filename
591
592         layout.prop(strip, "use_translation", text="Image Offset:")
593         if strip.use_translation:
594             col = layout.column(align=True)
595             col.prop(strip.transform, "offset_x", text="X")
596             col.prop(strip.transform, "offset_y", text="Y")
597
598         layout.prop(strip, "use_crop", text="Image Crop:")
599         if strip.use_crop:
600             col = layout.column(align=True)
601             col.prop(strip.crop, "max_y")
602             col.prop(strip.crop, "min_x")
603             col.prop(strip.crop, "min_y")
604             col.prop(strip.crop, "max_x")
605
606         if not isinstance(strip, bpy.types.EffectSequence):
607             col = layout.column(align=True)
608             col.label(text="Trim Duration (hard):")
609             col.prop(strip, "animation_offset_start", text="Start")
610             col.prop(strip, "animation_offset_end", text="End")
611
612         col = layout.column(align=True)
613         col.label(text="Trim Duration (soft):")
614         col.prop(strip, "frame_offset_start", text="Start")
615         col.prop(strip, "frame_offset_end", text="End")
616
617
618 class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
619     bl_label = "Sound"
620
621     @classmethod
622     def poll(cls, context):
623         if not cls.has_sequencer(context):
624             return False
625
626         strip = act_strip(context)
627         if not strip:
628             return False
629
630         return (strip.type == 'SOUND')
631
632     def draw(self, context):
633         layout = self.layout
634
635         strip = act_strip(context)
636
637         layout.template_ID(strip, "sound", open="sound.open")
638
639         layout.separator()
640         layout.prop(strip, "filepath", text="")
641
642         row = layout.row()
643         if strip.sound.packed_file:
644             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
645         else:
646             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
647
648         row.prop(strip.sound, "use_memory_cache")
649
650         layout.prop(strip, "waveform")
651         layout.prop(strip, "volume")
652         layout.prop(strip, "pitch")
653         layout.prop(strip, "pan")
654
655         col = layout.column(align=True)
656         col.label(text="Trim Duration:")
657         col.prop(strip, "animation_offset_start", text="Start")
658         col.prop(strip, "animation_offset_end", text="End")
659
660
661 class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
662     bl_label = "Scene"
663
664     @classmethod
665     def poll(cls, context):
666         if not cls.has_sequencer(context):
667             return False
668
669         strip = act_strip(context)
670         if not strip:
671             return False
672
673         return (strip.type == 'SCENE')
674
675     def draw(self, context):
676         layout = self.layout
677
678         strip = act_strip(context)
679
680         layout.template_ID(strip, "scene")
681
682         scene = strip.scene
683         if scene:
684             layout.prop(scene.render, "use_sequencer")
685
686         layout.label(text="Camera Override")
687         layout.template_ID(strip, "scene_camera")
688
689         if scene:
690             sta = scene.frame_start
691             end = scene.frame_end
692             layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
693
694
695 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
696     bl_label = "Filter"
697
698     @classmethod
699     def poll(cls, context):
700         if not cls.has_sequencer(context):
701             return False
702
703         strip = act_strip(context)
704         if not strip:
705             return False
706
707         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
708                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
709                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
710                               'PLUGIN',
711                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
712                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
713
714     def draw(self, context):
715         layout = self.layout
716
717         strip = act_strip(context)
718
719         col = layout.column()
720         col.label(text="Video:")
721         col.prop(strip, "strobe")
722
723         row = layout.row()
724         row.label(text="Flip:")
725         row.prop(strip, "use_flip_x", text="X")
726         row.prop(strip, "use_flip_y", text="Y")
727
728         col = layout.column()
729         col.prop(strip, "use_reverse_frames", text="Backwards")
730         col.prop(strip, "use_deinterlace")
731
732         col = layout.column()
733         col.label(text="Colors:")
734         col.prop(strip, "color_saturation", text="Saturation")
735         col.prop(strip, "color_multiply", text="Multiply")
736         col.prop(strip, "use_premultiply")
737         col.prop(strip, "use_float")
738
739         layout.prop(strip, "use_color_balance")
740         if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
741             row = layout.row()
742             row.active = strip.use_color_balance
743             col = row.column()
744             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
745             col.row().prop(strip.color_balance, "lift")
746             col.prop(strip.color_balance, "invert_lift", text="Inverse")
747             col = row.column()
748             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
749             col.row().prop(strip.color_balance, "gamma")
750             col.prop(strip.color_balance, "invert_gamma", text="Inverse")
751             col = row.column()
752             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
753             col.row().prop(strip.color_balance, "gain")
754             col.prop(strip.color_balance, "invert_gain", text="Inverse")
755
756
757 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
758     bl_label = "Proxy / Timecode"
759
760     @classmethod
761     def poll(cls, context):
762         if not cls.has_sequencer(context):
763             return False
764
765         strip = act_strip(context)
766         if not strip:
767             return False
768
769         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
770
771     def draw_header(self, context):
772         strip = act_strip(context)
773
774         self.layout.prop(strip, "use_proxy", text="")
775
776     def draw(self, context):
777         layout = self.layout
778
779         strip = act_strip(context)
780
781         flow = layout.column_flow()
782         flow.prop(strip, "use_proxy_custom_directory")
783         flow.prop(strip, "use_proxy_custom_file")
784         if strip.proxy:
785             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
786                 flow.prop(strip.proxy, "directory")
787             if strip.use_proxy_custom_file:
788                 flow.prop(strip.proxy, "filepath")
789
790             row = layout.row()
791             row.prop(strip.proxy, "build_25")
792             row.prop(strip.proxy, "build_50")
793             row.prop(strip.proxy, "build_75")
794             row.prop(strip.proxy, "build_100")
795
796             col = layout.column()
797             col.label(text="Build JPEG quality")
798             col.prop(strip.proxy, "quality")
799
800             if strip.type == "MOVIE":
801                 col = layout.column()
802                 col.label(text="Use timecode index:")
803
804                 col.prop(strip.proxy, "timecode")
805
806
807 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
808     bl_label = "Scene Preview/Render"
809     bl_space_type = 'SEQUENCE_EDITOR'
810     bl_region_type = 'UI'
811
812     def draw(self, context):
813         layout = self.layout
814         render = context.scene.render
815
816         col = layout.column()
817         col.active = False  # Currently only opengl preview works!
818         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
819         col = layout.column()
820         #col.active = render.use_sequencer_gl_preview
821         col.prop(render, "sequencer_gl_preview", text="")
822
823         '''
824         col = layout.column()
825         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
826         col = layout.column()
827         col.active = render.use_sequencer_gl_render
828         col.prop(render, "sequencer_gl_render", text="")
829         '''
830
831
832 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
833     bl_label = "View Settings"
834
835     def draw(self, context):
836         layout = self.layout
837
838         st = context.space_data
839
840         col = layout.column()
841         if st.display_mode == 'IMAGE':
842             col.prop(st, "draw_overexposed")  # text="Zebra"
843             col.prop(st, "show_safe_margin")
844         if st.display_mode == 'WAVEFORM':
845             col.prop(st, "show_separate_color")
846         col.prop(st, "proxy_render_size")
847
848 if __name__ == "__main__":  # only for live edit.
849     bpy.utils.register_module(__name__)