- recently restored sequencer change data operator didnt reset the offsets after...
[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.offset_clear")
243         layout.operator("sequencer.deinterlace_selected_movies")
244         layout.separator()
245
246         layout.operator("sequencer.duplicate")
247         layout.operator("sequencer.delete")
248
249         strip = act_strip(context)
250
251         if strip:
252             stype = strip.type
253
254             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
255             if stype == 'EFFECT':
256                 pass
257                 # layout.separator()
258                 # layout.operator("sequencer.effect_change")
259                 # layout.operator("sequencer.effect_reassign_inputs")
260             elif stype == 'IMAGE':
261                 layout.separator()
262                 # layout.operator("sequencer.image_change")
263                 layout.operator("sequencer.rendersize")
264             elif stype == 'SCENE':
265                 pass
266                 # layout.separator()
267                 # layout.operator("sequencer.scene_change", text="Change Scene")
268             elif stype == 'MOVIE':
269                 layout.separator()
270                 # layout.operator("sequencer.movie_change")
271                 layout.operator("sequencer.rendersize")
272
273         layout.separator()
274
275         layout.operator("sequencer.meta_make")
276         layout.operator("sequencer.meta_separate")
277
278         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
279         #       uiItemS(layout);
280         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
281         #}
282
283         layout.separator()
284         layout.operator("sequencer.reload")
285         layout.operator("sequencer.reassign_inputs")
286         layout.operator("sequencer.swap_inputs")
287         layout.separator()
288         layout.operator("sequencer.lock")
289         layout.operator("sequencer.unlock")
290         layout.operator("sequencer.mute")
291         layout.operator("sequencer.unmute")
292
293         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
294
295         layout.operator("sequencer.snap")
296
297         layout.operator_menu_enum("sequencer.swap", "side")
298
299         layout.separator()
300
301         layout.operator("sequencer.swap_data")
302         layout.menu("SEQUENCER_MT_change")
303
304
305 class SequencerButtonsPanel():
306     bl_space_type = 'SEQUENCE_EDITOR'
307     bl_region_type = 'UI'
308
309     @staticmethod
310     def has_sequencer(context):
311         return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
312
313     @classmethod
314     def poll(cls, context):
315         return cls.has_sequencer(context) and (act_strip(context) is not None)
316
317
318 class SequencerButtonsPanel_Output():
319     bl_space_type = 'SEQUENCE_EDITOR'
320     bl_region_type = 'UI'
321
322     @staticmethod
323     def has_preview(context):
324         return (context.space_data.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'})
325
326     @classmethod
327     def poll(cls, context):
328         return cls.has_preview(context)
329
330
331 class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
332     bl_label = "Edit Strip"
333
334     def draw(self, context):
335         layout = self.layout
336         scene = context.scene
337         frame_current = scene.frame_current
338         strip = act_strip(context)
339
340         split = layout.split(percentage=0.3)
341         split.label(text="Name:")
342         split.prop(strip, "name", text="")
343
344         split = layout.split(percentage=0.3)
345         split.label(text="Type:")
346         split.prop(strip, "type", text="")
347
348         split = layout.split(percentage=0.3)
349         split.label(text="Blend:")
350         split.prop(strip, "blend_type", text="")
351
352         row = layout.row(align=True)
353         sub = row.row()
354         sub.active = (not strip.mute)
355         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
356         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
357         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
358
359         col = layout.column()
360         sub = col.column()
361         sub.enabled = not strip.lock
362         sub.prop(strip, "channel")
363         sub.prop(strip, "frame_start")
364         sub.prop(strip, "frame_final_duration")
365
366         col = layout.column(align=True)
367         row = col.row()
368         row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
369         row = col.row()
370         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
371         row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
372
373         col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
374         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
375
376         elem = False
377
378         if strip.type == 'IMAGE':
379             elem = strip.getStripElem(frame_current)
380         elif strip.type == 'MOVIE':
381             elem = strip.elements[0]
382
383         if elem and elem.orig_width > 0 and elem.orig_height > 0:
384             col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
385         else:
386             col.label(text="Orig Dim: None")
387
388
389 class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
390     bl_label = "Effect Strip"
391
392     @classmethod
393     def poll(cls, context):
394         if not cls.has_sequencer(context):
395             return False
396
397         strip = act_strip(context)
398         if not strip:
399             return False
400
401         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
402                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
403                               'PLUGIN',
404                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
405                               'MULTICAM', 'ADJUSTMENT'}
406
407     def draw(self, context):
408         layout = self.layout
409
410         strip = act_strip(context)
411         if strip.input_count > 0:
412             col = layout.column()
413             col.prop(strip, "input_1")
414             if strip.input_count > 1:
415                 col.prop(strip, "input_2")
416             if strip.input_count > 2:
417                 col.prop(strip, "input_3")
418
419         if strip.type == 'COLOR':
420             layout.prop(strip, "color")
421
422         elif strip.type == 'WIPE':
423
424             col = layout.column()
425             col.prop(strip, "transition_type")
426             col.label(text="Direction:")
427             col.row().prop(strip, "direction", expand=True)
428
429             col = layout.column()
430             col.prop(strip, "blur_width", slider=True)
431             if strip.transition_type in {'SINGLE', 'DOUBLE'}:
432                 col.prop(strip, "angle")
433
434         elif strip.type == 'GLOW':
435             flow = layout.column_flow()
436             flow.prop(strip, "threshold", slider=True)
437             flow.prop(strip, "clamp", slider=True)
438             flow.prop(strip, "boost_factor")
439             flow.prop(strip, "blur_radius")
440
441             row = layout.row()
442             row.prop(strip, "quality", slider=True)
443             row.prop(strip, "use_only_boost")
444
445         elif strip.type == 'SPEED':
446             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
447             if not strip.use_default_fade:
448                 layout.prop(strip, "use_as_speed")
449                 if strip.use_as_speed:
450                     layout.prop(strip, "speed_factor")
451                 else:
452                     layout.prop(strip, "speed_factor", text="Frame number")
453                     layout.prop(strip, "scale_to_length")
454
455             #doesn't work currently
456             #layout.prop(strip, "use_frame_blend")
457
458         elif strip.type == 'TRANSFORM':
459             self.draw_panel_transform(strip)
460
461         elif strip.type == "MULTICAM":
462             layout.prop(strip, "multicam_source")
463
464             row = layout.row(align=True)
465             sub = row.row()
466             sub.scale_x = 2.0
467
468             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
469
470             row.label("Cut To")
471             for i in range(1, strip.channel):
472                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
473
474         col = layout.column(align=True)
475         if strip.type == 'SPEED':
476             col.prop(strip, "multiply_speed")
477         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
478                 col.prop(strip, "use_default_fade", "Default fade")
479                 if not strip.use_default_fade:
480                     col.prop(strip, "effect_fader", text="Effect fader")
481
482         layout.prop(strip, "use_translation", text="Image Offset:")
483         if strip.use_translation:
484             col = layout.column(align=True)
485             col.prop(strip.transform, "offset_x", text="X")
486             col.prop(strip.transform, "offset_y", text="Y")
487
488         layout.prop(strip, "use_crop", text="Image Crop:")
489         if strip.use_crop:
490             col = layout.column(align=True)
491             col.prop(strip.crop, "max_y")
492             col.prop(strip.crop, "min_x")
493             col.prop(strip.crop, "min_y")
494             col.prop(strip.crop, "max_x")
495
496     def draw_panel_transform(self, strip):
497         layout = self.layout
498         col = layout.column()
499
500         col.prop(strip, "interpolation")
501         col.prop(strip, "translation_unit")
502         col = layout.column(align=True)
503         col.label(text="Position:")
504         col.prop(strip, "translate_start_x", text="X")
505         col.prop(strip, "translate_start_y", text="Y")
506
507         layout.separator()
508
509         col = layout.column(align=True)
510         col.prop(strip, "use_uniform_scale")
511         if (strip.use_uniform_scale):
512             col = layout.column(align=True)
513             col.prop(strip, "scale_start_x", text="Scale")
514         else:
515             col = layout.column(align=True)
516             col.label(text="Scale:")
517             col.prop(strip, "scale_start_x", text="X")
518             col.prop(strip, "scale_start_y", text="Y")
519
520         layout.separator()
521
522         col = layout.column(align=True)
523         col.label(text="Rotation:")
524         col.prop(strip, "rotation_start", text="Rotation")
525
526
527 class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
528     bl_label = "Strip Input"
529
530     @classmethod
531     def poll(cls, context):
532         if not cls.has_sequencer(context):
533             return False
534
535         strip = act_strip(context)
536         if not strip:
537             return False
538
539         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
540                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
541                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
542                               'PLUGIN',
543                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
544                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
545
546     def draw(self, context):
547         layout = self.layout
548
549         strip = act_strip(context)
550
551         seq_type = strip.type
552
553         # draw a filename if we have one
554         if seq_type == 'IMAGE':
555             split = layout.split(percentage=0.2)
556             col = split.column()
557             col.label(text="Path:")
558             col = split.column()
559             col.prop(strip, "directory", text="")
560
561             # Current element for the filename
562
563             elem = strip.getStripElem(context.scene.frame_current)
564             if elem:
565                 split = layout.split(percentage=0.2)
566                 col = split.column()
567                 col.label(text="File:")
568                 col = split.column()
569                 col.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
570
571             # also accessible from the menu
572             layout.operator("sequencer.change_path")
573
574         elif seq_type == 'MOVIE':
575             split = layout.split(percentage=0.2)
576             col = split.column()
577             col.label(text="Path:")
578             col = split.column()
579             col.prop(strip, "filepath", text="")
580             col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
581
582         # TODO, sound???
583         # end drawing filename
584
585         layout.prop(strip, "use_translation", text="Image Offset:")
586         if strip.use_translation:
587             col = layout.column(align=True)
588             col.prop(strip.transform, "offset_x", text="X")
589             col.prop(strip.transform, "offset_y", text="Y")
590
591         layout.prop(strip, "use_crop", text="Image Crop:")
592         if strip.use_crop:
593             col = layout.column(align=True)
594             col.prop(strip.crop, "max_y")
595             col.prop(strip.crop, "min_x")
596             col.prop(strip.crop, "min_y")
597             col.prop(strip.crop, "max_x")
598
599         if not isinstance(strip, bpy.types.EffectSequence):
600             col = layout.column(align=True)
601             col.label(text="Trim Duration (hard):")
602             col.prop(strip, "animation_offset_start", text="Start")
603             col.prop(strip, "animation_offset_end", text="End")
604
605         col = layout.column(align=True)
606         col.label(text="Trim Duration (soft):")
607         col.prop(strip, "frame_offset_start", text="Start")
608         col.prop(strip, "frame_offset_end", text="End")
609
610
611 class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
612     bl_label = "Sound"
613
614     @classmethod
615     def poll(cls, context):
616         if not cls.has_sequencer(context):
617             return False
618
619         strip = act_strip(context)
620         if not strip:
621             return False
622
623         return (strip.type == 'SOUND')
624
625     def draw(self, context):
626         layout = self.layout
627
628         strip = act_strip(context)
629
630         layout.template_ID(strip, "sound", open="sound.open")
631
632         layout.separator()
633         layout.prop(strip, "filepath", text="")
634
635         row = layout.row()
636         if strip.sound.packed_file:
637             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
638         else:
639             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
640
641         row.prop(strip.sound, "use_memory_cache")
642
643         layout.prop(strip, "volume")
644         layout.prop(strip, "attenuation")
645
646         col = layout.column(align=True)
647         col.label(text="Trim Duration:")
648         col.prop(strip, "animation_offset_start", text="Start")
649         col.prop(strip, "animation_offset_end", text="End")
650
651
652 class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
653     bl_label = "Scene"
654
655     @classmethod
656     def poll(cls, context):
657         if not cls.has_sequencer(context):
658             return False
659
660         strip = act_strip(context)
661         if not strip:
662             return False
663
664         return (strip.type == 'SCENE')
665
666     def draw(self, context):
667         layout = self.layout
668
669         strip = act_strip(context)
670
671         layout.template_ID(strip, "scene")
672
673         scene = strip.scene
674         if scene:
675             layout.prop(scene.render, "use_sequencer")
676
677         layout.label(text="Camera Override")
678         layout.template_ID(strip, "scene_camera")
679
680         if scene:
681             sta = scene.frame_start
682             end = scene.frame_end
683             layout.label(text="Original frame range: %d-%d (%d)" % (sta, end, end - sta + 1))
684
685
686 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
687     bl_label = "Filter"
688
689     @classmethod
690     def poll(cls, context):
691         if not cls.has_sequencer(context):
692             return False
693
694         strip = act_strip(context)
695         if not strip:
696             return False
697
698         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
699                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
700                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
701                               'PLUGIN',
702                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
703                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
704
705     def draw(self, context):
706         layout = self.layout
707
708         strip = act_strip(context)
709
710         col = layout.column()
711         col.label(text="Video:")
712         col.prop(strip, "strobe")
713
714         row = layout.row()
715         row.label(text="Flip:")
716         row.prop(strip, "use_flip_x", text="X")
717         row.prop(strip, "use_flip_y", text="Y")
718
719         col = layout.column()
720         col.prop(strip, "use_reverse_frames", text="Backwards")
721         col.prop(strip, "use_deinterlace")
722
723         col = layout.column()
724         col.label(text="Colors:")
725         col.prop(strip, "color_saturation", text="Saturation")
726         col.prop(strip, "color_multiply", text="Multiply")
727         col.prop(strip, "use_premultiply")
728         col.prop(strip, "use_float")
729
730         layout.prop(strip, "use_color_balance")
731         if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
732             row = layout.row()
733             row.active = strip.use_color_balance
734             col = row.column()
735             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
736             col.row().prop(strip.color_balance, "lift")
737             col.prop(strip.color_balance, "invert_lift", text="Inverse")
738             col = row.column()
739             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
740             col.row().prop(strip.color_balance, "gamma")
741             col.prop(strip.color_balance, "invert_gamma", text="Inverse")
742             col = row.column()
743             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
744             col.row().prop(strip.color_balance, "gain")
745             col.prop(strip.color_balance, "invert_gain", text="Inverse")
746
747
748 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
749     bl_label = "Proxy"
750
751     @classmethod
752     def poll(cls, context):
753         if not cls.has_sequencer(context):
754             return False
755
756         strip = act_strip(context)
757         if not strip:
758             return False
759
760         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
761
762     def draw_header(self, context):
763         strip = act_strip(context)
764
765         self.layout.prop(strip, "use_proxy", text="")
766
767     def draw(self, context):
768         layout = self.layout
769
770         strip = act_strip(context)
771
772         flow = layout.column_flow()
773         flow.prop(strip, "use_proxy_custom_directory")
774         flow.prop(strip, "use_proxy_custom_file")
775         if strip.proxy:  # TODO - need to add this somehow
776             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
777                 flow.prop(strip.proxy, "directory")
778             if strip.use_proxy_custom_file:
779                 flow.prop(strip.proxy, "filepath")
780
781
782 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
783     bl_label = "Scene Preview/Render"
784     bl_space_type = 'SEQUENCE_EDITOR'
785     bl_region_type = 'UI'
786
787     def draw(self, context):
788         layout = self.layout
789         render = context.scene.render
790
791         col = layout.column()
792         col.active = False  # Currently only opengl preview works!
793         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
794         col = layout.column()
795         #col.active = render.use_sequencer_gl_preview
796         col.prop(render, "sequencer_gl_preview", text="")
797
798         '''
799         col = layout.column()
800         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
801         col = layout.column()
802         col.active = render.use_sequencer_gl_render
803         col.prop(render, "sequencer_gl_render", text="")
804         '''
805
806
807 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
808     bl_label = "View Settings"
809
810     def draw(self, context):
811         layout = self.layout
812
813         st = context.space_data
814
815         col = layout.column()
816         if st.display_mode == 'IMAGE':
817             col.prop(st, "draw_overexposed")  # text="Zebra"
818             col.prop(st, "show_safe_margin")
819         if st.display_mode == 'WAVEFORM':
820             col.prop(st, "show_separate_color")
821         col.prop(st, "proxy_render_size")
822
823 if __name__ == "__main__":  # only for live edit.
824     bpy.utils.register_module(__name__)