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