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