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