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