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