2.5
[blender-staging.git] / release / ui / buttons_scene.py
1
2 import bpy
3
4 class RenderButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "scene"
8
9 class RENDER_PT_render(RenderButtonsPanel):
10         __label__ = "Render"
11
12         def draw(self, context):
13                 layout = self.layout
14                 rd = context.scene.render_data
15
16                 row = layout.row()
17                 row.itemO("SCREEN_OT_render", text="Image", icon='ICON_IMAGE_COL')
18                 row.item_booleanO("SCREEN_OT_render", "anim", True, text="Animation", icon='ICON_SEQUENCE')
19
20                 layout.itemR(rd, "display_mode", text="Display")
21
22 class RENDER_PT_layers(RenderButtonsPanel):
23         __label__ = "Layers"
24         __default_closed__ = True
25
26         def draw(self, context):
27                 layout = self.layout
28                 scene = context.scene
29                 rd = scene.render_data
30
31                 row = layout.row()
32                 row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
33
34                 col = row.column(align=True)
35                 col.itemO("SCENE_OT_render_layer_add", icon="ICON_ZOOMIN", text="")
36                 col.itemO("SCENE_OT_render_layer_remove", icon="ICON_ZOOMOUT", text="")
37
38                 rl = rd.layers[rd.active_layer_index]
39
40                 split = layout.split()
41                 col = split.column()
42                 col.itemR(scene, "visible_layers", text="Scene")
43                 col = split.column()
44                 col.itemR(rl, "visible_layers", text="Layer")
45
46                 layout.itemR(rl, "light_override", text="Light")
47                 layout.itemR(rl, "material_override", text="Material")
48
49                 split = layout.split()
50
51                 col = split.column()
52                 col.itemR(rl, "zmask")
53                 row = col.row()
54                 row.itemR(rl, "zmask_negate", text="Negate")
55                 row.active = rl.zmask
56                 col.itemR(rl, "all_z")
57
58                 col = split.column()
59                 col.itemR(rl, "solid")
60                 col.itemR(rl, "halo")
61                 col.itemR(rl, "ztransp")
62
63                 col = split.column()
64                 col.itemR(rl, "sky")
65                 col.itemR(rl, "edge")
66                 col.itemR(rl, "strand")
67
68                 if rl.zmask:
69                         split = layout.split()
70                         split.itemL(text="Zmask Layers:")
71                         split.column().itemR(rl, "zmask_layers", text="")
72
73                 split = layout.split()
74                 col = split.column()
75                 col.itemL(text="Passes:")
76                 col.itemR(rl, "pass_combined")
77                 col.itemR(rl, "pass_z")
78                 col.itemR(rl, "pass_vector")
79                 col.itemR(rl, "pass_normal")
80                 col.itemR(rl, "pass_uv")
81                 col.itemR(rl, "pass_mist")
82                 col.itemR(rl, "pass_object_index")
83
84                 col = split.column()
85                 col.itemL()
86                 col.itemR(rl, "pass_color")
87                 col.itemR(rl, "pass_diffuse")
88                 row = col.row()
89                 row.itemR(rl, "pass_specular")
90                 row.itemR(rl, "pass_specular_exclude", text="", icon="ICON_X")
91                 row = col.row()
92                 row.itemR(rl, "pass_shadow")
93                 row.itemR(rl, "pass_shadow_exclude", text="", icon="ICON_X")
94                 row = col.row()
95                 row.itemR(rl, "pass_ao")
96                 row.itemR(rl, "pass_ao_exclude", text="", icon="ICON_X")
97                 row = col.row()
98                 row.itemR(rl, "pass_reflection")
99                 row.itemR(rl, "pass_reflection_exclude", text="", icon="ICON_X")
100                 row = col.row()
101                 row.itemR(rl, "pass_refraction")
102                 row.itemR(rl, "pass_refraction_exclude", text="", icon="ICON_X")
103
104 class RENDER_PT_shading(RenderButtonsPanel):
105         __label__ = "Shading"
106
107         def draw(self, context):
108                 layout = self.layout
109                 rd = context.scene.render_data
110                 
111                 split = layout.split()
112                 
113                 col = split.column()
114                 col.itemR(rd, "render_textures", text="Textures")
115                 col.itemR(rd, "render_shadows", text="Shadows")
116                 col.itemR(rd, "render_sss", text="Subsurface Scattering")
117                 
118                 col = split.column()
119                 col.itemR(rd, "render_envmaps", text="Environment Map")
120                 col.itemR(rd, "render_raytracing", text="Ray Tracing")
121                 col.itemR(rd, "alpha_mode", text="Alpha")
122
123 class RENDER_PT_performance(RenderButtonsPanel):
124         __label__ = "Performance"
125         __default_closed__ = True
126
127         def draw(self, context):
128                 layout = self.layout
129                 rd = context.scene.render_data
130
131                 split = layout.split()
132                 
133                 col = split.column(align=True)
134                 col.itemL(text="Threads:")
135                 col.row().itemR(rd, "threads_mode", expand=True)
136                 colsub = col.column()
137                 colsub.enabled = rd.threads_mode == 'THREADS_FIXED'
138                 colsub.itemR(rd, "threads")
139
140                 col = split.column()
141                 
142                 sub = col.column(align=True)
143                 sub.itemL(text="Tiles:")
144                 sub.itemR(rd, "parts_x", text="X")
145                 sub.itemR(rd, "parts_y", text="Y")
146
147                 split = layout.split()
148
149                 col = split.column()
150                 col.itemL(text="Memory:")
151                 row = col.row()
152                 row.itemR(rd, "save_buffers")
153                 row.enabled = not rd.full_sample
154
155                 col = split.column()
156                 col.itemL()
157                 col.itemR(rd, "free_image_textures")
158                 col.active = rd.use_compositing
159
160                 row = layout.row()
161                 row.active = rd.render_raytracing
162                 row.itemR(rd, "octree_resolution", text="Ray Tracing Octree")
163
164
165 class RENDER_PT_post_processing(RenderButtonsPanel):
166         __label__ = "Post Processing"
167         __default_closed__ = True
168
169         def draw(self, context):
170                 layout = self.layout
171                 rd = context.scene.render_data
172
173                 split = layout.split()
174
175                 col = split.column()
176                 col.itemR(rd, "use_compositing")
177                 col.itemR(rd, "use_sequencer")
178
179                 col = split.column()
180                 row = col.row()
181                 row.itemR(rd, "fields", text="Fields")
182                 rowsub = row.row()
183                 rowsub.active = rd.fields
184                 rowsub.itemR(rd, "fields_still", text="Still")
185                 rowsub = col.row()
186                 rowsub.active = rd.fields
187                 rowsub.itemR(rd, "field_order", expand=True)
188
189                 split = layout.split()
190                 split.itemL()
191                 split.itemR(rd, "dither_intensity", text="Dither", slider=True)
192                 
193 class RENDER_PT_output(RenderButtonsPanel):
194         __label__ = "Output"
195
196         def draw(self, context):
197                 layout = self.layout
198                 rd = context.scene.render_data
199                 
200                 layout.itemR(rd, "output_path", text="")
201
202                 split = layout.split()
203                 col = split.column()
204                 col.itemR(rd, "placeholders")
205                 col.itemR(rd, "no_overwrite")
206
207                 col = split.column()
208                 col.itemR(rd, "file_format", text="")
209                 col.itemR(rd, "file_extensions")                
210
211                 if rd.file_format in ('AVIJPEG', 'JPEG'):
212                         split = layout.split()
213                         split.itemR(rd, "color_mode", text="Color")
214                         split.itemR(rd, "quality", slider=True)
215                         
216                 elif rd.file_format == 'OPENEXR':
217                         split = layout.split()
218                         col = split.column()
219                         col.itemR(rd, "color_mode", text="Color")
220                         col.itemR(rd, "exr_codec")
221
222                         subsplit = split.split()
223                         col = subsplit.column()
224                         col.itemR(rd, "exr_half")
225                         col.itemR(rd, "exr_zbuf")
226                         col = subsplit.column()
227                         col.itemR(rd, "exr_preview")
228                 
229                 elif rd.file_format == 'JPEG2000':
230                         split = layout.split()
231                         col = split.column()
232                         col.itemR(rd, "color_mode", text="Color")
233                         col.itemL(text="Depth:")
234                         col.row().itemR(rd, "jpeg_depth", expand=True)
235
236                         col = split.column()
237                         col.itemR(rd, "jpeg_preset", text="")
238                         col.itemR(rd, "jpeg_ycc")
239                         col.itemR(rd, "exr_preview")
240                         
241                 elif rd.file_format in ('CINEON', 'DPX'):
242                         split = layout.split()
243                         col = split.column()
244                         col.itemR(rd, "color_mode", text="Color")
245                         col.itemR(rd, "cineon_log", text="Convert to Log")
246
247                         col = split.column(align=True)
248                         col.active = rd.cineon_log
249                         col.itemR(rd, "cineon_black", text="Black")
250                         col.itemR(rd, "cineon_white", text="White")
251                         col.itemR(rd, "cineon_gamma", text="Gamma")
252                         
253                 elif rd.file_format == 'TIFF':
254                         split = layout.split()
255                         split.itemR(rd, "color_mode", text="Color")
256                         split.itemR(rd, "tiff_bit")
257                 
258                 else:
259                         split = layout.split()
260                         split.itemR(rd, "color_mode", text="Color")
261                         split.itemL()
262
263 class RENDER_PT_encoding(RenderButtonsPanel):
264         __label__ = "Encoding"
265         __default_closed__ = True
266         
267         def poll(self, context):
268                 rd = context.scene.render_data
269                 return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
270
271         def draw(self, context):
272                 layout = self.layout
273                 rd = context.scene.render_data
274
275                 split = layout.split()
276                 split.itemR(rd, "ffmpeg_format")
277                 if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
278                         split.itemR(rd, "ffmpeg_codec")
279                 else:
280                         split.itemL()
281
282                 split = layout.split()
283         
284                 col = split.column()
285                 col.itemR(rd, "ffmpeg_video_bitrate")
286                 col.itemL(text="Rate:")
287                 col.itemR(rd, "ffmpeg_minrate", text="Minimum")
288                 col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
289                 col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
290                 
291                 col = split.column()
292                 col.itemR(rd, "ffmpeg_gopsize")
293                 col.itemR(rd, "ffmpeg_autosplit")
294                 col.itemL(text="Mux:")
295                 col.itemR(rd, "ffmpeg_muxrate", text="Rate")
296                 col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
297                 
298                 row = layout.row()
299                 row.itemL(text="Audio:")
300                 row = layout.row()
301                 row.itemR(rd, "ffmpeg_audio_codec")
302                 
303                 split = layout.split()
304
305                 col = split.column()
306                 col.itemR(rd, "ffmpeg_audio_bitrate")
307                 col = split.column()
308                 col.itemR(rd, "ffmpeg_multiplex_audio")
309
310 class RENDER_PT_antialiasing(RenderButtonsPanel):
311         __label__ = "Anti-Aliasing"
312
313         def draw_header(self, context):
314                 layout = self.layout
315                 rd = context.scene.render_data
316
317                 layout.itemR(rd, "antialiasing", text="")
318
319         def draw(self, context):
320                 layout = self.layout
321                 rd = context.scene.render_data
322
323                 layout.active = rd.antialiasing
324
325                 split = layout.split()
326                 
327                 col = split.column()
328                 col.row().itemR(rd, "antialiasing_samples", expand=True)
329                 col.itemR(rd, "full_sample")
330
331                 col = split.column()
332                 col.itemR(rd, "pixel_filter", text="Filter")
333                 col.itemR(rd, "filter_size", text="Size", slider=True)
334         
335 class RENDER_PT_dimensions(RenderButtonsPanel):
336         __label__ = "Dimensions"
337
338         def draw(self, context):
339                 layout = self.layout
340                 
341                 scene = context.scene
342                 rd = scene.render_data
343                 
344                 split = layout.split()
345                 
346                 col = split.column()
347                 sub = col.column(align=True)
348                 sub.itemL(text="Resolution:")
349                 sub.itemR(rd, "resolution_x", text="X")
350                 sub.itemR(rd, "resolution_y", text="Y")
351                 sub.itemR(rd, "resolution_percentage", text="")
352                 
353                 sub.itemL(text="Aspect Ratio:")
354                 sub.itemR(rd, "pixel_aspect_x", text="X")
355                 sub.itemR(rd, "pixel_aspect_y", text="Y")
356
357                 row = col.row()
358                 row.itemR(rd, "border", text="Border")
359                 rowsub = row.row()
360                 rowsub.active = rd.border
361                 rowsub.itemR(rd, "crop_to_border", text="Crop")
362                 
363                 col = split.column(align=True)
364                 col.itemL(text="Frame Range:")
365                 col.itemR(scene, "start_frame", text="Start")
366                 col.itemR(scene, "end_frame", text="End")
367                 col.itemR(scene, "frame_step", text="Step")
368                 
369                 col.itemL(text="Frame Rate:")
370                 col.itemR(rd, "fps")
371                 col.itemR(rd, "fps_base",text="/")
372
373 class RENDER_PT_stamp(RenderButtonsPanel):
374         __label__ = "Stamp"
375         __default_closed__ = True
376
377         def draw_header(self, context):
378                 rd = context.scene.render_data
379
380                 layout = self.layout
381                 layout.itemR(rd, "render_stamp", text="")
382
383         def draw(self, context):
384                 layout = self.layout
385                 rd = context.scene.render_data
386
387                 layout.active = rd.render_stamp
388
389                 split = layout.split()
390                 
391                 col = split.column()
392                 col.itemR(rd, "stamp_time", text="Time")
393                 col.itemR(rd, "stamp_date", text="Date")
394                 col.itemR(rd, "stamp_frame", text="Frame")
395                 col.itemR(rd, "stamp_scene", text="Scene")
396                 col.itemR(rd, "stamp_camera", text="Camera")
397                 col.itemR(rd, "stamp_filename", text="Filename")
398                 col.itemR(rd, "stamp_marker", text="Marker")
399                 col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
400
401                 sub = split.column()
402                 sub.active = rd.render_stamp
403                 sub.itemR(rd, "stamp_foreground", slider=True)
404                 sub.itemR(rd, "stamp_background", slider=True)
405                 sub.itemR(rd, "stamp_font_size", text="Font Size")
406
407                 row = layout.split(percentage=0.2)
408                 row.itemR(rd, "stamp_note", text="Note")
409                 rowsub = row.row()
410                 rowsub.active = rd.stamp_note
411                 rowsub.itemR(rd, "stamp_note_text", text="")
412
413 bpy.types.register(RENDER_PT_render)
414 bpy.types.register(RENDER_PT_dimensions)
415 bpy.types.register(RENDER_PT_antialiasing)
416 bpy.types.register(RENDER_PT_layers)
417 bpy.types.register(RENDER_PT_shading)
418 bpy.types.register(RENDER_PT_post_processing)
419 bpy.types.register(RENDER_PT_performance)
420 bpy.types.register(RENDER_PT_output)
421 bpy.types.register(RENDER_PT_encoding)
422 bpy.types.register(RENDER_PT_stamp)
423