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