correct fix for [#25737] Console error message
[blender.git] / release / scripts / 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
22
23 def act_strip(context):
24     try:
25         return context.scene.sequence_editor.active_strip
26     except AttributeError:
27         return None
28
29
30 class SEQUENCER_HT_header(bpy.types.Header):
31     bl_space_type = 'SEQUENCE_EDITOR'
32
33     def draw(self, context):
34         layout = self.layout
35
36         st = context.space_data
37
38         row = layout.row(align=True)
39         row.template_header()
40
41         if context.area.show_menus:
42             sub = row.row(align=True)
43             sub.menu("SEQUENCER_MT_view")
44
45             if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
46                 sub.menu("SEQUENCER_MT_select")
47                 sub.menu("SEQUENCER_MT_marker")
48                 sub.menu("SEQUENCER_MT_add")
49                 sub.menu("SEQUENCER_MT_strip")
50
51         layout.prop(st, "view_type", expand=True, text="")
52
53         if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
54             layout.prop(st, "display_mode", expand=True, text="")
55
56         if (st.view_type == 'SEQUENCER'):
57             row = layout.row(align=True)
58             row.operator("sequencer.copy", text="", icon='COPYDOWN')
59             row.operator("sequencer.paste", text="", icon='PASTEDOWN')
60
61             layout.separator()
62             layout.operator("sequencer.refresh_all")
63         elif (st.view_type == 'SEQUENCER_PREVIEW'):
64             layout.separator()
65             layout.operator("sequencer.refresh_all")
66             layout.prop(st, "display_channel", text="Channel")
67         else:
68             layout.prop(st, "display_channel", text="Channel")
69
70             ed = context.scene.sequence_editor
71             if ed:
72                 row = layout.row(align=True)
73                 row.prop(ed, "show_overlay", text="", icon='GHOST_ENABLED')
74                 if ed.show_overlay:
75                     row.prop(ed, "overlay_frame", text="")
76                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
77
78
79 class SEQUENCER_MT_view_toggle(bpy.types.Menu):
80     bl_label = "View Type"
81
82     def draw(self, context):
83         layout = self.layout
84
85         layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
86         layout.operator("sequencer.view_toggle").type = 'PREVIEW'
87         layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
88
89
90 class SEQUENCER_MT_view(bpy.types.Menu):
91     bl_label = "View"
92
93     def draw(self, context):
94         layout = self.layout
95
96         st = context.space_data
97
98         layout.column()
99
100         layout.operator("sequencer.properties", icon='MENU_PANEL')
101
102         layout.separator()
103
104         """
105     uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP);
106     short yco= 0, menuwidth=120;
107
108     if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
109         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
110                  "Play Back Animation "
111                  "in all Sequence Areas|Alt A", 0, yco-=20,
112                  menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
113     }
114     else {
115         uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL,
116                  "Grease Pencil...", 0, yco-=20,
117                  menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
118         uiDefMenuSep(block);
119
120         uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
121                  "Play Back Animation "
122                  "in this window|Alt A", 0, yco-=20,
123                  menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
124     }
125     uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
126              "Play Back Animation in all "
127              "3D Views and Sequence Areas|Alt Shift A",
128              0, yco-=20,
129              menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
130
131         """
132         if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
133             layout.operator("sequencer.view_all", text='View all Sequences')
134         if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
135             layout.operator_context = 'INVOKE_REGION_PREVIEW'
136             layout.operator("sequencer.view_all_preview", text='Fit preview in window')
137             layout.operator("sequencer.view_zoom_ratio", text='Show preview 1:1').ratio = 1.0
138             layout.operator_context = 'INVOKE_DEFAULT'
139
140             # # XXX, invokes in the header view
141             # layout.operator("sequencer.view_ghost_border", text='Overlay Border')
142
143         layout.operator("sequencer.view_selected")
144
145         layout.prop(st, "show_frames")
146         layout.prop(st, "show_frame_indicator")
147         if st.display_mode == 'IMAGE':
148             layout.prop(st, "show_safe_margin")
149         if st.display_mode == 'WAVEFORM':
150             layout.prop(st, "show_separate_color")
151
152         layout.separator()
153         layout.prop(st, "use_marker_sync")
154         layout.separator()
155
156         layout.operator("screen.area_dupli")
157         layout.operator("screen.screen_full_area")
158
159
160 class SEQUENCER_MT_select(bpy.types.Menu):
161     bl_label = "Select"
162
163     def draw(self, context):
164         layout = self.layout
165
166         layout.column()
167         layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
168         layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
169         layout.separator()
170         layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
171         layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
172         layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
173         layout.separator()
174         layout.operator("sequencer.select_linked")
175         layout.operator("sequencer.select_all_toggle")
176         layout.operator("sequencer.select_inverse")
177
178
179 class SEQUENCER_MT_marker(bpy.types.Menu):
180     bl_label = "Marker"
181
182     def draw(self, context):
183         layout = self.layout
184
185         #layout.operator_context = 'EXEC_REGION_WIN'
186
187         layout.column()
188         layout.operator("marker.add", "Add Marker")
189         layout.operator("marker.duplicate", text="Duplicate Marker")
190         layout.operator("marker.delete", text="Delete Marker")
191
192         layout.separator()
193
194         layout.operator("marker.rename", text="Rename Marker")
195         layout.operator("marker.move", text="Grab/Move Marker")
196
197         #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
198
199
200 class SEQUENCER_MT_add(bpy.types.Menu):
201     bl_label = "Add"
202
203     def draw(self, context):
204         layout = self.layout
205         layout.operator_context = 'INVOKE_REGION_WIN'
206
207         layout.column()
208         if len(bpy.data.scenes) > 10:
209             layout.operator_context = 'INVOKE_DEFAULT'
210             layout.operator("sequencer.scene_strip_add", text="Scene...")
211         else:
212             layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
213
214         layout.operator("sequencer.movie_strip_add", text="Movie")
215         layout.operator("sequencer.image_strip_add", text="Image")
216         layout.operator("sequencer.sound_strip_add", text="Sound")
217
218         layout.menu("SEQUENCER_MT_add_effect")
219
220
221 class SEQUENCER_MT_add_effect(bpy.types.Menu):
222     bl_label = "Effect Strip..."
223
224     def draw(self, context):
225         layout = self.layout
226         layout.operator_context = 'INVOKE_REGION_WIN'
227
228         layout.column()
229         layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
230         layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
231         layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
232         layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
233         layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
234         layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
235         layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
236         layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
237         layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
238         layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
239         layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
240         layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
241         layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
242         layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
243         layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
244
245
246 class SEQUENCER_MT_strip(bpy.types.Menu):
247     bl_label = "Strip"
248
249     def draw(self, context):
250         layout = self.layout
251
252         layout.operator_context = 'INVOKE_REGION_WIN'
253
254         layout.column()
255         layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
256         layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
257         #  uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
258         layout.separator()
259
260         layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
261         layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
262         layout.operator("sequencer.images_separate")
263         layout.operator("sequencer.deinterlace_selected_movies")
264         layout.separator()
265
266         layout.operator("sequencer.duplicate")
267         layout.operator("sequencer.delete")
268
269         strip = act_strip(context)
270
271         if strip:
272             stype = strip.type
273
274             # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
275             if stype == 'EFFECT':
276                 pass
277                 # layout.separator()
278                 # layout.operator("sequencer.effect_change")
279                 # layout.operator("sequencer.effect_reassign_inputs")
280             elif stype == 'IMAGE':
281                 layout.separator()
282                 # layout.operator("sequencer.image_change")
283                 layout.operator("sequencer.rendersize")
284             elif stype == 'SCENE':
285                 pass
286                 # layout.separator()
287                 # layout.operator("sequencer.scene_change", text="Change Scene")
288             elif stype == 'MOVIE':
289                 layout.separator()
290                 # layout.operator("sequencer.movie_change")
291                 layout.operator("sequencer.rendersize")
292
293         layout.separator()
294
295         layout.operator("sequencer.meta_make")
296         layout.operator("sequencer.meta_separate")
297
298         #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
299         #       uiItemS(layout);
300         #       uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
301         #}
302
303         layout.separator()
304         layout.operator("sequencer.reload")
305         layout.operator("sequencer.reassign_inputs")
306         layout.operator("sequencer.swap_inputs")
307         layout.separator()
308         layout.operator("sequencer.lock")
309         layout.operator("sequencer.unlock")
310         layout.operator("sequencer.mute")
311         layout.operator("sequencer.unmute")
312
313         layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
314
315         layout.operator("sequencer.snap")
316
317         layout.operator_menu_enum("sequencer.swap", "side")
318
319         layout.separator()
320
321         layout.operator("sequencer.swap_data")
322
323
324 class SequencerButtonsPanel():
325     bl_space_type = 'SEQUENCE_EDITOR'
326     bl_region_type = 'UI'
327
328     @staticmethod
329     def has_sequencer(context):
330         return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
331
332     @classmethod
333     def poll(cls, context):
334         return cls.has_sequencer(context) and (act_strip(context) is not None)
335
336
337 class SequencerButtonsPanel_Output():
338     bl_space_type = 'SEQUENCE_EDITOR'
339     bl_region_type = 'UI'
340
341     @staticmethod
342     def has_preview(context):
343         return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
344
345     @classmethod
346     def poll(cls, context):
347         return cls.has_preview(context)
348
349
350 class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
351     bl_label = "Edit Strip"
352
353     def draw(self, context):
354         layout = self.layout
355         scene = context.scene
356         render = context.scene.render
357         frame_current = scene.frame_current
358         strip = act_strip(context)
359
360         split = layout.split(percentage=0.3)
361         split.label(text="Name:")
362         split.prop(strip, "name", text="")
363
364         split = layout.split(percentage=0.3)
365         split.label(text="Type:")
366         split.prop(strip, "type", text="")
367
368         split = layout.split(percentage=0.3)
369         split.label(text="Blend:")
370         split.prop(strip, "blend_type", text="")
371
372         row = layout.row(align=True)
373         sub = row.row()
374         sub.active = (not strip.mute)
375         sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
376         row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
377         row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
378
379         col = layout.column()
380         sub = col.column()
381         sub.enabled = not strip.lock
382         sub.prop(strip, "channel")
383         sub.prop(strip, "frame_start")
384         sub.prop(strip, "frame_final_duration")
385
386         col = layout.column(align=True)
387         row = col.row()
388         row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
389         row = col.row()
390         row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
391         row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
392
393         col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
394         col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
395
396         elem = False
397
398         if strip.type == 'IMAGE':
399             elem = strip.getStripElem(frame_current)
400         elif strip.type == 'MOVIE':
401             elem = strip.elements[0]
402
403         if elem and elem.orig_width > 0 and elem.orig_height > 0:
404             col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
405
406
407 class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
408     bl_label = "Effect Strip"
409
410     @classmethod
411     def poll(cls, context):
412         if not cls.has_sequencer(context):
413             return False
414
415         strip = act_strip(context)
416         if not strip:
417             return False
418
419         return strip.type in ('ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
420                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
421                               'PLUGIN',
422                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
423                               'MULTICAM')
424
425     def draw(self, context):
426         layout = self.layout
427
428         strip = act_strip(context)
429         if strip.input_count > 0:
430             col = layout.column()
431             col.prop(strip, "input_1")
432             if strip.input_count > 1:
433                 col.prop(strip, "input_2")
434             if strip.input_count > 2:
435                 col.prop(strip, "input_3")
436
437         if strip.type == 'COLOR':
438             layout.prop(strip, "color")
439
440         elif strip.type == 'WIPE':
441
442             col = layout.column()
443             col.prop(strip, "transition_type")
444             col.label(text="Direction:")
445             col.row().prop(strip, "direction", expand=True)
446
447             col = layout.column()
448             col.prop(strip, "blur_width", slider=True)
449             if strip.transition_type in ('SINGLE', 'DOUBLE'):
450                 col.prop(strip, "angle")
451
452         elif strip.type == 'GLOW':
453             flow = layout.column_flow()
454             flow.prop(strip, "threshold", slider=True)
455             flow.prop(strip, "clamp", slider=True)
456             flow.prop(strip, "boost_factor")
457             flow.prop(strip, "blur_radius")
458
459             row = layout.row()
460             row.prop(strip, "quality", slider=True)
461             row.prop(strip, "use_only_boost")
462
463         elif strip.type == 'SPEED':
464             layout.prop(strip, "use_default_fade", "Stretch to input strip length")
465             if not strip.use_default_fade:
466                 layout.prop(strip, "use_as_speed")
467                 if strip.use_as_speed:
468                     layout.prop(strip, "speed_factor")
469                 else:
470                     layout.prop(strip, "speed_factor", text="Frame number")
471                     layout.prop(strip, "scale_to_length")
472
473             #doesn't work currently
474             #layout.prop(strip, "use_frame_blend")
475
476         elif strip.type == 'TRANSFORM':
477             self.draw_panel_transform(strip)
478
479         elif strip.type == "MULTICAM":
480             layout.prop(strip, "multicam_source")
481
482             row = layout.row(align=True)
483             sub = row.row()
484             sub.scale_x = 2.0
485
486             sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
487
488             row.label("Cut To")
489             for i in range(1, strip.channel):
490                 row.operator("sequencer.cut_multicam", text=str(i)).camera = i
491
492         col = layout.column(align=True)
493         if strip.type == 'SPEED':
494             col.prop(strip, "multiply_speed")
495         elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'):
496                 col.prop(strip, "use_default_fade", "Default fade")
497                 if not strip.use_default_fade:
498                     col.prop(strip, "effect_fader", text="Effect fader")
499
500         layout.prop(strip, "use_translation", text="Image Offset:")
501         if strip.use_translation:
502             col = layout.column(align=True)
503             col.prop(strip.transform, "offset_x", text="X")
504             col.prop(strip.transform, "offset_y", text="Y")
505
506         layout.prop(strip, "use_crop", text="Image Crop:")
507         if strip.use_crop:
508             col = layout.column(align=True)
509             col.prop(strip.crop, "max_y")
510             col.prop(strip.crop, "min_x")
511             col.prop(strip.crop, "min_y")
512             col.prop(strip.crop, "max_x")
513
514     def draw_panel_transform(self, strip):
515         layout = self.layout
516         col = layout.column()
517
518         col.prop(strip, "interpolation")
519         col.prop(strip, "translation_unit")
520         col = layout.column(align=True)
521         col.label(text="Position:")
522         col.prop(strip, "translate_start_x", text="X")
523         col.prop(strip, "translate_start_y", text="Y")
524
525         layout.separator()
526
527         col = layout.column(align=True)
528         col.prop(strip, "use_uniform_scale")
529         if (strip.use_uniform_scale):
530             col = layout.column(align=True)
531             col.prop(strip, "scale_start_x", text="Scale")
532         else:
533             col = layout.column(align=True)
534             col.label(text="Scale:")
535             col.prop(strip, "scale_start_x", text="X")
536             col.prop(strip, "scale_start_y", text="Y")
537
538         layout.separator()
539
540         col = layout.column(align=True)
541         col.label(text="Rotation:")
542         col.prop(strip, "rotation_start", text="Rotation")
543
544
545 class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
546     bl_label = "Strip Input"
547
548     @classmethod
549     def poll(cls, context):
550         if not cls.has_sequencer(context):
551             return False
552
553         strip = act_strip(context)
554         if not strip:
555             return False
556
557         return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META',
558                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
559                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
560                               'PLUGIN',
561                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
562                               'MULTICAM', 'SPEED')
563
564     def draw(self, context):
565         layout = self.layout
566
567         strip = act_strip(context)
568
569         seq_type = strip.type
570
571         # draw a filename if we have one
572         if seq_type == 'IMAGE':
573             split = layout.split(percentage=0.2)
574             col = split.column()
575             col.label(text="Path:")
576             col = split.column()
577             col.prop(strip, "directory", text="")
578
579             # Current element for the filename
580
581             elem = strip.getStripElem(context.scene.frame_current)
582             if elem:
583                 split = layout.split(percentage=0.2)
584                 col = split.column()
585                 col.label(text="File:")
586                 col = split.column()
587                 col.prop(elem, "filename", text="")  # strip.elements[0] could be a fallback
588
589         elif seq_type == 'MOVIE':
590             split = layout.split(percentage=0.2)
591             col = split.column()
592             col.label(text="Path:")
593             col = split.column()
594             col.prop(strip, "filepath", text="")
595             col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
596
597         # TODO, sound???
598         # end drawing filename
599
600         layout.prop(strip, "use_translation", text="Image Offset:")
601         if strip.use_translation:
602             col = layout.column(align=True)
603             col.prop(strip.transform, "offset_x", text="X")
604             col.prop(strip.transform, "offset_y", text="Y")
605
606         layout.prop(strip, "use_crop", text="Image Crop:")
607         if strip.use_crop:
608             col = layout.column(align=True)
609             col.prop(strip.crop, "max_y")
610             col.prop(strip.crop, "min_x")
611             col.prop(strip.crop, "min_y")
612             col.prop(strip.crop, "max_x")
613
614         if not isinstance(strip, bpy.types.EffectSequence):
615             col = layout.column(align=True)
616             col.label(text="Trim Duration (hard):")
617             col.prop(strip, "animation_offset_start", text="Start")
618             col.prop(strip, "animation_offset_end", text="End")
619
620         col = layout.column(align=True)
621         col.label(text="Trim Duration (soft):")
622         col.prop(strip, "frame_offset_start", text="Start")
623         col.prop(strip, "frame_offset_end", text="End")
624
625
626 class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
627     bl_label = "Sound"
628
629     @classmethod
630     def poll(cls, context):
631         if not cls.has_sequencer(context):
632             return False
633
634         strip = act_strip(context)
635         if not strip:
636             return False
637
638         return (strip.type == 'SOUND')
639
640     def draw(self, context):
641         layout = self.layout
642
643         strip = act_strip(context)
644
645         layout.template_ID(strip, "sound", open="sound.open")
646
647         layout.separator()
648         layout.prop(strip, "filepath", text="")
649
650         row = layout.row()
651         if strip.sound.packed_file:
652             row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
653         else:
654             row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
655
656         row.prop(strip.sound, "use_memory_cache")
657
658         layout.prop(strip, "volume")
659         layout.prop(strip, "attenuation")
660
661         col = layout.column(align=True)
662         col.label(text="Trim Duration:")
663         col.prop(strip, "animation_offset_start", text="Start")
664         col.prop(strip, "animation_offset_end", text="End")
665
666
667 class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
668     bl_label = "Scene"
669
670     @classmethod
671     def poll(cls, context):
672         if not cls.has_sequencer(context):
673             return False
674
675         strip = act_strip(context)
676         if not strip:
677             return False
678
679         return (strip.type == 'SCENE')
680
681     def draw(self, context):
682         layout = self.layout
683
684         strip = act_strip(context)
685
686         layout.template_ID(strip, "scene")
687
688         layout.label(text="Camera Override")
689         layout.template_ID(strip, "scene_camera")
690
691         sce = strip.scene
692         layout.label(text="Original frame range: %d-%d (%d)" % (sce.frame_start, sce.frame_end, sce.frame_end - sce.frame_start + 1))
693
694
695 class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
696     bl_label = "Filter"
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 in ('MOVIE', 'IMAGE', 'SCENE', 'META',
708                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
709                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
710                               'PLUGIN',
711                               'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
712                               'MULTICAM', 'SPEED')
713
714     def draw(self, context):
715         layout = self.layout
716
717         strip = act_strip(context)
718
719         col = layout.column()
720         col.label(text="Video:")
721         col.prop(strip, "strobe")
722
723         row = layout.row()
724         row.label(text="Flip:")
725         row.prop(strip, "use_flip_x", text="X")
726         row.prop(strip, "use_flip_y", text="Y")
727
728         col = layout.column()
729         col.prop(strip, "use_reverse_frames", text="Backwards")
730         col.prop(strip, "use_deinterlace")
731
732         col = layout.column()
733         col.label(text="Colors:")
734         col.prop(strip, "color_saturation", text="Saturation")
735         col.prop(strip, "color_multiply", text="Multiply")
736         col.prop(strip, "use_premultiply")
737         col.prop(strip, "use_float")
738
739         layout.prop(strip, "use_color_balance")
740         if strip.use_color_balance and strip.color_balance:  # TODO - need to add this somehow
741             row = layout.row()
742             row.active = strip.use_color_balance
743             col = row.column()
744             col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
745             col.row().prop(strip.color_balance, "lift")
746             col.prop(strip.color_balance, "invert_lift", text="Inverse")
747             col = row.column()
748             col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
749             col.row().prop(strip.color_balance, "gamma")
750             col.prop(strip.color_balance, "invert_gamma", text="Inverse")
751             col = row.column()
752             col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
753             col.row().prop(strip.color_balance, "gain")
754             col.prop(strip.color_balance, "invert_gain", text="Inverse")
755
756
757 class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
758     bl_label = "Proxy"
759
760     @classmethod
761     def poll(cls, context):
762         if not cls.has_sequencer(context):
763             return False
764
765         strip = act_strip(context)
766         if not strip:
767             return False
768
769         return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM')
770
771     def draw_header(self, context):
772         strip = act_strip(context)
773
774         self.layout.prop(strip, "use_proxy", text="")
775
776     def draw(self, context):
777         layout = self.layout
778
779         strip = act_strip(context)
780
781         flow = layout.column_flow()
782         flow.prop(strip, "use_proxy_custom_directory")
783         flow.prop(strip, "use_proxy_custom_file")
784         if strip.proxy:  # TODO - need to add this somehow
785             if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
786                 flow.prop(strip.proxy, "directory")
787             if strip.use_proxy_custom_file:
788                 flow.prop(strip.proxy, "filepath")
789
790
791 class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
792     bl_label = "Scene Preview/Render"
793     bl_space_type = 'SEQUENCE_EDITOR'
794     bl_region_type = 'UI'
795
796     def draw(self, context):
797         layout = self.layout
798         render = context.scene.render
799
800         col = layout.column()
801         col.active = False  # Currently only opengl preview works!
802         col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
803         col = layout.column()
804         #col.active = render.use_sequencer_gl_preview
805         col.prop(render, "sequencer_gl_preview", text="")
806
807         '''
808         col = layout.column()
809         col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
810         col = layout.column()
811         col.active = render.use_sequencer_gl_render
812         col.prop(render, "sequencer_gl_render", text="")
813         '''
814
815
816 class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
817     bl_label = "View Settings"
818
819     def draw(self, context):
820         layout = self.layout
821
822         st = context.space_data
823
824         col = layout.column()
825         if st.display_mode == 'IMAGE':
826             col.prop(st, "draw_overexposed")  # text="Zebra"
827             col.prop(st, "show_safe_margin")
828         if st.display_mode == 'WAVEFORM':
829             col.prop(st, "show_separate_color")
830         col.prop(st, "proxy_render_size")
831
832
833 def register():
834     pass
835
836
837 def unregister():
838     pass
839
840 if __name__ == "__main__":
841     register()