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