1 # ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
23 def act_strip(context):
25 return context.scene.sequence_editor.active_strip
26 except AttributeError:
30 class SEQUENCER_HT_header(bpy.types.Header):
31 bl_space_type = 'SEQUENCE_EDITOR'
33 def draw(self, context):
36 st = context.space_data
38 row = layout.row(align=True)
41 if context.area.show_menus:
42 sub = row.row(align=True)
43 sub.menu("SEQUENCER_MT_view")
47 if st.display_mode == 'SEQUENCER':
48 sub.menu("SEQUENCER_MT_select")
49 sub.menu("SEQUENCER_MT_marker")
50 sub.menu("SEQUENCER_MT_add")
51 sub.menu("SEQUENCER_MT_strip")
53 layout.prop(st, "display_mode", text="")
55 if st.display_mode == 'SEQUENCER':
57 layout.operator("sequencer.refresh_all")
59 layout.prop(st, "display_channel", text="Channel")
62 class SEQUENCER_MT_view(bpy.types.Menu):
65 def draw(self, context):
68 st = context.space_data
73 uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP);
74 short yco= 0, menuwidth=120;
76 if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
77 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
78 "Play Back Animation "
79 "in all Sequence Areas|Alt A", 0, yco-=20,
80 menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
83 uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL,
84 "Grease Pencil...", 0, yco-=20,
85 menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
88 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
89 "Play Back Animation "
90 "in this window|Alt A", 0, yco-=20,
91 menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
93 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1,
94 "Play Back Animation in all "
95 "3D Views and Sequence Areas|Alt Shift A",
97 menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
101 layout.operator("sequencer.view_all")
102 layout.operator("sequencer.view_selected")
104 layout.prop(st, "draw_frames")
105 layout.prop(st, "show_cframe_indicator")
106 if st.display_mode == 'IMAGE':
107 layout.prop(st, "draw_safe_margin")
108 if st.display_mode == 'WAVEFORM':
109 layout.prop(st, "separate_color_preview")
113 layout.operator("screen.area_dupli")
114 layout.operator("screen.screen_full_area")
117 class SEQUENCER_MT_select(bpy.types.Menu):
120 def draw(self, context):
124 layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
125 layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
127 layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
128 layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
129 layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
131 layout.operator("sequencer.select_linked")
132 layout.operator("sequencer.select_all_toggle")
133 layout.operator("sequencer.select_inverse")
136 class SEQUENCER_MT_marker(bpy.types.Menu):
137 bl_label = "Marker (TODO)"
139 def draw(self, context):
143 layout.operator("marker.add", text="Add Marker")
144 layout.operator("marker.duplicate", text="Duplicate Marker")
145 layout.operator("marker.move", text="Grab/Move Marker")
146 layout.operator("marker.delete", text="Delete Marker")
148 layout.label(text="ToDo: Name Marker")
150 #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
153 class SEQUENCER_MT_add(bpy.types.Menu):
156 def draw(self, context):
158 layout.operator_context = 'INVOKE_REGION_WIN'
161 layout.operator("sequencer.scene_strip_add", text="Scene")
162 layout.operator("sequencer.movie_strip_add", text="Movie")
163 layout.operator("sequencer.image_strip_add", text="Image")
164 layout.operator("sequencer.sound_strip_add", text="Sound")
166 layout.menu("SEQUENCER_MT_add_effect")
169 class SEQUENCER_MT_add_effect(bpy.types.Menu):
170 bl_label = "Effect Strip..."
172 def draw(self, context):
174 layout.operator_context = 'INVOKE_REGION_WIN'
177 layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
178 layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
179 layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
180 layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
181 layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
182 layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
183 layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
184 layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
185 layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
186 layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
187 layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
188 layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
189 layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
190 layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
193 class SEQUENCER_MT_strip(bpy.types.Menu):
196 def draw(self, context):
199 layout.operator_context = 'INVOKE_REGION_WIN'
202 layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
203 layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
204 # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
207 layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
208 layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
209 layout.operator("sequencer.images_separate")
212 layout.operator("sequencer.duplicate")
213 layout.operator("sequencer.delete")
215 strip = act_strip(context)
220 if stype == 'EFFECT':
222 layout.operator("sequencer.effect_change")
223 layout.operator("sequencer.effect_reassign_inputs")
224 elif stype == 'IMAGE':
226 # layout.operator("sequencer.image_change")
227 layout.operator("sequencer.rendersize")
228 elif stype == 'SCENE':
230 layout.operator("sequencer.scene_change", text="Change Scene")
231 elif stype == 'MOVIE':
233 layout.operator("sequencer.movie_change")
234 layout.operator("sequencer.rendersize")
238 layout.operator("sequencer.meta_make")
239 layout.operator("sequencer.meta_separate")
241 #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
243 # uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
247 layout.operator("sequencer.reload")
249 layout.operator("sequencer.lock")
250 layout.operator("sequencer.unlock")
251 layout.operator("sequencer.mute")
252 layout.operator("sequencer.unmute")
254 layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
256 layout.operator("sequencer.snap")
258 layout.operator("sequencer.swap_right")
259 layout.operator("sequencer.swap_left")
262 class SequencerButtonsPanel(bpy.types.Panel):
263 bl_space_type = 'SEQUENCE_EDITOR'
264 bl_region_type = 'UI'
266 def poll(self, context):
267 return (context.space_data.display_mode == 'SEQUENCER') and (act_strip(context) is not None)
270 class SequencerButtonsPanel_Output(bpy.types.Panel):
271 bl_space_type = 'SEQUENCE_EDITOR'
272 bl_region_type = 'UI'
274 def poll(self, context):
275 return context.space_data.display_mode != 'SEQUENCER'
278 class SEQUENCER_PT_edit(SequencerButtonsPanel):
279 bl_label = "Edit Strip"
281 def draw(self, context):
284 strip = act_strip(context)
286 split = layout.split(percentage=0.3)
287 split.label(text="Name:")
288 split.prop(strip, "name", text="")
290 split = layout.split(percentage=0.3)
291 split.label(text="Type:")
292 split.prop(strip, "type", text="")
294 split = layout.split(percentage=0.3)
295 split.label(text="Blend:")
296 split.prop(strip, "blend_mode", text="")
299 if strip.mute == True:
300 row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON', text="")
301 elif strip.mute is False:
302 row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_OFF', text="")
305 sub.active = (not strip.mute)
307 sub.prop(strip, "blend_opacity", text="Opacity", slider=True)
310 row.prop(strip, "lock")
311 row.prop(strip, "frame_locked", text="Frame Lock")
313 col = layout.column()
314 col.enabled = not strip.lock
315 col.prop(strip, "channel")
316 col.prop(strip, "start_frame")
317 col.prop(strip, "length")
319 col = layout.column(align=True)
320 col.label(text="Offset:")
321 col.prop(strip, "start_offset", text="Start")
322 col.prop(strip, "end_offset", text="End")
324 col = layout.column(align=True)
325 col.label(text="Still:")
326 col.prop(strip, "start_still", text="Start")
327 col.prop(strip, "end_still", text="End")
330 class SEQUENCER_PT_effect(SequencerButtonsPanel):
331 bl_label = "Effect Strip"
333 def poll(self, context):
334 if context.space_data.display_mode != 'SEQUENCER':
337 strip = act_strip(context)
341 return strip.type in ('ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
342 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
344 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED')
346 def draw(self, context):
349 strip = act_strip(context)
351 if strip.type == 'COLOR':
352 layout.prop(strip, "color")
354 elif strip.type == 'WIPE':
356 col = layout.column()
357 col.prop(strip, "transition_type")
358 col.label(text="Direction:")
359 col.row().prop(strip, "direction", expand=True)
361 col = layout.column()
362 col.prop(strip, "blur_width", slider=True)
363 if strip.transition_type in ('SINGLE', 'DOUBLE'):
364 col.prop(strip, "angle")
366 elif strip.type == 'GLOW':
367 flow = layout.column_flow()
368 flow.prop(strip, "threshold", slider=True)
369 flow.prop(strip, "clamp", slider=True)
370 flow.prop(strip, "boost_factor")
371 flow.prop(strip, "blur_distance")
374 row.prop(strip, "quality", slider=True)
375 row.prop(strip, "only_boost")
377 elif strip.type == 'SPEED':
378 layout.prop(strip, "global_speed")
380 flow = layout.column_flow()
381 flow.prop(strip, "curve_velocity")
382 flow.prop(strip, "curve_compress_y")
383 flow.prop(strip, "frame_blending")
385 elif strip.type == 'TRANSFORM':
387 col = layout.column()
388 col.prop(strip, "interpolation")
389 col.prop(strip, "translation_unit")
391 col = layout.column(align=True)
392 col.label(text="Position X:")
393 col.prop(strip, "translate_start_x", text="Start")
394 col.prop(strip, "translate_end_x", text="End")
396 col = layout.column(align=True)
397 col.label(text="Position Y:")
398 col.prop(strip, "translate_start_y", text="Start")
399 col.prop(strip, "translate_end_y", text="End")
403 col = layout.column(align=True)
404 col.prop(strip, "uniform_scale")
406 if (strip.uniform_scale):
407 col = layout.column(align=True)
408 col.label(text="Scale:")
409 col.prop(strip, "scale_start_x", text="Start")
410 col.prop(strip, "scale_end_x", text="End")
412 col = layout.column(align=True)
413 col.label(text="Scale X:")
414 col.prop(strip, "scale_start_x", text="Start")
415 col.prop(strip, "scale_end_x", text="End")
417 col = layout.column(align=True)
418 col.label(text="Scale Y:")
419 col.prop(strip, "scale_start_y", text="Start")
420 col.prop(strip, "scale_end_y", text="End")
424 col = layout.column(align=True)
425 col.label(text="Rotation:")
426 col.prop(strip, "rotation_start", text="Start")
427 col.prop(strip, "rotation_end", text="End")
429 col = layout.column(align=True)
430 if strip.type == 'SPEED':
431 col.prop(strip, "speed_fader", text="Speed fader")
432 elif strip.type in ('CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE',
434 col.prop(strip, "use_effect_default_fade", "Default fade")
435 if not strip.use_effect_default_fade:
436 col.prop(strip, "effect_fader", text="Effect fader")
439 class SEQUENCER_PT_input(SequencerButtonsPanel):
440 bl_label = "Strip Input"
442 def poll(self, context):
443 if context.space_data.display_mode != 'SEQUENCER':
446 strip = act_strip(context)
450 return strip.type in ('MOVIE', 'IMAGE')
452 def draw(self, context):
455 strip = act_strip(context)
457 split = layout.split(percentage=0.2)
459 col.label(text="Path:")
461 col.prop(strip, "directory", text="")
463 # Current element for the filename
465 elem = strip.getStripElem(context.scene.current_frame)
467 split = layout.split(percentage=0.2)
469 col.label(text="File:")
471 col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
473 layout.prop(strip, "use_translation", text="Image Offset:")
475 col = layout.column(align=True)
476 col.active = strip.use_translation
477 col.prop(strip.transform, "offset_x", text="X")
478 col.prop(strip.transform, "offset_y", text="Y")
480 layout.prop(strip, "use_crop", text="Image Crop:")
482 col = layout.column(align=True)
483 col.active = strip.use_crop
484 col.prop(strip.crop, "top")
485 col.prop(strip.crop, "left")
486 col.prop(strip.crop, "bottom")
487 col.prop(strip.crop, "right")
489 col = layout.column(align=True)
490 col.label(text="Trim Duration:")
491 col.prop(strip, "animation_start_offset", text="Start")
492 col.prop(strip, "animation_end_offset", text="End")
495 class SEQUENCER_PT_sound(SequencerButtonsPanel):
498 def poll(self, context):
499 if context.space_data.display_mode != 'SEQUENCER':
502 strip = act_strip(context)
506 return (strip.type == 'SOUND')
508 def draw(self, context):
511 strip = act_strip(context)
513 layout.template_ID(strip, "sound", open="sound.open")
516 layout.prop(strip.sound, "filename", text="")
519 if strip.sound.packed_file:
520 row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
522 row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
524 row.prop(strip.sound, "caching")
526 layout.prop(strip, "volume")
529 class SEQUENCER_PT_scene(SequencerButtonsPanel):
532 def poll(self, context):
533 if context.space_data.display_mode != 'SEQUENCER':
536 strip = act_strip(context)
540 return (strip.type == 'SCENE')
542 def draw(self, context):
545 strip = act_strip(context)
547 layout.template_ID(strip, "scene")
550 class SEQUENCER_PT_filter(SequencerButtonsPanel):
553 def poll(self, context):
554 if context.space_data.display_mode != 'SEQUENCER':
557 strip = act_strip(context)
561 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
563 def draw(self, context):
566 strip = act_strip(context)
568 col = layout.column()
569 col.label(text="Video:")
570 col.prop(strip, "strobe")
571 col.prop(strip, "de_interlace")
573 col = layout.column()
574 col.label(text="Colors:")
575 col.prop(strip, "multiply_colors", text="Multiply")
576 col.prop(strip, "premultiply")
577 col.prop(strip, "convert_float")
579 col = layout.column()
580 col.label(text="Flip:")
581 col.prop(strip, "flip_x", text="X")
582 col.prop(strip, "flip_y", text="Y")
583 col.prop(strip, "reverse_frames", text="Backwards")
585 layout.prop(strip, "use_color_balance")
586 if strip.color_balance: # TODO - need to add this somehow
588 row.active = strip.use_color_balance
590 col.prop(strip.color_balance, "lift")
591 col.prop(strip.color_balance, "inverse_lift", text="Inverse")
593 col.prop(strip.color_balance, "gamma")
594 col.prop(strip.color_balance, "inverse_gamma", text="Inverse")
596 col.prop(strip.color_balance, "gain")
597 col.prop(strip.color_balance, "inverse_gain", text="Inverse")
600 class SEQUENCER_PT_proxy(SequencerButtonsPanel):
603 def poll(self, context):
604 if context.space_data.display_mode != 'SEQUENCER':
607 strip = act_strip(context)
611 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
613 def draw_header(self, context):
614 strip = act_strip(context)
616 self.layout.prop(strip, "use_proxy", text="")
618 def draw(self, context):
621 strip = act_strip(context)
623 flow = layout.column_flow()
624 flow.prop(strip, "proxy_custom_directory")
625 if strip.proxy: # TODO - need to add this somehow
626 flow.prop(strip.proxy, "directory")
627 flow.prop(strip.proxy, "file")
630 class SEQUENCER_PT_view(SequencerButtonsPanel_Output):
631 bl_label = "View Settings"
633 def draw(self, context):
636 st = context.space_data
638 col = layout.column()
639 col.prop(st, "draw_overexposed") # text="Zebra"
640 col.prop(st, "draw_safe_margin")
642 bpy.types.register(SEQUENCER_HT_header) # header/menu classes
643 bpy.types.register(SEQUENCER_MT_view)
644 bpy.types.register(SEQUENCER_MT_select)
645 bpy.types.register(SEQUENCER_MT_marker)
646 bpy.types.register(SEQUENCER_MT_add)
647 bpy.types.register(SEQUENCER_MT_add_effect)
648 bpy.types.register(SEQUENCER_MT_strip)
650 bpy.types.register(SEQUENCER_PT_edit) # sequencer panels
651 bpy.types.register(SEQUENCER_PT_effect)
652 bpy.types.register(SEQUENCER_PT_input)
653 bpy.types.register(SEQUENCER_PT_sound)
654 bpy.types.register(SEQUENCER_PT_scene)
655 bpy.types.register(SEQUENCER_PT_filter)
656 bpy.types.register(SEQUENCER_PT_proxy)
658 bpy.types.register(SEQUENCER_PT_view) # view panels