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