23dfdcfba90d9027a36a5950425fe32d386964e9
[blender.git] / release / scripts / startup / bl_ui / space_sequencer.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Header, Menu, Panel
22
23
24 def act_strip(context):
25     try:
26         return context.scene.sequence_editor.active_strip
27     except AttributeError:
28         return None
29
30
31 class SEQUENCER_HT_header(Header):
32     bl_space_type = 'SEQUENCE_EDITOR'
33
34     def draw(self, context):
35         layout = self.layout
36
37         st = context.space_data
38
39         row = layout.row(align=True)
40         row.template_header()
41
42         if context.area.show_menus:
43             row.menu("SEQUENCER_MT_view")
44
45             if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
46                 row.menu("SEQUENCER_MT_select")
47                 row.menu("SEQUENCER_MT_marker")
48                 row.menu("SEQUENCER_MT_add")
49                 row.menu("SEQUENCER_MT_strip")
50
51         layout.prop(st, "view_type", expand=True, text="")
52
53         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
54             layout.prop(st, "display_mode", expand=True, text="")
55
56         if st.view_type == 'SEQUENCER':
57             row = layout.row(align=True)
58             row.operator("sequencer.copy", text="", icon='COPYDOWN')
59             row.operator("sequencer.paste", text="", icon='PASTEDOWN')
60
61             layout.separator()
62             layout.operator("sequencer.refresh_all")
63         elif st.view_type == 'SEQUENCER_PREVIEW':
64             layout.separator()
65             layout.operator("sequencer.refresh_all")
66             layout.prop(st, "display_channel", text="Channel")
67         else:
68             layout.prop(st, "display_channel", text="Channel")
69
70             ed = context.scene.sequence_editor
71             if ed:
72                 row = layout.row(align=True)
73                 row.prop(ed, "show_overlay", text="", icon='GHOST_ENABLED')
74                 if ed.show_overlay:
75                     row.prop(ed, "overlay_frame", text="")
76                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
77
78
79 class SEQUENCER_MT_view_toggle(Menu):
80     bl_label = "View Type"
81
82     def draw(self, context):
83         layout = self.layout
84
85         layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
86         layout.operator("sequencer.view_toggle").type = 'PREVIEW'
87         layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
88
89
90 class SEQUENCER_MT_view(Menu):
91     bl_label = "View"
92
93     def draw(self, context):
94         layout = self.layout
95
96         st = context.space_data
97
98         layout.operator("sequencer.properties", icon='MENU_PANEL')
99
100         layout.separator()
101
102         if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
103             layout.operator("sequencer.view_all", text='View all Sequences')
104         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
105             layout.operator_context = 'INVOKE_REGION_PREVIEW'
106             layout.operator("sequencer.view_all_preview", text='Fit preview in window')
107             layout.operator("sequencer.view_zoom_ratio", text='Show preview 1:1').ratio = 1.0
108             layout.operator_context = 'INVOKE_DEFAULT'
109
110             # # XXX, invokes in the header view
111             # layout.operator("sequencer.view_ghost_border", text='Overlay Border')
112
113         layout.operator("sequencer.view_selected")
114
115         layout.prop(st, "show_frames")
116         layout.prop(st, "show_frame_indicator")
117         if st.display_mode == 'IMAGE':
118             layout.prop(st, "show_safe_margin")
119         if st.display_mode == 'WAVEFORM':
120             layout.prop(st, "show_separate_color")
121
122         layout.separator()
123         layout.prop(st, "use_marker_sync")
124         layout.separator()
125
126         layout.operator("screen.area_dupli")
127         layout.operator("screen.screen_full_area")
128
129
130 class SEQUENCER_MT_select(Menu):
131     bl_label = "Select"
132
133     def draw(self, context):
134         layout = self.layout
135
136         layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
137         layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
138         layout.separator()
139         layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
140         layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
141         layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
142         layout.separator()
143         layout.operator("sequencer.select_linked")
144         layout.operator("sequencer.select_all_toggle")
145         layout.operator("sequencer.select_inverse")
146
147
148 class SEQUENCER_MT_marker(Menu):
149     bl_label = "Marker"
150
151     def draw(self, context):
152         layout = self.layout
153
154         #layout.operator_context = 'EXEC_REGION_WIN'
155
156         layout.operator("marker.add", "Add Marker")
157         layout.operator("marker.duplicate", text="Duplicate Marker")
158         layout.operator("marker.delete", text="Delete Marker")
159
160         layout.separator()
161
162         layout.operator("marker.rename", text="Rename Marker")
163         layout.operator("marker.move", text="Grab/Move Marker")
164
165         #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
166
167
168 class SEQUENCER_MT_change(Menu):
169     bl_label = "Change"
170
171     def draw(self, context):
172         layout = self.layout
173
174         layout.operator_context = 'INVOKE_REGION_WIN'
175
176         layout.operator_menu_enum("sequencer.change_effect_input", "swap")
177         layout.operator_menu_enum("sequencer.change_effect_type", "type")
178         layout.operator("sequencer.change_path", text="Path/Files")
179
180
181 class SEQUENCER_MT_add(Menu):
182     bl_label = "Add"
183
184     def draw(self, context):
185         layout = self.layout
186         layout.operator_context = 'INVOKE_REGION_WIN'
187
188         if len(bpy.data.scenes) > 10:
189             layout.operator_context = 'INVOKE_DEFAULT'
190             layout.operator("sequencer.scene_strip_add", text="Scene...")
191         else:
192             layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
193
194         layout.operator("sequencer.movie_strip_add", text="Movie")
195         layout.operator("sequencer.image_strip_add", text="Image")
196         layout.operator("sequencer.sound_strip_add", text="Sound")
197
198         layout.menu("SEQUENCER_MT_add_effect")
199
200
201 class SEQUENCER_MT_add_effect(Menu):
202     bl_label = "Effect Strip..."
203
204     def draw(self, context):
205         layout = self.layout
206         layout.operator_context = 'INVOKE_REGION_WIN'
207
208         layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
209         layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
210         layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
211         layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
212         layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
213         layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
214         layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
215         layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
216         layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
217         layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
218         layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
219         layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
220         layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
221         layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
222         layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
223         layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT'
224
225
226 class SEQUENCER_MT_strip(Menu):
227     bl_label = "Strip"
228
229     def draw(self, context):
230         layout = self.layout
231
232         layout.operator_context = 'INVOKE_REGION_WIN'
233
234         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
235         layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
236         #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
237         layout.separator()
238
239         layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
240         layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
241         layout.operator("sequencer.images_separate")
242         layout.operator("sequencer.deinterlace_selected_movies")
243         layout.separator()
244
245         layout.operator("sequencer.duplicate")
246         layout.operator("sequencer.delete")
247
248         strip = act_strip(context)
249
250         if strip:
251             stype = strip.type
252
253             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
254             if stype == 'EFFECT':
255                 pass
256                 # layout.separator()
257                 # layout.operator("sequencer.effect_change")
258                 # layout.operator("sequencer.effect_reassign_inputs")
259             elif stype == 'IMAGE':
260                 layout.separator()
261                 # layout.operator("sequencer.image_change")
262                 layout.operator("sequencer.rendersize")
263             elif stype == 'SCENE':
264                 pass
265                 # layout.separator()
266                 # layout.operator("sequencer.scene_change", text="Change Scene")
267             elif stype == 'MOVIE':
268                 layout.separator()
269                 # layout.operator("sequencer.movie_change")
270                 layout.operator("sequencer.rendersize")
271
272         layout.separator()
273
274         layout.operator("sequencer.meta_make")
275         layout.operator("sequencer.meta_separate")
276
277         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
278         #       uiItemS(layout);
279         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
280         #}
281
282         layout.separator()
283         layout.operator("sequencer.reload")
284         layout.operator("sequencer.reassign_inputs")
285         layout.operator("sequencer.swap_inputs")
286         layout.separator()
287         layout.operator("sequencer.lock")
288         layout.operator("sequencer.unlock")
289         layout.operator("sequencer.mute")
290         layout.operator("sequencer.unmute")
291
292         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
293
294         layout.operator("sequencer.snap")
295
296         layout.operator_menu_enum("sequencer.swap", "side")
297
298         layout.separator()
299
300         layout.operator("sequencer.swap_data")
301         layout.menu("SEQUENCER_MT_change")
302
303
304 class SequencerButtonsPanel():
305     bl_space_type = 'SEQUENCE_EDITOR'
306     bl_region_type = 'UI'
307
308     @staticmethod
309     def has_sequencer(context):
310         return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
311
312     @classmethod
313     def poll(cls, context):
314         return cls.has_sequencer(context) and (act_strip(context) is not None)
315
316
317 class SequencerButtonsPanel_Output():
318     bl_space_type = 'SEQUENCE_EDITOR'
319     bl_region_type = 'UI'
320
321     @staticmethod
322     def has_preview(context):
323         return (context.space_data.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'})
324
325     @classmethod
326     def poll(cls, context):
327         return cls.has_preview(context)
328
329
330 class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
331     bl_label = "Edit Strip"
332
333     def draw(self, context):
334         layout = self.layout
335         scene = context.scene
336         frame_current = scene.frame_current
337         strip = act_strip(context)
338
339         split = layout.split(percentage=0.3)
340         split.label(text="Name:")
341         split.prop(strip, "name", text="")
342
343         split = layout.split(percentage=0.3)
344         split.label(text="Type:")
345         split.prop(strip, "type", text="")
346
347         split = layout.split(percentage=0.3)
348         split.label(text="Blend:")
349         split.prop(strip, "blend_type", text="")
350
351         row = layout.row(align=True)
352         sub = row.row()
353         sub.active = (not strip.mute)
354         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
355         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
356         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
357
358         col = layout.column()
359         sub = col.column()
360         sub.enabled = not strip.lock
361         sub.prop(strip, "channel")
362         sub.prop(strip, "frame_start")
363         sub.prop(strip, "frame_final_duration")
364
365         col = layout.column(align=True)
366         row = col.row()
367         row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
368         row = col.row()
369         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
370         row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
371
372         col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
373         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
374
375         elem = False
376
377         if strip.type == 'IMAGE':
378             elem = strip.getStripElem(frame_current)
379         elif strip.type == 'MOVIE':
380             elem = strip.elements[0]
381
382         if elem and elem.orig_width > 0 and elem.orig_height > 0:
383             col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
384
385
386 class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
387     bl_label = "Effect Strip"
388
389     @classmethod
390     def poll(cls, context):
391         if not cls.has_sequencer(context):
392             return False
393
394         strip = act_strip(context)
395         if not strip:
396             return False
397
398         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
399                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
400                               'PLUGIN',
401                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
402                               'MULTICAM', 'ADJUSTMENT'}
403
404     def draw(self, context):
405         layout = self.layout
406
407         strip = act_strip(context)
408         if strip.input_count > 0:
409             col = layout.column()
410             col.prop(strip, "input_1")
411             if strip.input_count > 1:
412                 col.prop(strip, "input_2")
413             if strip.input_count > 2:
414                 col.prop(strip, "input_3")
415
416         if strip.type == 'COLOR':
417             layout.prop(strip, "color")
418
419         elif strip.type == 'WIPE':
420
421             col = layout.column()
422             col.prop(strip, "transition_type")
423             col.label(text="Direction:")
424             col.row().prop(strip, "direction", expand=True)
425
426             col = layout.column()
427             col.prop(strip, "blur_width", slider=True)
428             if strip.transition_type in {'SINGLE', 'DOUBLE'}:
429                 col.prop(strip, "angle")
430
431         elif strip.type == 'GLOW':
432             flow = layout.column_flow()
433             flow.prop(strip, "threshold", slider=True)
434             flow.prop(strip, "clamp", slider=True)
435             flow.prop(strip, "boost_factor")
436             flow.prop(strip, "blur_radius")
437
438             row = layout.row()
439             row.prop(strip, "quality", slider=True)
440             row.prop(strip, "use_only_boost")
441
442         elif strip.type == 'SPEED':
443             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
444             if not strip.use_default_fade:
445                 layout.prop(strip, "use_as_speed")
446                 if strip.use_as_speed:
447                     layout.prop(strip, "speed_factor")
448                 else:
449                     layout.prop(strip, "speed_factor", text="Frame number")
450                     layout.prop(strip, "scale_to_length")
451
452             #doesn't work currently
453             #layout.prop(strip, "use_frame_blend")
454
455         elif strip.type == 'TRANSFORM':
456             self.draw_panel_transform(strip)
457
458         elif strip.type == "MULTICAM":
459             layout.prop(strip, "multicam_source")
460
461             row = layout.row(align=True)
462             sub = row.row()
463             sub.scale_x = 2.0
464
465             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
466
467             row.label("Cut To")
468             for i in range(1, strip.channel):
469                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
470
471         col = layout.column(align=True)
472         if strip.type == 'SPEED':
473             col.prop(strip, "multiply_speed")
474         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
475                 col.prop(strip, "use_default_fade", "Default fade")
476                 if not strip.use_default_fade:
477                     col.prop(strip, "effect_fader", text="Effect fader")
478
479         layout.prop(strip, "use_translation", text="Image Offset:")
480         if strip.use_translation:
481             col = layout.column(align=True)
482             col.prop(strip.transform, "offset_x", text="X")
483             col.prop(strip.transform, "offset_y", text="Y")
484
485         layout.prop(strip, "use_crop", text="Image Crop:")
486         if strip.use_crop:
487             col = layout.column(align=True)
488             col.prop(strip.crop, "max_y")
489             col.prop(strip.crop, "min_x")
490             col.prop(strip.crop, "min_y")
491             col.prop(strip.crop, "max_x")
492
493     def draw_panel_transform(self, strip):
494         layout = self.layout
495         col = layout.column()
496
497         col.prop(strip, "interpolation")
498         col.prop(strip, "translation_unit")
499         col = layout.column(align=True)
500         col.label(text="Position:")
501         col.prop(strip, "translate_start_x", text="X")
502         col.prop(strip, "translate_start_y", text="Y")
503
504         layout.separator()
505
506         col = layout.column(align=True)
507         col.prop(strip, "use_uniform_scale")
508         if (strip.use_uniform_scale):
509             col = layout.column(align=True)
510             col.prop(strip, "scale_start_x", text="Scale")
511         else:
512             col = layout.column(align=True)
513             col.label(text="Scale:")
514             col.prop(strip, "scale_start_x", text="X")
515             col.prop(strip, "scale_start_y", text="Y")
516
517         layout.separator()
518
519         col = layout.column(align=True)
520         col.label(text="Rotation:")
521         col.prop(strip, "rotation_start", text="Rotation")
522
523
524 class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
525     bl_label = "Strip Input"
526
527     @classmethod
528     def poll(cls, context):
529         if not cls.has_sequencer(context):
530             return False
531
532         strip = act_strip(context)
533         if not strip:
534             return False
535
536         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
537                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
538                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
539                               'PLUGIN',
540                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
541                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
542
543     def draw(self, context):
544         layout = self.layout
545
546         strip = act_strip(context)
547
548         seq_type = strip.type
549
550         # draw a filename if we have one
551         if seq_type == 'IMAGE':
552             split = layout.split(percentage=0.2)
553             col = split.column()
554             col.label(text="Path:")
555             col = split.column()
556             col.prop(strip, "directory", text="")
557
558             # Current element for the filename
559
560             elem = strip.getStripElem(context.scene.frame_current)
561             if elem:
562                 split = layout.split(percentage=0.2)
563                 col = split.column()
564                 col.label(text="File:")
565                 col = split.column()
566                 col.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
567
568         elif seq_type == 'MOVIE':
569             split = layout.split(percentage=0.2)
570             col = split.column()
571             col.label(text="Path:")
572             col = split.column()
573             col.prop(strip, "filepath", text="")
574             col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
575
576         # TODO, sound???
577         # end drawing filename
578
579         layout.prop(strip, "use_translation", text="Image Offset:")
580         if strip.use_translation:
581             col = layout.column(align=True)
582             col.prop(strip.transform, "offset_x", text="X")
583             col.prop(strip.transform, "offset_y", text="Y")
584
585         layout.prop(strip, "use_crop", text="Image Crop:")
586         if strip.use_crop:
587             col = layout.column(align=True)
588             col.prop(strip.crop, "max_y")
589             col.prop(strip.crop, "min_x")
590             col.prop(strip.crop, "min_y")
591             col.prop(strip.crop, "max_x")
592
593         if not isinstance(strip, bpy.types.EffectSequence):
594             col = layout.column(align=True)
595             col.label(text="Trim Duration (hard):")
596             col.prop(strip, "animation_offset_start", text="Start")
597             col.prop(strip, "animation_offset_end", text="End")
598
599         col = layout.column(align=True)
600         col.label(text="Trim Duration (soft):")
601         col.prop(strip, "frame_offset_start", text="Start")
602         col.prop(strip, "frame_offset_end", text="End")
603
604
605 class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
606     bl_label = "Sound"
607
608     @classmethod
609     def poll(cls, context):
610         if not cls.has_sequencer(context):
611             return False
612
613         strip = act_strip(context)
614         if not strip:
615             return False
616
617         return (strip.type == 'SOUND')
618
619     def draw(self, context):
620         layout = self.layout
621
622         strip = act_strip(context)
623
624         layout.template_ID(strip, "sound", open="sound.open")
625
626         layout.separator()
627         layout.prop(strip, "filepath", text="")
628
629         row = layout.row()
630         if strip.sound.packed_file:
631             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
632         else:
633             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
634
635         row.prop(strip.sound, "use_memory_cache")
636
637         layout.prop(strip, "volume")
638         layout.prop(strip, "attenuation")
639
640         col = layout.column(align=True)
641         col.label(text="Trim Duration:")
642         col.prop(strip, "animation_offset_start", text="Start")
643         col.prop(strip, "animation_offset_end", text="End")
644
645
646 class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
647     bl_label = "Scene"
648
649     @classmethod
650     def poll(cls, context):
651         if not cls.has_sequencer(context):
652             return False
653
654         strip = act_strip(context)
655         if not strip:
656             return False
657
658         return (strip.type == 'SCENE')
659
660     def draw(self, context):
661         layout = self.layout
662
663         strip = act_strip(context)
664
665         layout.template_ID(strip, "scene")
666
667         scene = strip.scene
668         if scene:
669             layout.prop(scene.render, "use_sequencer")
670
671         layout.label(text="Camera Override")
672         layout.template_ID(strip, "scene_camera")
673
674         if scene:
675             sta = scene.frame_start
676             end = scene.frame_end
677             layout.label(text="Original frame range: %d-%d (%d)" % (sta, end, end - sta + 1))
678
679
680 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
681     bl_label = "Filter"
682
683     @classmethod
684     def poll(cls, context):
685         if not cls.has_sequencer(context):
686             return False
687
688         strip = act_strip(context)
689         if not strip:
690             return False
691
692         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
693                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
694                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
695                               'PLUGIN',
696                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
697                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
698
699     def draw(self, context):
700         layout = self.layout
701
702         strip = act_strip(context)
703
704         col = layout.column()
705         col.label(text="Video:")
706         col.prop(strip, "strobe")
707
708         row = layout.row()
709         row.label(text="Flip:")
710         row.prop(strip, "use_flip_x", text="X")
711         row.prop(strip, "use_flip_y", text="Y")
712
713         col = layout.column()
714         col.prop(strip, "use_reverse_frames", text="Backwards")
715         col.prop(strip, "use_deinterlace")
716
717         col = layout.column()
718         col.label(text="Colors:")
719         col.prop(strip, "color_saturation", text="Saturation")
720         col.prop(strip, "color_multiply", text="Multiply")
721         col.prop(strip, "use_premultiply")
722         col.prop(strip, "use_float")
723
724         layout.prop(strip, "use_color_balance")
725         if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
726             row = layout.row()
727             row.active = strip.use_color_balance
728             col = row.column()
729             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
730             col.row().prop(strip.color_balance, "lift")
731             col.prop(strip.color_balance, "invert_lift", text="Inverse")
732             col = row.column()
733             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
734             col.row().prop(strip.color_balance, "gamma")
735             col.prop(strip.color_balance, "invert_gamma", text="Inverse")
736             col = row.column()
737             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
738             col.row().prop(strip.color_balance, "gain")
739             col.prop(strip.color_balance, "invert_gain", text="Inverse")
740
741
742 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
743     bl_label = "Proxy"
744
745     @classmethod
746     def poll(cls, context):
747         if not cls.has_sequencer(context):
748             return False
749
750         strip = act_strip(context)
751         if not strip:
752             return False
753
754         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
755
756     def draw_header(self, context):
757         strip = act_strip(context)
758
759         self.layout.prop(strip, "use_proxy", text="")
760
761     def draw(self, context):
762         layout = self.layout
763
764         strip = act_strip(context)
765
766         flow = layout.column_flow()
767         flow.prop(strip, "use_proxy_custom_directory")
768         flow.prop(strip, "use_proxy_custom_file")
769         if strip.proxy:  # TODO - need to add this somehow
770             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
771                 flow.prop(strip.proxy, "directory")
772             if strip.use_proxy_custom_file:
773                 flow.prop(strip.proxy, "filepath")
774
775
776 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
777     bl_label = "Scene Preview/Render"
778     bl_space_type = 'SEQUENCE_EDITOR'
779     bl_region_type = 'UI'
780
781     def draw(self, context):
782         layout = self.layout
783         render = context.scene.render
784
785         col = layout.column()
786         col.active = False  # Currently only opengl preview works!
787         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
788         col = layout.column()
789         #col.active = render.use_sequencer_gl_preview
790         col.prop(render, "sequencer_gl_preview", text="")
791
792         '''
793         col = layout.column()
794         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
795         col = layout.column()
796         col.active = render.use_sequencer_gl_render
797         col.prop(render, "sequencer_gl_render", text="")
798         '''
799
800
801 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
802     bl_label = "View Settings"
803
804     def draw(self, context):
805         layout = self.layout
806
807         st = context.space_data
808
809         col = layout.column()
810         if st.display_mode == 'IMAGE':
811             col.prop(st, "draw_overexposed")  # text="Zebra"
812             col.prop(st, "show_safe_margin")
813         if st.display_mode == 'WAVEFORM':
814             col.prop(st, "show_separate_color")
815         col.prop(st, "proxy_render_size")
816
817 if __name__ == "__main__":  # only for live edit.
818     bpy.utils.register_module(__name__)