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