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