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