77ac18e86000aac452c63ea7c87a44caad08c596
[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 == 'SEQUENCER') or (st.view_type == '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 == 'PREVIEW') or (st.view_type == '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 == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
105             layout.operator("sequencer.view_all", text='View all Sequences')
106         if (st.view_type == 'PREVIEW') or (st.view_type == '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
217
218 class SEQUENCER_MT_strip(bpy.types.Menu):
219     bl_label = "Strip"
220
221     def draw(self, context):
222         layout = self.layout
223
224         layout.operator_context = 'INVOKE_REGION_WIN'
225
226         layout.column()
227         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
228         layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
229         #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
230         layout.separator()
231
232         layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
233         layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
234         layout.operator("sequencer.images_separate")
235         layout.operator("sequencer.deinterlace_selected_movies")
236         layout.separator()
237
238         layout.operator("sequencer.duplicate")
239         layout.operator("sequencer.delete")
240
241         strip = act_strip(context)
242
243         if strip:
244             stype = strip.type
245
246             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
247             if stype == 'EFFECT':
248                 pass
249                 # layout.separator()
250                 # layout.operator("sequencer.effect_change")
251                 # layout.operator("sequencer.effect_reassign_inputs")
252             elif stype == 'IMAGE':
253                 layout.separator()
254                 # layout.operator("sequencer.image_change")
255                 layout.operator("sequencer.rendersize")
256             elif stype == 'SCENE':
257                 pass
258                 # layout.separator()
259                 # layout.operator("sequencer.scene_change", text="Change Scene")
260             elif stype == 'MOVIE':
261                 layout.separator()
262                 # layout.operator("sequencer.movie_change")
263                 layout.operator("sequencer.rendersize")
264
265         layout.separator()
266
267         layout.operator("sequencer.meta_make")
268         layout.operator("sequencer.meta_separate")
269
270         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
271         #       uiItemS(layout);
272         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
273         #}
274
275         layout.separator()
276         layout.operator("sequencer.reload")
277         layout.operator("sequencer.reassign_inputs")
278         layout.operator("sequencer.swap_inputs")
279         layout.separator()
280         layout.operator("sequencer.lock")
281         layout.operator("sequencer.unlock")
282         layout.operator("sequencer.mute")
283         layout.operator("sequencer.unmute")
284
285         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
286
287         layout.operator("sequencer.snap")
288
289         layout.operator_menu_enum("sequencer.swap", "side")
290
291         layout.separator()
292
293         layout.operator("sequencer.swap_data")
294
295
296 class SequencerButtonsPanel():
297     bl_space_type = 'SEQUENCE_EDITOR'
298     bl_region_type = 'UI'
299
300     @staticmethod
301     def has_sequencer(context):
302         return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
303
304     @classmethod
305     def poll(cls, context):
306         return cls.has_sequencer(context) and (act_strip(context) is not None)
307
308
309 class SequencerButtonsPanel_Output():
310     bl_space_type = 'SEQUENCE_EDITOR'
311     bl_region_type = 'UI'
312
313     @staticmethod
314     def has_preview(context):
315         return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
316
317     @classmethod
318     def poll(cls, context):
319         return cls.has_preview(context)
320
321
322 class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
323     bl_label = "Edit Strip"
324
325     def draw(self, context):
326         layout = self.layout
327         scene = context.scene
328         frame_current = scene.frame_current
329         strip = act_strip(context)
330
331         split = layout.split(percentage=0.3)
332         split.label(text="Name:")
333         split.prop(strip, "name", text="")
334
335         split = layout.split(percentage=0.3)
336         split.label(text="Type:")
337         split.prop(strip, "type", text="")
338
339         split = layout.split(percentage=0.3)
340         split.label(text="Blend:")
341         split.prop(strip, "blend_type", text="")
342
343         row = layout.row(align=True)
344         sub = row.row()
345         sub.active = (not strip.mute)
346         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
347         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
348         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
349
350         col = layout.column()
351         sub = col.column()
352         sub.enabled = not strip.lock
353         sub.prop(strip, "channel")
354         sub.prop(strip, "frame_start")
355         sub.prop(strip, "frame_final_duration")
356
357         col = layout.column(align=True)
358         row = col.row()
359         row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
360         row = col.row()
361         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
362         row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
363
364         col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
365         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
366
367         elem = False
368
369         if strip.type == 'IMAGE':
370             elem = strip.getStripElem(frame_current)
371         elif strip.type == 'MOVIE':
372             elem = strip.elements[0]
373
374         if elem and elem.orig_width > 0 and elem.orig_height > 0:
375             col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
376
377
378 class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
379     bl_label = "Effect Strip"
380
381     @classmethod
382     def poll(cls, context):
383         if not cls.has_sequencer(context):
384             return False
385
386         strip = act_strip(context)
387         if not strip:
388             return False
389
390         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
391                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
392                               'PLUGIN',
393                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
394                               'MULTICAM'}
395
396     def draw(self, context):
397         layout = self.layout
398
399         strip = act_strip(context)
400         if strip.input_count > 0:
401             col = layout.column()
402             col.prop(strip, "input_1")
403             if strip.input_count > 1:
404                 col.prop(strip, "input_2")
405             if strip.input_count > 2:
406                 col.prop(strip, "input_3")
407
408         if strip.type == 'COLOR':
409             layout.prop(strip, "color")
410
411         elif strip.type == 'WIPE':
412
413             col = layout.column()
414             col.prop(strip, "transition_type")
415             col.label(text="Direction:")
416             col.row().prop(strip, "direction", expand=True)
417
418             col = layout.column()
419             col.prop(strip, "blur_width", slider=True)
420             if strip.transition_type in {'SINGLE', 'DOUBLE'}:
421                 col.prop(strip, "angle")
422
423         elif strip.type == 'GLOW':
424             flow = layout.column_flow()
425             flow.prop(strip, "threshold", slider=True)
426             flow.prop(strip, "clamp", slider=True)
427             flow.prop(strip, "boost_factor")
428             flow.prop(strip, "blur_radius")
429
430             row = layout.row()
431             row.prop(strip, "quality", slider=True)
432             row.prop(strip, "use_only_boost")
433
434         elif strip.type == 'SPEED':
435             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
436             if not strip.use_default_fade:
437                 layout.prop(strip, "use_as_speed")
438                 if strip.use_as_speed:
439                     layout.prop(strip, "speed_factor")
440                 else:
441                     layout.prop(strip, "speed_factor", text="Frame number")
442                     layout.prop(strip, "scale_to_length")
443
444             #doesn't work currently
445             #layout.prop(strip, "use_frame_blend")
446
447         elif strip.type == 'TRANSFORM':
448             self.draw_panel_transform(strip)
449
450         elif strip.type == "MULTICAM":
451             layout.prop(strip, "multicam_source")
452
453             row = layout.row(align=True)
454             sub = row.row()
455             sub.scale_x = 2.0
456
457             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
458
459             row.label("Cut To")
460             for i in range(1, strip.channel):
461                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
462
463         col = layout.column(align=True)
464         if strip.type == 'SPEED':
465             col.prop(strip, "multiply_speed")
466         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
467                 col.prop(strip, "use_default_fade", "Default fade")
468                 if not strip.use_default_fade:
469                     col.prop(strip, "effect_fader", text="Effect fader")
470
471         layout.prop(strip, "use_translation", text="Image Offset:")
472         if strip.use_translation:
473             col = layout.column(align=True)
474             col.prop(strip.transform, "offset_x", text="X")
475             col.prop(strip.transform, "offset_y", text="Y")
476
477         layout.prop(strip, "use_crop", text="Image Crop:")
478         if strip.use_crop:
479             col = layout.column(align=True)
480             col.prop(strip.crop, "max_y")
481             col.prop(strip.crop, "min_x")
482             col.prop(strip.crop, "min_y")
483             col.prop(strip.crop, "max_x")
484
485     def draw_panel_transform(self, strip):
486         layout = self.layout
487         col = layout.column()
488
489         col.prop(strip, "interpolation")
490         col.prop(strip, "translation_unit")
491         col = layout.column(align=True)
492         col.label(text="Position:")
493         col.prop(strip, "translate_start_x", text="X")
494         col.prop(strip, "translate_start_y", text="Y")
495
496         layout.separator()
497
498         col = layout.column(align=True)
499         col.prop(strip, "use_uniform_scale")
500         if (strip.use_uniform_scale):
501             col = layout.column(align=True)
502             col.prop(strip, "scale_start_x", text="Scale")
503         else:
504             col = layout.column(align=True)
505             col.label(text="Scale:")
506             col.prop(strip, "scale_start_x", text="X")
507             col.prop(strip, "scale_start_y", text="Y")
508
509         layout.separator()
510
511         col = layout.column(align=True)
512         col.label(text="Rotation:")
513         col.prop(strip, "rotation_start", text="Rotation")
514
515
516 class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
517     bl_label = "Strip Input"
518
519     @classmethod
520     def poll(cls, context):
521         if not cls.has_sequencer(context):
522             return False
523
524         strip = act_strip(context)
525         if not strip:
526             return False
527
528         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
529                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
530                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
531                               'PLUGIN',
532                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
533                               'MULTICAM', 'SPEED'}
534
535     def draw(self, context):
536         layout = self.layout
537
538         strip = act_strip(context)
539
540         seq_type = strip.type
541
542         # draw a filename if we have one
543         if seq_type == 'IMAGE':
544             split = layout.split(percentage=0.2)
545             col = split.column()
546             col.label(text="Path:")
547             col = split.column()
548             col.prop(strip, "directory", text="")
549
550             # Current element for the filename
551
552             elem = strip.getStripElem(context.scene.frame_current)
553             if elem:
554                 split = layout.split(percentage=0.2)
555                 col = split.column()
556                 col.label(text="File:")
557                 col = split.column()
558                 col.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
559
560         elif seq_type == 'MOVIE':
561             split = layout.split(percentage=0.2)
562             col = split.column()
563             col.label(text="Path:")
564             col = split.column()
565             col.prop(strip, "filepath", text="")
566             col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
567
568         # TODO, sound???
569         # end drawing filename
570
571         layout.prop(strip, "use_translation", text="Image Offset:")
572         if strip.use_translation:
573             col = layout.column(align=True)
574             col.prop(strip.transform, "offset_x", text="X")
575             col.prop(strip.transform, "offset_y", text="Y")
576
577         layout.prop(strip, "use_crop", text="Image Crop:")
578         if strip.use_crop:
579             col = layout.column(align=True)
580             col.prop(strip.crop, "max_y")
581             col.prop(strip.crop, "min_x")
582             col.prop(strip.crop, "min_y")
583             col.prop(strip.crop, "max_x")
584
585         if not isinstance(strip, bpy.types.EffectSequence):
586             col = layout.column(align=True)
587             col.label(text="Trim Duration (hard):")
588             col.prop(strip, "animation_offset_start", text="Start")
589             col.prop(strip, "animation_offset_end", text="End")
590
591         col = layout.column(align=True)
592         col.label(text="Trim Duration (soft):")
593         col.prop(strip, "frame_offset_start", text="Start")
594         col.prop(strip, "frame_offset_end", text="End")
595
596
597 class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
598     bl_label = "Sound"
599
600     @classmethod
601     def poll(cls, context):
602         if not cls.has_sequencer(context):
603             return False
604
605         strip = act_strip(context)
606         if not strip:
607             return False
608
609         return (strip.type == 'SOUND')
610
611     def draw(self, context):
612         layout = self.layout
613
614         strip = act_strip(context)
615
616         layout.template_ID(strip, "sound", open="sound.open")
617
618         layout.separator()
619         layout.prop(strip, "filepath", text="")
620
621         row = layout.row()
622         if strip.sound.packed_file:
623             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
624         else:
625             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
626
627         row.prop(strip.sound, "use_memory_cache")
628
629         layout.prop(strip, "volume")
630         layout.prop(strip, "attenuation")
631
632         col = layout.column(align=True)
633         col.label(text="Trim Duration:")
634         col.prop(strip, "animation_offset_start", text="Start")
635         col.prop(strip, "animation_offset_end", text="End")
636
637
638 class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
639     bl_label = "Scene"
640
641     @classmethod
642     def poll(cls, context):
643         if not cls.has_sequencer(context):
644             return False
645
646         strip = act_strip(context)
647         if not strip:
648             return False
649
650         return (strip.type == 'SCENE')
651
652     def draw(self, context):
653         layout = self.layout
654
655         strip = act_strip(context)
656
657         layout.template_ID(strip, "scene")
658
659         layout.label(text="Camera Override")
660         layout.template_ID(strip, "scene_camera")
661
662         sce = strip.scene
663         layout.label(text="Original frame range: %d-%d (%d)" % (sce.frame_start, sce.frame_end, sce.frame_end - sce.frame_start + 1))
664
665
666 class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
667     bl_label = "Filter"
668
669     @classmethod
670     def poll(cls, context):
671         if not cls.has_sequencer(context):
672             return False
673
674         strip = act_strip(context)
675         if not strip:
676             return False
677
678         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
679                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
680                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
681                               'PLUGIN',
682                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
683                               'MULTICAM', 'SPEED'}
684
685     def draw(self, context):
686         layout = self.layout
687
688         strip = act_strip(context)
689
690         col = layout.column()
691         col.label(text="Video:")
692         col.prop(strip, "strobe")
693
694         row = layout.row()
695         row.label(text="Flip:")
696         row.prop(strip, "use_flip_x", text="X")
697         row.prop(strip, "use_flip_y", text="Y")
698
699         col = layout.column()
700         col.prop(strip, "use_reverse_frames", text="Backwards")
701         col.prop(strip, "use_deinterlace")
702
703         col = layout.column()
704         col.label(text="Colors:")
705         col.prop(strip, "color_saturation", text="Saturation")
706         col.prop(strip, "color_multiply", text="Multiply")
707         col.prop(strip, "use_premultiply")
708         col.prop(strip, "use_float")
709
710         layout.prop(strip, "use_color_balance")
711         if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
712             row = layout.row()
713             row.active = strip.use_color_balance
714             col = row.column()
715             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
716             col.row().prop(strip.color_balance, "lift")
717             col.prop(strip.color_balance, "invert_lift", text="Inverse")
718             col = row.column()
719             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
720             col.row().prop(strip.color_balance, "gamma")
721             col.prop(strip.color_balance, "invert_gamma", text="Inverse")
722             col = row.column()
723             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
724             col.row().prop(strip.color_balance, "gain")
725             col.prop(strip.color_balance, "invert_gain", text="Inverse")
726
727
728 class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
729     bl_label = "Proxy"
730
731     @classmethod
732     def poll(cls, context):
733         if not cls.has_sequencer(context):
734             return False
735
736         strip = act_strip(context)
737         if not strip:
738             return False
739
740         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
741
742     def draw_header(self, context):
743         strip = act_strip(context)
744
745         self.layout.prop(strip, "use_proxy", text="")
746
747     def draw(self, context):
748         layout = self.layout
749
750         strip = act_strip(context)
751
752         flow = layout.column_flow()
753         flow.prop(strip, "use_proxy_custom_directory")
754         flow.prop(strip, "use_proxy_custom_file")
755         if strip.proxy:  # TODO - need to add this somehow
756             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
757                 flow.prop(strip.proxy, "directory")
758             if strip.use_proxy_custom_file:
759                 flow.prop(strip.proxy, "filepath")
760
761
762 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
763     bl_label = "Scene Preview/Render"
764     bl_space_type = 'SEQUENCE_EDITOR'
765     bl_region_type = 'UI'
766
767     def draw(self, context):
768         layout = self.layout
769         render = context.scene.render
770
771         col = layout.column()
772         col.active = False  # Currently only opengl preview works!
773         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
774         col = layout.column()
775         #col.active = render.use_sequencer_gl_preview
776         col.prop(render, "sequencer_gl_preview", text="")
777
778         '''
779         col = layout.column()
780         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
781         col = layout.column()
782         col.active = render.use_sequencer_gl_render
783         col.prop(render, "sequencer_gl_render", text="")
784         '''
785
786
787 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
788     bl_label = "View Settings"
789
790     def draw(self, context):
791         layout = self.layout
792
793         st = context.space_data
794
795         col = layout.column()
796         if st.display_mode == 'IMAGE':
797             col.prop(st, "draw_overexposed")  # text="Zebra"
798             col.prop(st, "show_safe_margin")
799         if st.display_mode == 'WAVEFORM':
800             col.prop(st, "show_separate_color")
801         col.prop(st, "proxy_render_size")