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