Sequencer: remove effect mask input
[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 def draw_color_balance(layout, color_balance):
32     col = layout.column()
33     col.label(text="Lift:")
34     col.template_color_wheel(color_balance, "lift", value_slider=True, cubic=True)
35     row = col.row()
36     row.prop(color_balance, "lift", text="")
37     row.prop(color_balance, "invert_lift", text="Inverse")
38
39     col = layout.column()
40     col.label(text="Gamma:")
41     col.template_color_wheel(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
42     row = col.row()
43     row.prop(color_balance, "gamma", text="")
44     row.prop(color_balance, "invert_gamma", text="Inverse")
45
46     col = layout.column()
47     col.label(text="Gain:")
48     col.template_color_wheel(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
49     row = col.row()
50     row.prop(color_balance, "gain", text="")
51     row.prop(color_balance, "invert_gain", text="Inverse")
52
53
54 class SEQUENCER_HT_header(Header):
55     bl_space_type = 'SEQUENCE_EDITOR'
56
57     def draw(self, context):
58         layout = self.layout
59
60         st = context.space_data
61
62         row = layout.row(align=True)
63         row.template_header()
64
65         if context.area.show_menus:
66             row.menu("SEQUENCER_MT_view")
67
68             if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
69                 row.menu("SEQUENCER_MT_select")
70                 row.menu("SEQUENCER_MT_marker")
71                 row.menu("SEQUENCER_MT_add")
72                 row.menu("SEQUENCER_MT_strip")
73
74         layout.prop(st, "view_type", expand=True, text="")
75
76         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
77             layout.prop(st, "display_mode", expand=True, text="")
78
79         if st.view_type == 'SEQUENCER':
80             row = layout.row(align=True)
81             row.operator("sequencer.copy", text="", icon='COPYDOWN')
82             row.operator("sequencer.paste", text="", icon='PASTEDOWN')
83
84             layout.separator()
85             layout.operator("sequencer.refresh_all")
86         elif st.view_type == 'SEQUENCER_PREVIEW':
87             layout.separator()
88             layout.operator("sequencer.refresh_all")
89             layout.prop(st, "display_channel", text="Channel")
90         else:
91             layout.prop(st, "display_channel", text="Channel")
92
93             ed = context.scene.sequence_editor
94             if ed:
95                 row = layout.row(align=True)
96                 row.prop(ed, "show_overlay", text="", icon='GHOST_ENABLED')
97                 if ed.show_overlay:
98                     row.prop(ed, "overlay_frame", text="")
99                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
100
101                     row = layout.row()
102                     row.prop(st, "overlay_type", text="")
103
104                 row = layout.row(align=True)
105                 props = row.operator("render.opengl", text="", icon='RENDER_STILL')
106                 props.sequencer = True
107                 props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
108                 props.animation = True
109                 props.sequencer = True
110
111         layout.template_running_jobs()
112
113
114 class SEQUENCER_MT_view_toggle(Menu):
115     bl_label = "View Type"
116
117     def draw(self, context):
118         layout = self.layout
119
120         layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
121         layout.operator("sequencer.view_toggle").type = 'PREVIEW'
122         layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
123
124
125 class SEQUENCER_MT_view(Menu):
126     bl_label = "View"
127
128     def draw(self, context):
129         layout = self.layout
130
131         st = context.space_data
132
133         layout.operator("sequencer.properties", icon='MENU_PANEL')
134
135         layout.separator()
136
137         if st.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'}:
138             layout.operator("sequencer.view_all", text="View all Sequences")
139         if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
140             layout.operator_context = 'INVOKE_REGION_PREVIEW'
141             layout.operator("sequencer.view_all_preview", text="Fit preview in window")
142             layout.operator("sequencer.view_zoom_ratio", text="Show preview 1:1").ratio = 1.0
143             layout.operator_context = 'INVOKE_DEFAULT'
144
145             # # XXX, invokes in the header view
146             # layout.operator("sequencer.view_ghost_border", text="Overlay Border")
147
148         layout.operator("sequencer.view_selected")
149
150         layout.prop(st, "show_seconds")
151
152         layout.prop(st, "show_frame_indicator")
153         if st.display_mode == 'IMAGE':
154             layout.prop(st, "show_safe_margin")
155         if st.display_mode == 'WAVEFORM':
156             layout.prop(st, "show_separate_color")
157
158         layout.separator()
159         layout.prop(st, "use_marker_sync")
160         layout.separator()
161
162         layout.operator("screen.area_dupli")
163         layout.operator("screen.screen_full_area")
164
165
166 class SEQUENCER_MT_select(Menu):
167     bl_label = "Select"
168
169     def draw(self, context):
170         layout = self.layout
171
172         layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
173         layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
174         layout.separator()
175         layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
176         layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
177         layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
178         layout.separator()
179         layout.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped")
180         layout.operator("sequencer.select_linked")
181         layout.operator("sequencer.select_all").action = 'TOGGLE'
182         layout.operator("sequencer.select_all", text="Inverse").action = 'INVERT'
183
184
185 class SEQUENCER_MT_marker(Menu):
186     bl_label = "Marker"
187
188     def draw(self, context):
189         layout = self.layout
190
191         from bl_ui.space_time import marker_menu_generic
192         marker_menu_generic(layout)
193
194
195 class SEQUENCER_MT_change(Menu):
196     bl_label = "Change"
197
198     def draw(self, context):
199         layout = self.layout
200
201         layout.operator_context = 'INVOKE_REGION_WIN'
202
203         layout.operator_menu_enum("sequencer.change_effect_input", "swap")
204         layout.operator_menu_enum("sequencer.change_effect_type", "type")
205         layout.operator("sequencer.change_path", text="Path/Files")
206
207
208 class SEQUENCER_MT_add(Menu):
209     bl_label = "Add"
210
211     def draw(self, context):
212         layout = self.layout
213
214         layout.operator_context = 'INVOKE_REGION_WIN'
215
216         if len(bpy.data.scenes) > 10:
217             layout.operator_context = 'INVOKE_DEFAULT'
218             layout.operator("sequencer.scene_strip_add", text="Scene...")
219         else:
220             layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
221
222         if len(bpy.data.movieclips) > 10:
223             layout.operator_context = 'INVOKE_DEFAULT'
224             layout.operator("sequencer.movieclip_strip_add", text="Clips...")
225         else:
226             layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip...")
227
228         if len(bpy.data.masks) > 10:
229             layout.operator_context = 'INVOKE_DEFAULT'
230             layout.operator("sequencer.mask_strip_add", text="Masks...")
231         else:
232             layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask...")
233
234         layout.operator("sequencer.movie_strip_add", text="Movie")
235         layout.operator("sequencer.image_strip_add", text="Image")
236         layout.operator("sequencer.sound_strip_add", text="Sound")
237
238         layout.menu("SEQUENCER_MT_add_effect")
239
240
241 class SEQUENCER_MT_add_effect(Menu):
242     bl_label = "Effect Strip..."
243
244     def draw(self, context):
245         layout = self.layout
246
247         layout.operator_context = 'INVOKE_REGION_WIN'
248
249         layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
250         layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
251         layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
252         layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
253         layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
254         layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
255         layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
256         layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
257         layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
258         layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
259         layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
260         layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
261         layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
262         layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
263         layout.operator("sequencer.effect_strip_add", text="Adjustment Layer").type = 'ADJUSTMENT'
264
265
266 class SEQUENCER_MT_strip(Menu):
267     bl_label = "Strip"
268
269     def draw(self, context):
270         layout = self.layout
271
272         layout.operator_context = 'INVOKE_REGION_WIN'
273
274         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
275         layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
276         #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
277         layout.separator()
278
279         layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
280         layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
281         layout.operator("sequencer.images_separate")
282         layout.operator("sequencer.offset_clear")
283         layout.operator("sequencer.deinterlace_selected_movies")
284         layout.operator("sequencer.rebuild_proxy")
285         layout.separator()
286
287         layout.operator("sequencer.duplicate_move")
288         layout.operator("sequencer.delete")
289
290         strip = act_strip(context)
291
292         if strip:
293             stype = strip.type
294
295             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
296             if stype == 'EFFECT':
297                 pass
298                 # layout.separator()
299                 # layout.operator("sequencer.effect_change")
300                 # layout.operator("sequencer.effect_reassign_inputs")
301             elif stype == 'IMAGE':
302                 layout.separator()
303                 # layout.operator("sequencer.image_change")
304                 layout.operator("sequencer.rendersize")
305             elif stype == 'SCENE':
306                 pass
307                 # layout.separator()
308                 # layout.operator("sequencer.scene_change", text="Change Scene")
309             elif stype == 'MOVIE':
310                 layout.separator()
311                 # layout.operator("sequencer.movie_change")
312                 layout.operator("sequencer.rendersize")
313             elif stype == 'SOUND':
314                 layout.separator()
315                 layout.operator("sequencer.crossfade_sounds")
316
317         layout.separator()
318
319         layout.operator("sequencer.meta_make")
320         layout.operator("sequencer.meta_separate")
321
322         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
323         #       uiItemS(layout);
324         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
325         #}
326
327         layout.separator()
328         props = layout.operator("sequencer.reload", text="Reload Strips")
329         props.adjust_length = False
330         props = layout.operator("sequencer.reload", text="Reload Strips and Adjust Length")
331         props.adjust_length = True
332         layout.operator("sequencer.reassign_inputs")
333         layout.operator("sequencer.swap_inputs")
334         layout.separator()
335         layout.operator("sequencer.lock")
336         layout.operator("sequencer.unlock")
337         layout.operator("sequencer.mute").unselected = False
338         layout.operator("sequencer.unmute")
339
340         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
341
342         layout.operator("sequencer.snap")
343
344         layout.operator_menu_enum("sequencer.swap", "side")
345
346         layout.separator()
347
348         layout.operator("sequencer.swap_data")
349         layout.menu("SEQUENCER_MT_change")
350
351
352 class SequencerButtonsPanel():
353     bl_space_type = 'SEQUENCE_EDITOR'
354     bl_region_type = 'UI'
355
356     @staticmethod
357     def has_sequencer(context):
358         return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
359
360     @classmethod
361     def poll(cls, context):
362         return cls.has_sequencer(context) and (act_strip(context) is not None)
363
364
365 class SequencerButtonsPanel_Output():
366     bl_space_type = 'SEQUENCE_EDITOR'
367     bl_region_type = 'UI'
368
369     @staticmethod
370     def has_preview(context):
371         return (context.space_data.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'})
372
373     @classmethod
374     def poll(cls, context):
375         return cls.has_preview(context)
376
377
378 class SEQUENCER_PT_edit(SequencerButtonsPanel, Panel):
379     bl_label = "Edit Strip"
380
381     def draw(self, context):
382         layout = self.layout
383
384         scene = context.scene
385         frame_current = scene.frame_current
386         strip = act_strip(context)
387
388         split = layout.split(percentage=0.3)
389         split.label(text="Name:")
390         split.prop(strip, "name", text="")
391
392         split = layout.split(percentage=0.3)
393         split.label(text="Type:")
394         split.prop(strip, "type", text="")
395
396         split = layout.split(percentage=0.3)
397         split.label(text="Blend:")
398         split.prop(strip, "blend_type", text="")
399
400         row = layout.row(align=True)
401         sub = row.row()
402         sub.active = (not strip.mute)
403         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
404         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
405         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
406
407         col = layout.column()
408         sub = col.column()
409         sub.enabled = not strip.lock
410         sub.prop(strip, "channel")
411         sub.prop(strip, "frame_start")
412         sub.prop(strip, "frame_final_duration")
413
414         col = layout.column(align=True)
415         row = col.row()
416         row.label(text="Final Length" + ": %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
417         row = col.row()
418         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
419         row.label(text="Playhead" + ": %d" % (frame_current - strip.frame_start))
420
421         col.label(text="Frame Offset" + " %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
422         col.label(text="Frame Still" + " %d:%d" % (strip.frame_still_start, strip.frame_still_end))
423
424         elem = False
425
426         if strip.type == 'IMAGE':
427             elem = strip.getStripElem(frame_current)
428         elif strip.type == 'MOVIE':
429             elem = strip.elements[0]
430
431         if elem and elem.orig_width > 0 and elem.orig_height > 0:
432             col.label(text="Original Dimension" + ": %dx%d" % (elem.orig_width, elem.orig_height))
433         else:
434             col.label(text="Original Dimension: None")
435
436
437 class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
438     bl_label = "Effect Strip"
439
440     @classmethod
441     def poll(cls, context):
442         if not cls.has_sequencer(context):
443             return False
444
445         strip = act_strip(context)
446         if not strip:
447             return False
448
449         return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
450                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
451                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
452                               'MULTICAM'}
453
454     def draw(self, context):
455         layout = self.layout
456
457         sequencer = context.scene.sequence_editor
458         strip = act_strip(context)
459
460         if strip.input_count > 0:
461             col = layout.column()
462             col.prop(strip, "input_1")
463             if strip.input_count > 1:
464                 col.prop(strip, "input_2")
465
466         if strip.type == 'COLOR':
467             layout.prop(strip, "color")
468
469         elif strip.type == 'WIPE':
470             col = layout.column()
471             col.prop(strip, "transition_type")
472             col.label(text="Direction:")
473             col.row().prop(strip, "direction", expand=True)
474
475             col = layout.column()
476             col.prop(strip, "blur_width", slider=True)
477             if strip.transition_type in {'SINGLE', 'DOUBLE'}:
478                 col.prop(strip, "angle")
479
480         elif strip.type == 'GLOW':
481             flow = layout.column_flow()
482             flow.prop(strip, "threshold", slider=True)
483             flow.prop(strip, "clamp", slider=True)
484             flow.prop(strip, "boost_factor")
485             flow.prop(strip, "blur_radius")
486
487             row = layout.row()
488             row.prop(strip, "quality", slider=True)
489             row.prop(strip, "use_only_boost")
490
491         elif strip.type == 'SPEED':
492             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
493             if not strip.use_default_fade:
494                 layout.prop(strip, "use_as_speed")
495                 if strip.use_as_speed:
496                     layout.prop(strip, "speed_factor")
497                 else:
498                     layout.prop(strip, "speed_factor", text="Frame number")
499                     layout.prop(strip, "scale_to_length")
500
501             #doesn't work currently
502             #layout.prop(strip, "use_frame_blend")
503
504         elif strip.type == 'TRANSFORM':
505             layout = self.layout
506             col = layout.column()
507
508             col.prop(strip, "interpolation")
509             col.prop(strip, "translation_unit")
510             col = layout.column(align=True)
511             col.label(text="Position:")
512             col.prop(strip, "translate_start_x", text="X")
513             col.prop(strip, "translate_start_y", text="Y")
514
515             layout.separator()
516
517             col = layout.column(align=True)
518             col.prop(strip, "use_uniform_scale")
519             if strip.use_uniform_scale:
520                 col = layout.column(align=True)
521                 col.prop(strip, "scale_start_x", text="Scale")
522             else:
523                 col = layout.column(align=True)
524                 col.label(text="Scale:")
525                 col.prop(strip, "scale_start_x", text="X")
526                 col.prop(strip, "scale_start_y", text="Y")
527
528             layout.separator()
529
530             col = layout.column(align=True)
531             col.label(text="Rotation:")
532             col.prop(strip, "rotation_start", text="Rotation")
533
534         elif strip.type == 'MULTICAM':
535             layout.prop(strip, "multicam_source")
536
537             row = layout.row(align=True)
538             sub = row.row()
539             sub.scale_x = 2.0
540
541             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
542
543             row.label("Cut To")
544             for i in range(1, strip.channel):
545                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
546
547         col = layout.column(align=True)
548         if strip.type == 'SPEED':
549             col.prop(strip, "multiply_speed")
550         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'WIPE'}:
551             col.prop(strip, "use_default_fade", "Default fade")
552             if not strip.use_default_fade:
553                 col.prop(strip, "effect_fader", text="Effect fader")
554
555
556 class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
557     bl_label = "Strip Input"
558
559     @classmethod
560     def poll(cls, context):
561         if not cls.has_sequencer(context):
562             return False
563
564         strip = act_strip(context)
565         if not strip:
566             return False
567
568         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
569                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
570                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
571                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
572                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
573
574     def draw(self, context):
575         layout = self.layout
576
577         strip = act_strip(context)
578
579         seq_type = strip.type
580
581         # draw a filename if we have one
582         if seq_type == 'IMAGE':
583             split = layout.split(percentage=0.2)
584             split.label(text="Path:")
585             split.prop(strip, "directory", text="")
586
587             # Current element for the filename
588
589             elem = strip.getStripElem(context.scene.frame_current)
590             if elem:
591                 split = layout.split(percentage=0.2)
592                 split.label(text="File:")
593                 split.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
594
595             layout.operator("sequencer.change_path")
596
597         elif seq_type == 'MOVIE':
598             split = layout.split(percentage=0.2)
599             split.label(text="Path:")
600             split.prop(strip, "filepath", text="")
601
602             layout.prop(strip, "mpeg_preseek")
603             layout.prop(strip, "stream_index")
604
605         layout.prop(strip, "use_translation", text="Image Offset")
606         if strip.use_translation:
607             col = layout.column(align=True)
608             col.prop(strip.transform, "offset_x", text="X")
609             col.prop(strip.transform, "offset_y", text="Y")
610
611         layout.prop(strip, "use_crop", text="Image Crop")
612         if strip.use_crop:
613             col = layout.column(align=True)
614             col.prop(strip.crop, "max_y")
615             col.prop(strip.crop, "min_x")
616             col.prop(strip.crop, "min_y")
617             col.prop(strip.crop, "max_x")
618
619         if not isinstance(strip, bpy.types.EffectSequence):
620             col = layout.column(align=True)
621             col.label(text="Trim Duration (hard):")
622             col.prop(strip, "animation_offset_start", text="Start")
623             col.prop(strip, "animation_offset_end", text="End")
624
625         col = layout.column(align=True)
626         col.label(text="Trim Duration (soft):")
627         col.prop(strip, "frame_offset_start", text="Start")
628         col.prop(strip, "frame_offset_end", text="End")
629
630
631 class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel):
632     bl_label = "Sound"
633
634     @classmethod
635     def poll(cls, context):
636         if not cls.has_sequencer(context):
637             return False
638
639         strip = act_strip(context)
640         if not strip:
641             return False
642
643         return (strip.type == 'SOUND')
644
645     def draw(self, context):
646         layout = self.layout
647
648         strip = act_strip(context)
649         sound = strip.sound
650
651         layout.template_ID(strip, "sound", open="sound.open")
652
653         layout.separator()
654         layout.prop(strip, "filepath", text="")
655
656         row = layout.row()
657         if sound.packed_file:
658             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
659         else:
660             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
661
662         row.prop(sound, "use_memory_cache")
663
664         layout.prop(strip, "show_waveform")
665         layout.prop(strip, "volume")
666         layout.prop(strip, "pitch")
667         layout.prop(strip, "pan")
668
669         col = layout.column(align=True)
670         col.label(text="Trim Duration:")
671         col.prop(strip, "animation_offset_start", text="Start")
672         col.prop(strip, "animation_offset_end", text="End")
673
674
675 class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
676     bl_label = "Scene"
677
678     @classmethod
679     def poll(cls, context):
680         if not cls.has_sequencer(context):
681             return False
682
683         strip = act_strip(context)
684         if not strip:
685             return False
686
687         return (strip.type == 'SCENE')
688
689     def draw(self, context):
690         layout = self.layout
691
692         strip = act_strip(context)
693
694         layout.template_ID(strip, "scene")
695
696         scene = strip.scene
697         if scene:
698             layout.prop(scene.render, "use_sequencer")
699
700         layout.label(text="Camera Override")
701         layout.template_ID(strip, "scene_camera")
702
703         if scene:
704             sta = scene.frame_start
705             end = scene.frame_end
706             layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
707
708
709 class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
710     bl_label = "Mask"
711
712     @classmethod
713     def poll(cls, context):
714         if not cls.has_sequencer(context):
715             return False
716
717         strip = act_strip(context)
718         if not strip:
719             return False
720
721         return (strip.type == 'MASK')
722
723     def draw(self, context):
724         layout = self.layout
725
726         strip = act_strip(context)
727
728         layout.template_ID(strip, "mask")
729
730         mask = strip.mask
731
732         if mask:
733             sta = mask.frame_start
734             end = mask.frame_end
735             layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
736
737
738 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
739     bl_label = "Filter"
740
741     @classmethod
742     def poll(cls, context):
743         if not cls.has_sequencer(context):
744             return False
745
746         strip = act_strip(context)
747         if not strip:
748             return False
749
750         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK',
751                               'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
752                               'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
753                               'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
754                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
755
756     def draw(self, context):
757         layout = self.layout
758
759         strip = act_strip(context)
760
761         col = layout.column()
762         col.label(text="Video:")
763         col.prop(strip, "strobe")
764
765         if strip.type == 'MOVIECLIP':
766             col = layout.column()
767             col.label(text="Tracker:")
768             col.prop(strip, "stabilize2d")
769
770             col = layout.column()
771             col.label(text="Distortion:")
772             col.prop(strip, "undistort")
773
774         split = layout.split(percentage=0.65)
775
776         col = split.column()
777         col.prop(strip, "use_reverse_frames", text="Backwards")
778         col.prop(strip, "use_deinterlace")
779
780         col = split.column()
781         col.label(text="Flip:")
782         col.prop(strip, "use_flip_x", text="X")
783         col.prop(strip, "use_flip_y", text="Y")
784
785         col = layout.column()
786         col.label(text="Colors:")
787         col.prop(strip, "color_saturation", text="Saturation")
788         col.prop(strip, "color_multiply", text="Multiply")
789         col.prop(strip, "use_premultiply")
790         col.prop(strip, "use_float")
791
792
793 class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
794     bl_label = "Proxy / Timecode"
795
796     @classmethod
797     def poll(cls, context):
798         if not cls.has_sequencer(context):
799             return False
800
801         strip = act_strip(context)
802         if not strip:
803             return False
804
805         return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
806
807     def draw_header(self, context):
808         strip = act_strip(context)
809
810         self.layout.prop(strip, "use_proxy", text="")
811
812     def draw(self, context):
813         layout = self.layout
814
815         strip = act_strip(context)
816
817         flow = layout.column_flow()
818         flow.prop(strip, "use_proxy_custom_directory")
819         flow.prop(strip, "use_proxy_custom_file")
820         if strip.proxy:
821             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
822                 flow.prop(strip.proxy, "directory")
823             if strip.use_proxy_custom_file:
824                 flow.prop(strip.proxy, "filepath")
825
826             row = layout.row()
827             row.prop(strip.proxy, "build_25")
828             row.prop(strip.proxy, "build_50")
829             row.prop(strip.proxy, "build_75")
830             row.prop(strip.proxy, "build_100")
831
832             col = layout.column()
833             col.label(text="Build JPEG quality")
834             col.prop(strip.proxy, "quality")
835
836             if strip.type == 'MOVIE':
837                 col = layout.column()
838                 col.label(text="Use timecode index:")
839
840                 col.prop(strip.proxy, "timecode")
841
842
843 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel):
844     bl_label = "Scene Preview/Render"
845     bl_space_type = 'SEQUENCE_EDITOR'
846     bl_region_type = 'UI'
847
848     def draw(self, context):
849         layout = self.layout
850
851         render = context.scene.render
852
853         col = layout.column()
854         col.active = False  # Currently only opengl preview works!
855         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
856         col = layout.column()
857         #col.active = render.use_sequencer_gl_preview
858         col.prop(render, "sequencer_gl_preview", text="")
859
860
861 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
862     bl_label = "View Settings"
863
864     def draw(self, context):
865         layout = self.layout
866
867         st = context.space_data
868
869         col = layout.column()
870         if st.display_mode == 'IMAGE':
871             col.prop(st, "draw_overexposed")
872             col.prop(st, "show_safe_margin")
873         elif st.display_mode == 'WAVEFORM':
874             col.prop(st, "show_separate_color")
875         col.prop(st, "proxy_render_size")
876
877
878 class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
879     bl_label = "Modifiers"
880
881     def draw(self, context):
882         layout = self.layout
883
884         strip = act_strip(context)
885         sequencer = context.scene.sequence_editor
886
887         layout.operator_menu_enum("sequencer.strip_modifier_add", "type")
888
889         for mod in strip.modifiers:
890             box = layout.box()
891
892             row = box.row()
893             row.prop(mod, "show_expanded", text="", emboss=False)
894             row.prop(mod, "name", text="")
895
896             row.prop(mod, "mute", text="")
897
898             sub = row.row(align=True)
899             props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_UP')
900             props.name = mod.name
901             props.direction = 'UP'
902             props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_DOWN')
903             props.name = mod.name
904             props.direction = 'DOWN'
905
906             props = row.operator("sequencer.strip_modifier_remove", text="", icon='X', emboss=False)
907             props.name = mod.name
908
909             if mod.show_expanded:
910                 row = box.row()
911                 row.prop(mod, "input_mask_type", expand=True)
912
913                 if mod.input_mask_type == 'STRIP':
914                     box.prop_search(mod, "input_mask_strip", sequencer, "sequences", text="Mask")
915                 else:
916                     box.prop(mod, "input_mask_id")
917
918                 if mod.type == 'COLOR_BALANCE':
919                     box.prop(mod, "color_multiply")
920                     draw_color_balance(box, mod.color_balance)
921                 elif mod.type == 'CURVES':
922                     box.template_curve_mapping(mod, "curve_mapping", type='COLOR')
923                 elif mod.type == 'HUE_CORRECT':
924                     box.template_curve_mapping(mod, "curve_mapping", type='HUE')
925                 elif mod.type == 'BRIGHT_CONTRAST':
926                     col = box.column()
927                     col.prop(mod, "bright")
928                     col.prop(mod, "contrast")
929
930
931 if __name__ == "__main__":  # only for live edit.
932     bpy.utils.register_module(__name__)