- saturation option for sequencer strips, runs before multiply and color balance.
[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         sub = row.row()
361         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
362         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
363
364         col = layout.column()
365         sub = col.column()
366         sub.enabled = not strip.lock
367         sub.prop(strip, "channel")
368         sub.prop(strip, "frame_start")
369         sub.prop(strip, "frame_final_length")
370
371         col = layout.column(align=True)
372         row = col.row()
373         row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_length))
374         row = col.row()
375         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_length)
376         row.label(text="Strip Position: %d" % (frame_current - strip.frame_start))
377
378         col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
379         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
380
381
382 class SEQUENCER_PT_preview(bpy.types.Panel):
383     bl_label = "Scene Preview/Render"
384     bl_space_type = 'SEQUENCE_EDITOR'
385     bl_region_type = 'UI'
386
387     def draw(self, context):
388         layout = self.layout
389         render = context.scene.render
390
391         col = layout.column()
392         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
393         col = layout.column()
394         col.active = render.use_sequencer_gl_preview
395         col.prop(render, "sequencer_gl_preview", text="")
396
397         '''
398         col = layout.column()
399         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
400         col = layout.column()
401         col.active = render.use_sequencer_gl_render
402         col.prop(render, "sequencer_gl_render", text="")
403         '''
404
405
406 class SEQUENCER_PT_effect(SequencerButtonsPanel):
407     bl_label = "Effect Strip"
408
409     def poll(self, context):
410         if not self.has_sequencer(context):
411             return False
412
413         strip = act_strip(context)
414         if not strip:
415             return False
416
417         return strip.type in ('ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
418                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
419                               'PLUGIN',
420                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
421                               'MULTICAM')
422
423     def draw(self, context):
424         layout = self.layout
425
426         strip = act_strip(context)
427
428         if strip.type == 'COLOR':
429             layout.prop(strip, "color")
430
431         elif strip.type == 'WIPE':
432
433             col = layout.column()
434             col.prop(strip, "transition_type")
435             col.label(text="Direction:")
436             col.row().prop(strip, "direction", expand=True)
437
438             col = layout.column()
439             col.prop(strip, "blur_width", slider=True)
440             if strip.transition_type in ('SINGLE', 'DOUBLE'):
441                 col.prop(strip, "angle")
442
443         elif strip.type == 'GLOW':
444             flow = layout.column_flow()
445             flow.prop(strip, "threshold", slider=True)
446             flow.prop(strip, "clamp", slider=True)
447             flow.prop(strip, "boost_factor")
448             flow.prop(strip, "blur_distance")
449
450             row = layout.row()
451             row.prop(strip, "quality", slider=True)
452             row.prop(strip, "only_boost")
453
454         elif strip.type == 'SPEED':
455             layout.prop(strip, "global_speed")
456
457             flow = layout.column_flow()
458             flow.prop(strip, "curve_velocity")
459             flow.prop(strip, "curve_compress_y")
460             flow.prop(strip, "frame_blending")
461
462         elif strip.type == 'TRANSFORM':
463             self.draw_panel_transform(strip)
464
465         elif strip.type == "MULTICAM":
466             layout.prop(strip, "multicam_source")
467
468             row = layout.row(align=True)
469             sub = row.row()
470             sub.scale_x = 2.0
471
472             if not context.screen.animation_playing:
473                 sub.operator("screen.animation_play", text="", icon='PLAY')
474             else:
475                 sub.operator("screen.animation_play", text="", icon='PAUSE')
476
477             row.label("Cut To")
478             for i in range(1, strip.channel):
479                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
480
481
482         col = layout.column(align=True)
483         if strip.type == 'SPEED':
484             col.prop(strip, "speed_fader", text="Speed fader")
485         elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'):
486                 col.prop(strip, "use_effect_default_fade", "Default fade")
487                 if not strip.use_effect_default_fade:
488                     col.prop(strip, "effect_fader", text="Effect fader")
489
490     def draw_panel_transform(self, strip):
491         layout = self.layout
492         col = layout.column()
493
494         col.prop(strip, "interpolation")
495         col.prop(strip, "translation_unit")
496         col = layout.column(align=True)
497         col.label(text="Position:")
498         col.prop(strip, "translate_start_x", text="X")
499         col.prop(strip, "translate_start_y", text="Y")
500
501         layout.separator()
502
503         col = layout.column(align=True)
504         col.prop(strip, "uniform_scale")
505         if (strip.uniform_scale):
506             col = layout.column(align=True)
507             col.prop(strip, "scale_start_x", text="Scale")
508         else:
509             col = layout.column(align=True)
510             col.label(text="Scale:")
511             col.prop(strip, "scale_start_x", text="X")
512             col.prop(strip, "scale_start_y", text="Y")
513
514         layout.separator()
515
516         col = layout.column(align=True)
517         col.label(text="Rotation:")
518         col.prop(strip, "rotation_start", text="Rotation")
519
520
521 class SEQUENCER_PT_input(SequencerButtonsPanel):
522     bl_label = "Strip Input"
523
524     def poll(self, context):
525         if not self.has_sequencer(context):
526             return False
527
528         strip = act_strip(context)
529         if not strip:
530             return False
531
532         return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META',
533                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
534                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
535                               'PLUGIN',
536                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
537                               'MULTICAM', 'SPEED')
538
539     def draw_filename(self, context):
540         pass
541
542     def draw(self, context):
543         layout = self.layout
544
545         strip = act_strip(context)
546
547         self.draw_filename(context)
548
549         layout.prop(strip, "use_translation", text="Image Offset:")
550         if strip.use_translation:
551             col = layout.column(align=True)
552             col.prop(strip.transform, "offset_x", text="X")
553             col.prop(strip.transform, "offset_y", text="Y")
554
555         layout.prop(strip, "use_crop", text="Image Crop:")
556         if strip.use_crop:
557             col = layout.column(align=True)
558             col.prop(strip.crop, "top")
559             col.prop(strip.crop, "left")
560             col.prop(strip.crop, "bottom")
561             col.prop(strip.crop, "right")
562
563         col = layout.column(align=True)
564         col.label(text="Trim Duration:")
565         col.prop(strip, "animation_start_offset", text="Start")
566         col.prop(strip, "animation_end_offset", text="End")
567
568
569 class SEQUENCER_PT_input_movie(SEQUENCER_PT_input):
570     bl_label = "Strip Input"
571
572     def poll(self, context):
573         if not self.has_sequencer(context):
574             return False
575
576         strip = act_strip(context)
577         if not strip:
578             return False
579
580         return strip.type == 'MOVIE'
581
582     def draw_filename(self, context):
583         layout = self.layout
584
585         strip = act_strip(context)
586
587         split = layout.split(percentage=0.2)
588         col = split.column()
589         col.label(text="Path:")
590         col = split.column()
591         col.prop(strip, "filepath", text="")
592
593
594 class SEQUENCER_PT_input_image(SEQUENCER_PT_input):
595     bl_label = "Strip Input"
596
597     def poll(self, context):
598         if not self.has_sequencer(context):
599             return False
600
601         strip = act_strip(context)
602         if not strip:
603             return False
604
605         return strip.type == 'IMAGE'
606
607     def draw_filename(self, context):
608         layout = self.layout
609
610         strip = act_strip(context)
611
612         split = layout.split(percentage=0.2)
613         col = split.column()
614         col.label(text="Path:")
615         col = split.column()
616         col.prop(strip, "directory", text="")
617
618         # Current element for the filename
619
620         elem = strip.getStripElem(context.scene.frame_current)
621         if elem:
622             split = layout.split(percentage=0.2)
623             col = split.column()
624             col.label(text="File:")
625             col = split.column()
626             col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
627
628
629 class SEQUENCER_PT_input_secondary(SEQUENCER_PT_input):
630     bl_label = "Strip Input"
631
632     def poll(self, context):
633         if not self.has_sequencer(context):
634             return False
635
636         strip = act_strip(context)
637         if not strip:
638             return False
639
640         return strip.type in ('SCENE', 'META')
641
642     def draw_filename(self, context):
643         pass
644
645
646 class SEQUENCER_PT_sound(SequencerButtonsPanel):
647     bl_label = "Sound"
648
649     def poll(self, context):
650         if not self.has_sequencer(context):
651             return False
652
653         strip = act_strip(context)
654         if not strip:
655             return False
656
657         return (strip.type == 'SOUND')
658
659     def draw(self, context):
660         layout = self.layout
661
662         strip = act_strip(context)
663
664         layout.template_ID(strip, "sound", open="sound.open")
665
666         layout.separator()
667         layout.prop(strip, "filepath", text="")
668
669         row = layout.row()
670         if strip.sound.packed_file:
671             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
672         else:
673             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
674
675         row.prop(strip.sound, "caching")
676
677         layout.prop(strip, "volume")
678         layout.prop(strip, "attenuation")
679
680         col = layout.column(align=True)
681         col.label(text="Trim Duration:")
682         col.prop(strip, "animation_start_offset", text="Start")
683         col.prop(strip, "animation_end_offset", text="End")
684
685
686 class SEQUENCER_PT_scene(SequencerButtonsPanel):
687     bl_label = "Scene"
688
689     def poll(self, context):
690         if not self.has_sequencer(context):
691             return False
692
693         strip = act_strip(context)
694         if not strip:
695             return False
696
697         return (strip.type == 'SCENE')
698
699     def draw(self, context):
700         layout = self.layout
701
702         strip = act_strip(context)
703
704         layout.template_ID(strip, "scene")
705
706         layout.label(text="Camera Override")
707         layout.template_ID(strip, "scene_camera")
708
709
710 class SEQUENCER_PT_filter(SequencerButtonsPanel):
711     bl_label = "Filter"
712
713     def poll(self, context):
714         if not self.has_sequencer(context):
715             return False
716
717         strip = act_strip(context)
718         if not strip:
719             return False
720
721         return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META',
722                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
723                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
724                               'PLUGIN',
725                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
726                               'MULTICAM', 'SPEED')
727
728     def draw(self, context):
729         layout = self.layout
730
731         strip = act_strip(context)
732
733         col = layout.column()
734         col.label(text="Video:")
735         col.prop(strip, "strobe")
736
737         row = layout.row()
738         row.label(text="Flip:")
739         row.prop(strip, "flip_x", text="X")
740         row.prop(strip, "flip_y", text="Y")
741
742         col = layout.column()
743         col.prop(strip, "reverse_frames", text="Backwards")
744         col.prop(strip, "de_interlace")
745
746         col = layout.column()
747         col.label(text="Colors:")
748         col.prop(strip, "color_saturation", text="Saturation")
749         col.prop(strip, "multiply_colors", text="Multiply")
750         col.prop(strip, "premultiply")
751         col.prop(strip, "convert_float")
752
753         layout.prop(strip, "use_color_balance")
754         if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
755             row = layout.row()
756             row.active = strip.use_color_balance
757             col = row.column()
758             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
759             col.row().prop(strip.color_balance, "lift")
760             col.prop(strip.color_balance, "inverse_lift", text="Inverse")
761             col = row.column()
762             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
763             col.row().prop(strip.color_balance, "gamma")
764             col.prop(strip.color_balance, "inverse_gamma", text="Inverse")
765             col = row.column()
766             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
767             col.row().prop(strip.color_balance, "gain")
768             col.prop(strip.color_balance, "inverse_gain", text="Inverse")
769
770
771 class SEQUENCER_PT_proxy(SequencerButtonsPanel):
772     bl_label = "Proxy"
773
774     def poll(self, context):
775         if not self.has_sequencer(context):
776             return False
777
778         strip = act_strip(context)
779         if not strip:
780             return False
781
782         return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM')
783
784     def draw_header(self, context):
785         strip = act_strip(context)
786
787         self.layout.prop(strip, "use_proxy", text="")
788
789     def draw(self, context):
790         layout = self.layout
791
792         strip = act_strip(context)
793
794         flow = layout.column_flow()
795         flow.prop(strip, "proxy_custom_directory")
796         flow.prop(strip, "proxy_custom_file")
797         if strip.proxy: # TODO - need to add this somehow
798             if strip.proxy_custom_directory and not strip.proxy_custom_file:
799                 flow.prop(strip.proxy, "directory")
800             if strip.proxy_custom_file:
801                 flow.prop(strip.proxy, "filepath")
802
803
804 class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
805     bl_label = "View Settings"
806
807     def draw(self, context):
808         layout = self.layout
809
810         st = context.space_data
811
812         col = layout.column()
813         if st.display_mode == 'IMAGE':
814             col.prop(st, "draw_overexposed") # text="Zebra"
815             col.prop(st, "draw_safe_margin")
816         if st.display_mode == 'WAVEFORM':
817             col.prop(st, "separate_color_preview")
818         col.prop(st, "proxy_render_size")
819
820 classes = [
821     SEQUENCER_HT_header, # header/menu classes
822     SEQUENCER_MT_view,
823     SEQUENCER_MT_view_toggle,
824     SEQUENCER_MT_select,
825     SEQUENCER_MT_marker,
826     SEQUENCER_MT_add,
827     SEQUENCER_MT_add_effect,
828     SEQUENCER_MT_strip,
829
830     SEQUENCER_PT_edit, # sequencer panels
831     SEQUENCER_PT_preview,
832     SEQUENCER_PT_effect,
833     SEQUENCER_PT_input_movie,
834     SEQUENCER_PT_input_image,
835     SEQUENCER_PT_input_secondary,
836     SEQUENCER_PT_sound,
837     SEQUENCER_PT_scene,
838     SEQUENCER_PT_filter,
839     SEQUENCER_PT_proxy,
840
841     SEQUENCER_PT_view] # view panels
842
843
844 def register():
845     register = bpy.types.register
846     for cls in classes:
847         register(cls)
848
849
850 def unregister():
851     unregister = bpy.types.unregister
852     for cls in classes:
853         unregister(cls)
854
855 if __name__ == "__main__":
856     register()