2.5 Interface:
[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 class SequencerButtonsPanel(bpy.types.Panel):
9         __space_type__ = "BUTTONS_WINDOW"
10         __region_type__ = "WINDOW"
11         __context__ = "sequencer"
12
13         def poll(self, context):
14                 return act_strip(context) != None
15
16 class SEQUENCER_PT_edit(SequencerButtonsPanel):
17         __label__ = "Edit Strip"
18         __idname__ = "SEQUENCER_PT_edit"
19
20         def draw(self, context):
21                 layout = self.layout
22                 
23                 strip = act_strip(context)
24                 
25                 layout.itemR(strip, "name")
26                 
27                 layout.itemR(strip, "blend_mode")
28                 
29                 layout.itemR(strip, "blend_opacity")
30                 
31                 row = layout.row()
32                 row.itemR(strip, "mute")
33                 row.itemR(strip, "lock")
34                 row.itemR(strip, "frame_locked")
35                 
36                 row = layout.row()
37                 row.itemR(strip, "channel")
38                 row.itemR(strip, "start_frame")
39                 
40                 row = layout.row()
41                 row.itemR(strip, "length")
42                 row.itemR(strip, "type")
43                 
44 class SEQUENCER_PT_effect(SequencerButtonsPanel):
45         __label__ = "Effect Strip"
46         __idname__ = "SEQUENCER_PT_effect"
47
48         def poll(self, context):
49                 strip = act_strip(context)
50                 if not strip:
51                         return False
52                 
53                 return strip.type in ('COLOR', 'WIPE', 'GLOW', 'SPEED', 'TRANSFORM')
54
55         def draw(self, context):
56                 layout = self.layout
57                 
58                 strip = act_strip(context)
59                 
60                 if strip.type == 'COLOR':
61                         layout.itemR(strip, "color")
62                         
63                 elif strip.type == 'WIPE':
64                         row = layout.row()
65                         row.itemL(text="Transition Type:")
66                         row.itemL(text="Direction:")
67                         
68                         row = layout.row()
69                         row.itemR(strip, "transition_type", text="")
70                         row.itemR(strip, "direction", text="")
71                         
72                         row = layout.row()
73                         row.itemR(strip, "blur_width")
74                         if strip.transition_type in ('SINGLE', 'DOUBLE'):
75                                 row.itemR(strip, "angle")
76                                 
77                 elif strip.type == 'GLOW':
78                         flow = layout.column_flow()
79                         flow.itemR(strip, "threshold")
80                         flow.itemR(strip, "clamp")
81                         flow.itemR(strip, "boost_factor")
82                         flow.itemR(strip, "blur_distance")
83                         
84                         row = layout.row()
85                         row.itemR(strip, "quality", slider=True)
86                         row.itemR(strip, "only_boost")
87                         
88                 elif strip.type == 'SPEED':
89                         layout.itemR(strip, "global_speed")
90                         
91                         flow = layout.column_flow()
92                         flow.itemR(strip, "curve_velocity")
93                         flow.itemR(strip, "curve_compress_y")
94                         flow.itemR(strip, "frame_blending")
95                         
96                 elif strip.type == 'TRANSFORM':
97                         row = layout.row()
98                         row.itemL(text="Interpolation:")
99                         row.itemL(text="Translation Unit:")
100                         
101                         row = layout.row()
102                         row.itemR(strip, "interpolation", text="")
103                         row.itemR(strip, "translation_unit", text="")
104                         
105                         split = layout.split()
106                         
107                         col = split.column()
108                         sub = col.column(align=True) 
109                         sub.itemL(text="Position X:")
110                         sub.itemR(strip, "translate_start_x", text="Start")
111                         sub.itemR(strip, "translate_end_x", text="End")
112                         
113                         sub = col.column(align=True) 
114                         sub.itemL(text="Scale X:")
115                         sub.itemR(strip, "scale_start_x", text="Start")
116                         sub.itemR(strip, "scale_end_x", text="End")
117                         
118                         sub = col.column(align=True) 
119                         sub.itemL(text="Rotation:")
120                         sub.itemR(strip, "rotation_start", text="Start")
121                         sub.itemR(strip, "rotation_end", text="End")
122                         
123                         col = split.column()
124                         sub = col.column(align=True) 
125                         sub.itemL(text="Position Y:")
126                         sub.itemR(strip, "translate_start_y", text="Start")
127                         sub.itemR(strip, "translate_end_y", text="End")
128                         
129                         sub = col.column(align=True) 
130                         sub.itemL(text="Scale Y:")
131                         sub.itemR(strip, "scale_start_y", text="Start")
132                         sub.itemR(strip, "scale_end_y", text="End")
133
134 class SEQUENCER_PT_input(SequencerButtonsPanel):
135         __label__ = "Strip Input"
136         __idname__ = "SEQUENCER_PT_input"
137         
138         def poll(self, context):
139                 strip = act_strip(context)
140                 if not strip:
141                         return False
142                 
143                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
144         
145         def draw(self, context):
146                 layout = self.layout
147                 
148                 strip = act_strip(context)
149                 
150                 layout.itemR(strip, "directory")
151                 
152                 # TODO - get current element!
153                 layout.itemR(strip.elements[0], "filename")
154                 
155                 """
156                 layout.itemR(strip, "use_crop")
157                 
158                 flow = layout.column_flow()
159                 flow.active = strip.use_crop
160                 flow.itemR(strip, "top")
161                 flow.itemR(strip, "left")
162                 flow.itemR(strip, "bottom")
163                 flow.itemR(strip, "right")
164                 """
165
166 class SEQUENCER_PT_filter(SequencerButtonsPanel):
167         __label__ = "Filter"
168         __idname__ = "SEQUENCER_PT_filter"
169         
170         def poll(self, context):
171                 strip = act_strip(context)
172                 if not strip:
173                         return False
174                 
175                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
176         
177         def draw(self, context):
178                 layout = self.layout
179                 
180                 strip = act_strip(context)
181                 
182                 row = layout.row()
183                 row.itemR(strip, "premultiply")
184                 row.itemR(strip, "convert_float")
185                 row.itemR(strip, "de_interlace")
186                 
187                 row = layout.row()
188                 row.itemR(strip, "flip_x")
189                 row.itemR(strip, "flip_y")
190                 row.itemR(strip, "reverse_frames")
191                 
192                 row = layout.row()
193                 row.itemR(strip, "multiply_colors")
194                 row.itemR(strip, "strobe")
195                 
196                 layout.itemR(strip, "use_color_balance")
197
198 class SEQUENCER_PT_proxy(SequencerButtonsPanel):
199         __label__ = "Proxy"
200         __idname__ = "SEQUENCER_PT_proxy"
201         
202         def poll(self, context):
203                 strip = act_strip(context)
204                 if not strip:
205                         return False
206                 
207                 return strip.type in ('MOVIE', 'IMAGE', 'SCENE', 'META')
208         
209         def draw_header(self, context):
210                 strip = act_strip(context)
211
212                 layout = self.layout
213                 
214                 layout.itemR(strip, "use_proxy", text="")
215
216         def draw(self, context):
217                 strip = act_strip(context)
218                 
219                 layout = self.layout
220                 
221                 row = layout.row()
222                 row.itemR(strip, "proxy_custom_directory")
223                 # row.itemR(strip.proxy, "dir") # TODO
224         
225 bpy.types.register(SEQUENCER_PT_edit)
226 bpy.types.register(SEQUENCER_PT_effect)
227 bpy.types.register(SEQUENCER_PT_input)
228 bpy.types.register(SEQUENCER_PT_filter)
229 bpy.types.register(SEQUENCER_PT_proxy)