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