Renamed "col2" to "wide_ui" which is more meaningful.
[blender.git] / release / scripts / ui / properties_render.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
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.
7 #
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.
12 #
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.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21
22 narrowui = 180
23
24
25 class RenderButtonsPanel(bpy.types.Panel):
26     bl_space_type = 'PROPERTIES'
27     bl_region_type = 'WINDOW'
28     bl_context = "render"
29     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
30
31     def poll(self, context):
32         rd = context.scene.render_data
33         return (context.scene and rd.use_game_engine == False) and (rd.engine in self.COMPAT_ENGINES)
34
35
36 class RENDER_PT_render(RenderButtonsPanel):
37     bl_label = "Render"
38     COMPAT_ENGINES = set(['BLENDER_RENDER'])
39
40     def draw(self, context):
41         layout = self.layout
42
43         rd = context.scene.render_data
44         wide_ui = context.region.width > narrowui
45
46         split = layout.split()
47
48         col = split.column()
49         col.itemO("screen.render", text="Image", icon='ICON_RENDER_STILL')
50
51         if wide_ui:
52             col = split.column()
53         col.item_booleanO("screen.render", "animation", True, text="Animation", icon='ICON_RENDER_ANIMATION')
54
55         layout.itemR(rd, "display_mode", text="Display")
56
57
58 class RENDER_PT_layers(RenderButtonsPanel):
59     bl_label = "Layers"
60     bl_default_closed = True
61     COMPAT_ENGINES = set(['BLENDER_RENDER'])
62
63     def draw(self, context):
64         layout = self.layout
65
66         scene = context.scene
67         rd = scene.render_data
68         wide_ui = context.region.width > narrowui
69
70         row = layout.row()
71         row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
72
73         col = row.column(align=True)
74         col.itemO("scene.render_layer_add", icon='ICON_ZOOMIN', text="")
75         col.itemO("scene.render_layer_remove", icon='ICON_ZOOMOUT', text="")
76
77         rl = rd.layers[rd.active_layer_index]
78
79         if rl:
80             layout.itemR(rl, "name")
81
82         split = layout.split()
83
84         col = split.column()
85         col.itemR(scene, "visible_layers", text="Scene")
86         if wide_ui:
87             col = split.column()
88         col.itemR(rl, "visible_layers", text="Layer")
89
90         layout.itemR(rl, "light_override", text="Light")
91         layout.itemR(rl, "material_override", text="Material")
92
93         layout.itemS()
94         layout.itemL(text="Include:")
95
96         split = layout.split()
97
98         col = split.column()
99         col.itemR(rl, "zmask")
100         row = col.row()
101         row.itemR(rl, "zmask_negate", text="Negate")
102         row.active = rl.zmask
103         col.itemR(rl, "all_z")
104
105         col = split.column()
106         col.itemR(rl, "solid")
107         col.itemR(rl, "halo")
108         col.itemR(rl, "ztransp")
109
110         col = split.column()
111         col.itemR(rl, "sky")
112         col.itemR(rl, "edge")
113         col.itemR(rl, "strand")
114
115         if rl.zmask:
116             split = layout.split()
117             split.itemL(text="Zmask Layers:")
118             split.column().itemR(rl, "zmask_layers", text="")
119
120         layout.itemS()
121
122         split = layout.split()
123
124         col = split.column()
125         col.itemL(text="Passes:")
126         col.itemR(rl, "pass_combined")
127         col.itemR(rl, "pass_z")
128         col.itemR(rl, "pass_vector")
129         col.itemR(rl, "pass_normal")
130         col.itemR(rl, "pass_uv")
131         col.itemR(rl, "pass_mist")
132         col.itemR(rl, "pass_object_index")
133
134         if wide_ui:
135             col = split.column()
136         col.itemL()
137         col.itemR(rl, "pass_color")
138         col.itemR(rl, "pass_diffuse")
139         row = col.row()
140         row.itemR(rl, "pass_specular")
141         row.itemR(rl, "pass_specular_exclude", text="", icon='ICON_X')
142         row = col.row()
143         row.itemR(rl, "pass_shadow")
144         row.itemR(rl, "pass_shadow_exclude", text="", icon='ICON_X')
145         row = col.row()
146         row.itemR(rl, "pass_ao")
147         row.itemR(rl, "pass_ao_exclude", text="", icon='ICON_X')
148         row = col.row()
149         row.itemR(rl, "pass_reflection")
150         row.itemR(rl, "pass_reflection_exclude", text="", icon='ICON_X')
151         row = col.row()
152         row.itemR(rl, "pass_refraction")
153         row.itemR(rl, "pass_refraction_exclude", text="", icon='ICON_X')
154
155
156 class RENDER_PT_shading(RenderButtonsPanel):
157     bl_label = "Shading"
158     COMPAT_ENGINES = set(['BLENDER_RENDER'])
159
160     def draw(self, context):
161         layout = self.layout
162
163         rd = context.scene.render_data
164         wide_ui = context.region.width > narrowui
165
166         split = layout.split()
167
168         col = split.column()
169         col.itemR(rd, "render_textures", text="Textures")
170         col.itemR(rd, "render_shadows", text="Shadows")
171         col.itemR(rd, "render_sss", text="Subsurface Scattering")
172         col.itemR(rd, "render_envmaps", text="Environment Map")
173
174         if wide_ui:
175             col = split.column()
176         col.itemR(rd, "render_raytracing", text="Ray Tracing")
177         col.itemR(rd, "color_management")
178         col.itemR(rd, "alpha_mode", text="Alpha")
179
180
181 class RENDER_PT_performance(RenderButtonsPanel):
182     bl_label = "Performance"
183     bl_default_closed = True
184     COMPAT_ENGINES = set(['BLENDER_RENDER'])
185
186     def draw(self, context):
187         layout = self.layout
188
189         rd = context.scene.render_data
190         wide_ui = context.region.width > narrowui
191
192         split = layout.split()
193
194         col = split.column(align=True)
195         col.itemL(text="Threads:")
196         col.row().itemR(rd, "threads_mode", expand=True)
197         sub = col.column()
198         sub.enabled = rd.threads_mode == 'THREADS_FIXED'
199         sub.itemR(rd, "threads")
200         col.itemL(text="Tiles:")
201         col.itemR(rd, "parts_x", text="X")
202         col.itemR(rd, "parts_y", text="Y")
203
204         if wide_ui:
205             col = split.column()
206         col.itemL(text="Memory:")
207         sub = col.column()
208         sub.itemR(rd, "save_buffers")
209         sub.enabled = not rd.full_sample
210         sub = col.column()
211         sub.active = rd.use_compositing
212         sub.itemR(rd, "free_image_textures")
213         sub = col.column()
214         sub.active = rd.render_raytracing
215         sub.itemL(text="Acceleration structure:")
216         sub.itemR(rd, "raytrace_structure", text="")
217         if rd.raytrace_structure == 'OCTREE':
218             sub.itemR(rd, "octree_resolution", text="Resolution")
219         else:
220             sub.itemR(rd, "use_instances", text="Instances")
221         sub.itemR(rd, "use_local_coords", text="Local Coordinates")
222
223
224 class RENDER_PT_post_processing(RenderButtonsPanel):
225     bl_label = "Post Processing"
226     bl_default_closed = True
227     COMPAT_ENGINES = set(['BLENDER_RENDER'])
228
229     def draw(self, context):
230         layout = self.layout
231
232         rd = context.scene.render_data
233         wide_ui = context.region.width > narrowui
234
235         split = layout.split()
236
237         col = split.column()
238         col.itemR(rd, "use_compositing")
239         col.itemR(rd, "use_sequencer")
240
241         if wide_ui:
242             col = split.column()
243         col.itemR(rd, "dither_intensity", text="Dither", slider=True)
244
245         layout.itemS()
246
247         split = layout.split()
248
249         col = split.column()
250         col.itemR(rd, "fields", text="Fields")
251         sub = col.column()
252         sub.active = rd.fields
253         sub.row().itemR(rd, "field_order", expand=True)
254         sub.itemR(rd, "fields_still", text="Still")
255
256
257         if wide_ui:
258             col = split.column()
259         else:
260             col.itemS()
261         col.itemR(rd, "edge")
262         sub = col.column()
263         sub.active = rd.edge
264         sub.itemR(rd, "edge_threshold", text="Threshold", slider=True)
265         sub.itemR(rd, "edge_color", text="")
266
267
268 class RENDER_PT_output(RenderButtonsPanel):
269     bl_label = "Output"
270     COMPAT_ENGINES = set(['BLENDER_RENDER'])
271
272     def draw(self, context):
273         layout = self.layout
274
275         rd = context.scene.render_data
276         wide_ui = context.region.width > narrowui
277
278         layout.itemR(rd, "output_path", text="")
279
280         split = layout.split()
281         col = split.column()
282         col.itemR(rd, "file_format", text="")
283         col.row().itemR(rd, "color_mode", text="Color", expand=True)
284
285         if wide_ui:
286             col = split.column()
287         col.itemR(rd, "file_extensions")
288         col.itemR(rd, "use_overwrite")
289         col.itemR(rd, "use_placeholder")
290
291         if rd.file_format in ('AVIJPEG', 'JPEG'):
292             split = layout.split()
293             split.itemR(rd, "quality", slider=True)
294
295         elif rd.file_format == 'OPENEXR':
296             split = layout.split()
297
298             col = split.column()
299             col.itemL(text="Codec:")
300             col.itemR(rd, "exr_codec", text="")
301
302             if wide_ui:
303                 subsplit = split.split()
304                 col = subsplit.column()
305             col.itemR(rd, "exr_half")
306             col.itemR(rd, "exr_zbuf")
307
308             if wide_ui:
309                 col = subsplit.column()
310             col.itemR(rd, "exr_preview")
311
312         elif rd.file_format == 'JPEG2000':
313             split = layout.split()
314             col = split.column()
315             col.itemL(text="Depth:")
316             col.row().itemR(rd, "jpeg2k_depth", expand=True)
317
318             if wide_ui:
319                 col = split.column()
320             col.itemR(rd, "jpeg2k_preset", text="")
321             col.itemR(rd, "jpeg2k_ycc")
322
323         elif rd.file_format in ('CINEON', 'DPX'):
324             split = layout.split()
325             col = split.column()
326             col.itemR(rd, "cineon_log", text="Convert to Log")
327
328             if wide_ui:
329                 col = split.column(align=True)
330             col.active = rd.cineon_log
331             col.itemR(rd, "cineon_black", text="Black")
332             col.itemR(rd, "cineon_white", text="White")
333             col.itemR(rd, "cineon_gamma", text="Gamma")
334
335         elif rd.file_format == 'TIFF':
336             split = layout.split()
337             split.itemR(rd, "tiff_bit")
338
339
340 class RENDER_PT_encoding(RenderButtonsPanel):
341     bl_label = "Encoding"
342     bl_default_closed = True
343     COMPAT_ENGINES = set(['BLENDER_RENDER'])
344
345     def poll(self, context):
346         rd = context.scene.render_data
347         return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
348
349     def draw(self, context):
350         layout = self.layout
351
352         rd = context.scene.render_data
353         wide_ui = context.region.width > narrowui
354
355         split = layout.split()
356
357         split.itemR(rd, "ffmpeg_format")
358         if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
359             split.itemR(rd, "ffmpeg_codec")
360         else:
361             split.itemL()
362
363         split = layout.split()
364
365         col = split.column()
366         col.itemR(rd, "ffmpeg_video_bitrate")
367         col.itemL(text="Rate:")
368         col.itemR(rd, "ffmpeg_minrate", text="Minimum")
369         col.itemR(rd, "ffmpeg_maxrate", text="Maximum")
370         col.itemR(rd, "ffmpeg_buffersize", text="Buffer")
371
372         if wide_ui:
373             col = split.column()
374         col.itemR(rd, "ffmpeg_gopsize")
375         col.itemR(rd, "ffmpeg_autosplit")
376         col.itemL(text="Mux:")
377         col.itemR(rd, "ffmpeg_muxrate", text="Rate")
378         col.itemR(rd, "ffmpeg_packetsize", text="Packet Size")
379
380         row = layout.row()
381         row.itemL(text="Audio:")
382         row = layout.row()
383         row.itemR(rd, "ffmpeg_audio_codec")
384
385         split = layout.split()
386
387         col = split.column()
388         col.itemR(rd, "ffmpeg_audio_bitrate")
389         col.itemR(rd, "ffmpeg_audio_mixrate")
390
391         if wide_ui:
392             col = split.column()
393         col.itemR(rd, "ffmpeg_multiplex_audio")
394         col.itemR(rd, "ffmpeg_audio_volume")
395
396
397 class RENDER_PT_antialiasing(RenderButtonsPanel):
398     bl_label = "Anti-Aliasing"
399     COMPAT_ENGINES = set(['BLENDER_RENDER'])
400
401     def draw_header(self, context):
402         rd = context.scene.render_data
403
404         self.layout.itemR(rd, "antialiasing", text="")
405
406     def draw(self, context):
407         layout = self.layout
408
409         rd = context.scene.render_data
410         wide_ui = context.region.width > narrowui
411         layout.active = rd.antialiasing
412
413         split = layout.split()
414
415         col = split.column()
416         col.row().itemR(rd, "antialiasing_samples", expand=True)
417         col.itemR(rd, "full_sample")
418
419         if wide_ui:
420             col = split.column()
421         col.itemR(rd, "pixel_filter", text="")
422         col.itemR(rd, "filter_size", text="Size", slider=True)
423
424
425 class RENDER_PT_dimensions(RenderButtonsPanel):
426     bl_label = "Dimensions"
427     COMPAT_ENGINES = set(['BLENDER_RENDER'])
428
429     def draw(self, context):
430         layout = self.layout
431
432         scene = context.scene
433         rd = scene.render_data
434         wide_ui = context.region.width > narrowui
435
436         split = layout.split()
437
438         col = split.column()
439         sub = col.column(align=True)
440         sub.itemL(text="Resolution:")
441         sub.itemR(rd, "resolution_x", text="X")
442         sub.itemR(rd, "resolution_y", text="Y")
443         sub.itemR(rd, "resolution_percentage", text="")
444
445         sub.itemL(text="Aspect Ratio:")
446         sub.itemR(rd, "pixel_aspect_x", text="X")
447         sub.itemR(rd, "pixel_aspect_y", text="Y")
448
449         row = col.row()
450         row.itemR(rd, "use_border", text="Border")
451         sub = row.row()
452         sub.active = rd.use_border
453         sub.itemR(rd, "crop_to_border", text="Crop")
454
455         if wide_ui:
456             col = split.column()
457         sub = col.column(align=True)
458         sub.itemL(text="Frame Range:")
459         sub.itemR(scene, "start_frame", text="Start")
460         sub.itemR(scene, "end_frame", text="End")
461         sub.itemR(scene, "frame_step", text="Step")
462
463         sub = col.column(align=True)
464         sub.itemL(text="Frame Rate:")
465         sub.itemR(rd, "fps")
466         sub.itemR(rd, "fps_base", text="/")
467
468
469 class RENDER_PT_stamp(RenderButtonsPanel):
470     bl_label = "Stamp"
471     bl_default_closed = True
472     COMPAT_ENGINES = set(['BLENDER_RENDER'])
473
474     def draw_header(self, context):
475         rd = context.scene.render_data
476
477         self.layout.itemR(rd, "render_stamp", text="")
478
479     def draw(self, context):
480         layout = self.layout
481
482         rd = context.scene.render_data
483         wide_ui = context.region.width > narrowui
484
485         layout.active = rd.render_stamp
486
487         split = layout.split()
488
489         col = split.column()
490         col.itemR(rd, "stamp_time", text="Time")
491         col.itemR(rd, "stamp_date", text="Date")
492         col.itemR(rd, "stamp_render_time", text="RenderTime")
493         col.itemR(rd, "stamp_frame", text="Frame")
494         col.itemR(rd, "stamp_scene", text="Scene")
495         col.itemR(rd, "stamp_camera", text="Camera")
496         col.itemR(rd, "stamp_filename", text="Filename")
497         col.itemR(rd, "stamp_marker", text="Marker")
498         col.itemR(rd, "stamp_sequence_strip", text="Seq. Strip")
499
500         if wide_ui:
501             col = split.column()
502         col.active = rd.render_stamp
503         col.itemR(rd, "stamp_foreground", slider=True)
504         col.itemR(rd, "stamp_background", slider=True)
505         col.itemR(rd, "stamp_font_size", text="Font Size")
506
507         row = layout.split(percentage=0.2)
508         row.itemR(rd, "stamp_note", text="Note")
509         sub = row.row()
510         sub.active = rd.stamp_note
511         sub.itemR(rd, "stamp_note_text", text="")
512
513 bpy.types.register(RENDER_PT_render)
514 bpy.types.register(RENDER_PT_layers)
515 bpy.types.register(RENDER_PT_dimensions)
516 bpy.types.register(RENDER_PT_antialiasing)
517 bpy.types.register(RENDER_PT_shading)
518 bpy.types.register(RENDER_PT_output)
519 bpy.types.register(RENDER_PT_encoding)
520 bpy.types.register(RENDER_PT_performance)
521 bpy.types.register(RENDER_PT_post_processing)
522 bpy.types.register(RENDER_PT_stamp)