61f780c541da78a44f1fab61dc2090a499b1bd0f
[blender.git] / release / ui / buttons_sequencer.py
1
2 import bpy
3
4 def act_strip(context):
5         try:            return context.scene.sequence_editor.active_strip
6         except: return None
7
8
9 class SequencerButtonsPanel(bpy.types.Panel):
10         __space_type__ = "BUTTONS_WINDOW"
11         __region_type__ = "WINDOW"
12         __context__ = "sequencer"
13
14         def poll(self, context):
15                 return act_strip(context) != None
16
17 class SEQUENCER_PT_edit(SequencerButtonsPanel):
18         __label__ = "Edit Strip"
19         __idname__ = "SEQUENCER_PT_edit"
20
21         def draw(self, context):
22                 layout = self.layout
23                 
24                 strip = act_strip(context)
25                 
26                 row = layout.row()
27                 row.itemR(strip, "name")
28                 
29                 row = layout.row()
30                 row.itemR(strip, "blend_mode")
31                 
32                 row = layout.row()
33                 row.itemR(strip, "blend_opacity")
34                 
35                 row = layout.row()
36                 row.itemR(strip, "mute")
37                 row.itemR(strip, "lock")
38                 row.itemR(strip, "frame_locked")
39                 
40                 row = layout.row()
41                 row.itemR(strip, "channel")
42                 row.itemR(strip, "start_frame")
43                 
44                 row = layout.row()
45                 row.itemR(strip, "length")
46                 row.itemR(strip, "type")
47                 
48 class SEQUENCER_PT_effect(SequencerButtonsPanel):
49         __label__ = "Effect Strip"
50         __idname__ = "SEQUENCER_PT_effect"
51
52         def poll(self, context):
53                 strip = act_strip(context)
54                 if not strip:
55                         return False
56                 
57                 # This is a crummy way to detect effects
58                 return strip.type in ('REPLACE', 'CROSS', 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER', 'GAMMA_ACROSS', 'MULTIPLY', 'OVER_DROP', 'PLUGIN', 'WIPE', 'GLOW', 'COLOR', 'SPEED')
59                 
60         def draw(self, context):
61                 layout = self.layout
62                 
63                 strip = act_strip(context)
64                 
65                 if strip.type == 'COLOR':
66                         row = layout.row()
67                         row.itemR(strip, "color")
68                 # More Todo - maybe give each its own panel?
69
70 class SEQUENCER_PT_input(SequencerButtonsPanel):
71         __label__ = "Strip Input"
72         __idname__ = "SEQUENCER_PT_input"
73         
74         def poll(self, context):
75                 strip = act_strip(context)
76                 if not strip:
77                         return False
78                 
79                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
80         
81         def draw(self, context):
82                 layout = self.layout
83                 
84                 strip = act_strip(context)
85                 
86                 row = layout.row()
87                 row.itemR(strip, "directory")
88                 
89                 # TODO - get current element!
90                 row = layout.row()
91                 row.itemR(strip.elements[0], "filename")
92                 
93                 
94 class SEQUENCER_PT_filter(SequencerButtonsPanel):
95         __label__ = "Filter"
96         __idname__ = "SEQUENCER_PT_filter"
97         
98         def poll(self, context):
99                 strip = act_strip(context)
100                 if not strip:
101                         return False
102                 
103                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
104         
105         def draw(self, context):
106                 layout = self.layout
107                 
108                 strip = act_strip(context)
109                 
110                 row = layout.row()
111                 row.itemR(strip, "premultiply")
112                 row.itemR(strip, "convert_float")
113                 row.itemR(strip, "de_interlace")
114                 
115                 row = layout.row()
116                 row.itemR(strip, "flip_x")
117                 row.itemR(strip, "flip_y")
118                 row.itemR(strip, "reverse_frames")
119                 
120                 row = layout.row()
121                 row.itemR(strip, "multiply_colors")
122                 row.itemR(strip, "strobe")
123                 
124                 row = layout.row()
125                 row.itemR(strip, "use_color_balance")
126                         
127         
128 class SEQUENCER_PT_proxy(SequencerButtonsPanel):
129         __label__ = "Proxy"
130         __idname__ = "SEQUENCER_PT_proxy"
131         
132         def poll(self, context):
133                 strip = act_strip(context)
134                 if not strip:
135                         return False
136                 
137                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
138         
139         def draw_header(self, context):
140                 strip = act_strip(context)
141
142                 layout = self.layout
143                 
144                 layout.itemR(strip, "use_proxy", text="")
145
146         def draw(self, context):
147                 strip = act_strip(context)
148                 
149                 layout = self.layout
150                 
151                 row = layout.row()
152                 row.itemR(strip, "proxy_custom_directory")
153                 # row.itemR(strip.proxy, "dir") # TODO
154         
155 bpy.types.register(SEQUENCER_PT_edit)
156 bpy.types.register(SEQUENCER_PT_effect)
157 bpy.types.register(SEQUENCER_PT_input)
158 bpy.types.register(SEQUENCER_PT_filter)
159 bpy.types.register(SEQUENCER_PT_proxy)