Merged changes in the trunk up to revision 30814.
[blender-staging.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21
22 narrowui = bpy.context.user_preferences.view.properties_width_check
23
24
25 class RENDER_MT_presets(bpy.types.Menu):
26     bl_label = "Render Presets"
27     preset_subdir = "render"
28     preset_operator = "script.execute_preset"
29     draw = bpy.types.Menu.draw_preset
30
31
32 class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
33     bl_label = "FFMPEG Presets"
34     preset_subdir = "ffmpeg"
35     preset_operator = "script.python_file_run"
36     draw = bpy.types.Menu.draw_preset
37
38
39 class RenderButtonsPanel(bpy.types.Panel):
40     bl_space_type = 'PROPERTIES'
41     bl_region_type = 'WINDOW'
42     bl_context = "render"
43     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
44
45     def poll(self, context):
46         rd = context.scene.render
47         return (context.scene and rd.use_game_engine is False) and (rd.engine in self.COMPAT_ENGINES)
48
49
50 class RENDER_PT_render(RenderButtonsPanel):
51     bl_label = "Render"
52     COMPAT_ENGINES = {'BLENDER_RENDER'}
53
54     def draw(self, context):
55         layout = self.layout
56
57         rd = context.scene.render
58         wide_ui = context.region.width > narrowui
59
60         split = layout.split()
61
62         col = split.column()
63         col.operator("render.render", text="Image", icon='RENDER_STILL')
64
65         if wide_ui:
66             col = split.column()
67         col.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
68
69         layout.prop(rd, "display_mode", text="Display")
70
71
72 class RENDER_PT_layers(RenderButtonsPanel):
73     bl_label = "Layers"
74     bl_default_closed = True
75     COMPAT_ENGINES = {'BLENDER_RENDER'}
76
77     def draw(self, context):
78         layout = self.layout
79
80         scene = context.scene
81         rd = scene.render
82         wide_ui = context.region.width > narrowui
83
84         row = layout.row()
85         row.template_list(rd, "layers", rd, "active_layer_index", rows=2)
86
87         col = row.column(align=True)
88         col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
89         col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
90
91         rl = rd.layers[rd.active_layer_index]
92
93         if rl:
94             layout.prop(rl, "name")
95
96         split = layout.split()
97
98         col = split.column()
99         col.prop(scene, "layers", text="Scene")
100         col.label(text="")
101         col.prop(rl, "light_override", text="Light")
102         col.prop(rl, "material_override", text="Material")
103         if wide_ui:
104             col = split.column()
105         col.prop(rl, "visible_layers", text="Layer")
106         col.label(text="Mask Layers:")
107         col.prop(rl, "zmask_layers", text="")
108
109
110         layout.separator()
111         layout.label(text="Include:")
112
113         split = layout.split()
114
115         col = split.column()
116         col.prop(rl, "zmask")
117         row = col.row()
118         row.prop(rl, "zmask_negate", text="Negate")
119         row.active = rl.zmask
120         col.prop(rl, "all_z")
121
122         col = split.column()
123         col.prop(rl, "solid")
124         col.prop(rl, "halo")
125         col.prop(rl, "ztransp")
126         col.prop(rl, "sky")
127                 
128         col = split.column()
129         col.prop(rl, "edge")
130         col.prop(rl, "strand")
131         col.prop(rl, "freestyle")
132
133         layout.separator()
134
135         split = layout.split()
136
137         col = split.column()
138         col.label(text="Passes:")
139         col.prop(rl, "pass_combined")
140         col.prop(rl, "pass_z")
141         col.prop(rl, "pass_vector")
142         col.prop(rl, "pass_normal")
143         col.prop(rl, "pass_uv")
144         col.prop(rl, "pass_mist")
145         col.prop(rl, "pass_object_index")
146         col.prop(rl, "pass_color")
147
148         if wide_ui:
149             col = split.column()
150         col.label()
151         col.prop(rl, "pass_diffuse")
152         row = col.row()
153         row.prop(rl, "pass_specular")
154         row.prop(rl, "pass_specular_exclude", text="")
155         row = col.row()
156         row.prop(rl, "pass_shadow")
157         row.prop(rl, "pass_shadow_exclude", text="")
158         row = col.row()
159         row.prop(rl, "pass_emit")
160         row.prop(rl, "pass_emit_exclude", text="")
161         row = col.row()
162         row.prop(rl, "pass_ao")
163         row.prop(rl, "pass_ao_exclude", text="")
164         row = col.row()
165         row.prop(rl, "pass_environment")
166         row.prop(rl, "pass_environment_exclude", text="")
167         row = col.row()
168         row.prop(rl, "pass_indirect")
169         row.prop(rl, "pass_indirect_exclude", text="")
170         row = col.row()
171         row.prop(rl, "pass_reflection")
172         row.prop(rl, "pass_reflection_exclude", text="")
173         row = col.row()
174         row.prop(rl, "pass_refraction")
175         row.prop(rl, "pass_refraction_exclude", text="")
176
177
178 class RENDER_PT_freestyle(RenderButtonsPanel):
179     bl_label = "Freestyle"
180     COMPAT_ENGINES = {'BLENDER_RENDER'}
181
182     def poll(self, context):
183         rd = context.scene.render
184         rl = rd.layers[rd.active_layer_index]
185         return rl and rl.freestyle
186
187     def draw(self, context):
188         layout = self.layout
189
190         rd = context.scene.render
191         rl = rd.layers[rd.active_layer_index]
192         freestyle = rl.freestyle_settings
193
194         split = layout.split()
195
196         col = split.column()
197         col.prop(freestyle, "mode", text="Control Mode")
198
199         if freestyle.mode == "EDITOR":
200             col.label(text="Edge Detection Options:")
201             col.prop(freestyle, "crease_angle")
202             col.prop(freestyle, "sphere_radius")
203             col.prop(freestyle, "dkr_epsilon")
204
205             lineset = freestyle.active_lineset
206
207             col.label(text="Line Sets:")
208             row = col.row()
209             rows = 2
210             if lineset:
211                 rows = 5
212             # FIXME: scrollbar does not work correctly
213             row.template_list(freestyle, "linesets", freestyle, "active_lineset_index", rows=rows)
214
215             sub = row.column()
216             subsub = sub.column(align=True)
217             subsub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
218             subsub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
219             if lineset:
220                 sub.separator()
221                 subsub = sub.column(align=True)
222                 subsub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
223                 subsub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
224
225             if lineset:
226                 col.prop(lineset, "name")
227                 col.prop(lineset, "select_by_visibility")
228                 col.prop(lineset, "select_by_edge_types")
229
230                 if lineset.select_by_visibility:
231                     col.label(text="Visibility:")
232                     sub = col.row(align=True)
233                     sub.prop(lineset, "visibility", expand=True)
234                     if lineset.visibility == "RANGE":
235                         sub = col.row(align=True)
236                         sub.prop(lineset, "qi_start")
237                         sub.prop(lineset, "qi_end")
238
239                 if lineset.select_by_edge_types:
240                     col.label(text="Edge Types:")
241                     row = col.row()
242                     row.prop(lineset, "edge_type_negation", expand=True)
243                     row = col.row()
244                     row.prop(lineset, "edge_type_combination", expand=True)
245
246                     row = col.row()
247                     sub = row.column()
248                     sub.prop(lineset, "select_silhouette")
249                     sub.prop(lineset, "select_border")
250                     sub.prop(lineset, "select_crease")
251                     sub.prop(lineset, "select_ridge")
252                     sub.prop(lineset, "select_valley")
253                     sub.prop(lineset, "select_suggestive_contour")
254                     sub.prop(lineset, "select_material_boundary")
255                     sub = row.column()
256                     sub.prop(lineset, "select_contour")
257                     sub.prop(lineset, "select_external_contour")
258
259         else: # freestyle.mode == "SCRIPT"
260
261             col.prop(freestyle, "crease_angle")
262             col.prop(freestyle, "sphere_radius")
263             col.prop(freestyle, "ridges_and_valleys")
264             col.prop(freestyle, "suggestive_contours")
265             sub = col.row()
266             sub.prop(freestyle, "dkr_epsilon")
267             sub.active = freestyle.suggestive_contours
268             col.prop(freestyle, "material_boundaries")
269             col.operator("scene.freestyle_module_add")
270
271             for i, module in enumerate(freestyle.modules):
272                     box = layout.box()
273                     box.set_context_pointer("freestyle_module", module)
274                     row = box.row(align=True)
275                     row.prop(module, "is_displayed", text="")
276                     row.prop(module, "module_path", text="")
277                     row.operator("scene.freestyle_module_remove", icon='X', text="")
278                     row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
279                     row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
280
281
282 class RENDER_PT_freestyle_linestyle(RenderButtonsPanel):
283     bl_label = "Freestyle: Line Style"
284     COMPAT_ENGINES = {'BLENDER_RENDER'}
285
286     def poll(self, context):
287         rd = context.scene.render
288         rl = rd.layers[rd.active_layer_index]
289         if rl and rl.freestyle:
290             freestyle = rl.freestyle_settings
291             return freestyle.mode == "EDITOR" and freestyle.active_lineset
292         return False
293
294     def draw_modifier_box_header(self, box, modifier):
295         row = box.row()
296         row.set_context_pointer("modifier", modifier)
297         if modifier.expanded:
298             icon = "TRIA_DOWN"
299         else:
300             icon = "TRIA_RIGHT"
301         row.operator("scene.freestyle_modifier_toggle_fold", icon=icon, text="", emboss=False)
302         row.label(text=modifier.rna_type.name)
303         row.prop(modifier, "name", text="")
304         row.prop(modifier, "enabled", text="")
305         sub = row.row(align=True)
306         sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
307         sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
308         row.operator("scene.freestyle_modifier_remove", icon='X', text="")
309
310     def draw_color_modifier(self, context, modifier):
311         layout = self.layout
312
313         col = layout.column(align=True)
314         self.draw_modifier_box_header(col.box(), modifier)
315         if modifier.expanded:
316             box = col.box()
317             row = box.row()
318             row.prop(modifier, "blend", text="")
319             row.prop(modifier, "influence")
320             if modifier.type == "DISTANCE_FROM_OBJECT":
321                 box.prop(modifier, "target")
322             box.template_color_ramp(modifier, "color_ramp", expand=True)
323             if modifier.type not in ["ALONG_STROKE"]:
324                 row = box.row(align=True)
325                 row.prop(modifier, "range_min")
326                 row.prop(modifier, "range_max")
327
328     def draw_alpha_modifier(self, context, modifier):
329         layout = self.layout
330
331         col = layout.column(align=True)
332         self.draw_modifier_box_header(col.box(), modifier)
333         if modifier.expanded:
334             box = col.box()
335             row = box.row()
336             row.prop(modifier, "blend", text="")
337             row.prop(modifier, "influence")
338             if modifier.type == "DISTANCE_FROM_OBJECT":
339                 box.prop(modifier, "target")
340             row = box.row()
341             row.prop(modifier, "mapping", text="")
342             sub = row.column()
343             sub.prop(modifier, "invert")
344             if modifier.mapping == "CURVE":
345                 sub.enabled = False
346                 box.template_curve_mapping(modifier, "curve")
347             if modifier.type not in ["ALONG_STROKE"]:
348                 row = box.row(align=True)
349                 row.prop(modifier, "range_min")
350                 row.prop(modifier, "range_max")
351
352     def draw_thickness_modifier(self, context, modifier):
353         layout = self.layout
354
355         col = layout.column(align=True)
356         self.draw_modifier_box_header(col.box(), modifier)
357         if modifier.expanded:
358             box = col.box()
359             row = box.row()
360             row.prop(modifier, "blend", text="")
361             row.prop(modifier, "influence")
362             if modifier.type == "DISTANCE_FROM_OBJECT":
363                 box.prop(modifier, "target")
364             row = box.row()
365             row.prop(modifier, "mapping", text="")
366             sub = row.column()
367             sub.prop(modifier, "invert")
368             if modifier.mapping == "CURVE":
369                 sub.enabled = False
370                 box.template_curve_mapping(modifier, "curve")
371             if modifier.type not in ["ALONG_STROKE"]:
372                 row = box.row(align=True)
373                 row.prop(modifier, "range_min")
374                 row.prop(modifier, "range_max")
375             row = box.row(align=True)
376             row.prop(modifier, "value_min")
377             row.prop(modifier, "value_max")
378
379     def draw(self, context):
380         layout = self.layout
381
382         rd = context.scene.render
383         rl = rd.layers[rd.active_layer_index]
384         lineset = rl.freestyle_settings.active_lineset
385         linestyle = lineset.linestyle
386
387         split = layout.split()
388         col = split.column()
389         col.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
390
391         col.separator()
392         sub = col.row(align=True)
393         sub.prop(linestyle, "panel", expand=True)
394
395         if linestyle.panel == "COLOR":
396             col.label(text="Base Color:")
397             col.prop(linestyle, "color", text="")
398             col.label(text="Modifiers:")
399             layout.operator_menu_enum("scene.freestyle_color_modifier_add", "type", text="Add Modifier")
400             for modifier in linestyle.color_modifiers:
401                 self.draw_color_modifier(context, modifier)
402         elif linestyle.panel == "ALPHA":
403             col.label(text="Base Transparency:")
404             col.prop(linestyle, "alpha")
405             col.label(text="Modifiers:")
406             layout.operator_menu_enum("scene.freestyle_alpha_modifier_add", "type", text="Add Modifier")
407             for modifier in linestyle.alpha_modifiers:
408                 self.draw_alpha_modifier(context, modifier)
409         elif linestyle.panel == "THICKNESS":
410             col.label(text="Base Thickness:")
411             col.prop(linestyle, "thickness")
412             col.label(text="Modifiers:")
413             layout.operator_menu_enum("scene.freestyle_thickness_modifier_add", "type", text="Add Modifier")
414             for modifier in linestyle.thickness_modifiers:
415                 self.draw_thickness_modifier(context, modifier)
416         elif linestyle.panel == "STROKES":
417             pass
418         elif linestyle.panel == "DISTORT":
419             pass
420         elif linestyle.panel == "MISC":
421             pass
422
423
424 class RENDER_PT_shading(RenderButtonsPanel):
425     bl_label = "Shading"
426     COMPAT_ENGINES = {'BLENDER_RENDER'}
427
428     def draw(self, context):
429         layout = self.layout
430
431         rd = context.scene.render
432         wide_ui = context.region.width > narrowui
433
434         split = layout.split()
435
436         col = split.column()
437         col.prop(rd, "use_textures", text="Textures")
438         col.prop(rd, "use_shadows", text="Shadows")
439         col.prop(rd, "use_sss", text="Subsurface Scattering")
440         col.prop(rd, "use_envmaps", text="Environment Map")
441
442         if wide_ui:
443             col = split.column()
444         col.prop(rd, "use_raytracing", text="Ray Tracing")
445         col.prop(rd, "color_management")
446         col.prop(rd, "alpha_mode", text="Alpha")
447
448
449 class RENDER_PT_performance(RenderButtonsPanel):
450     bl_label = "Performance"
451     bl_default_closed = True
452     COMPAT_ENGINES = {'BLENDER_RENDER'}
453
454     def draw(self, context):
455         layout = self.layout
456
457         rd = context.scene.render
458         wide_ui = context.region.width > narrowui
459
460         split = layout.split()
461
462         col = split.column()
463         col.label(text="Threads:")
464         col.row().prop(rd, "threads_mode", expand=True)
465         sub = col.column()
466         sub.enabled = rd.threads_mode == 'FIXED'
467         sub.prop(rd, "threads")
468         sub = col.column(align=True)
469         sub.label(text="Tiles:")
470         sub.prop(rd, "parts_x", text="X")
471         sub.prop(rd, "parts_y", text="Y")
472
473         if wide_ui:
474             col = split.column()
475         col.label(text="Memory:")
476         sub = col.column()
477         sub.enabled = not (rd.use_border or rd.full_sample)
478         sub.prop(rd, "save_buffers")
479         sub = col.column()
480         sub.active = rd.use_compositing
481         sub.prop(rd, "free_image_textures")
482         sub = col.column()
483         sub.active = rd.use_raytracing
484         sub.label(text="Acceleration structure:")
485         sub.prop(rd, "raytrace_structure", text="")
486         if rd.raytrace_structure == 'OCTREE':
487             sub.prop(rd, "octree_resolution", text="Resolution")
488         else:
489             sub.prop(rd, "use_instances", text="Instances")
490         sub.prop(rd, "use_local_coords", text="Local Coordinates")
491
492
493 class RENDER_PT_post_processing(RenderButtonsPanel):
494     bl_label = "Post Processing"
495     bl_default_closed = True
496     COMPAT_ENGINES = {'BLENDER_RENDER'}
497
498     def draw(self, context):
499         layout = self.layout
500
501         rd = context.scene.render
502         wide_ui = context.region.width > narrowui
503
504         split = layout.split()
505
506         col = split.column()
507         col.prop(rd, "use_compositing")
508         col.prop(rd, "use_sequencer")
509
510         if wide_ui:
511             col = split.column()
512         col.prop(rd, "dither_intensity", text="Dither", slider=True)
513
514         layout.separator()
515
516         split = layout.split()
517
518         col = split.column()
519         col.prop(rd, "fields", text="Fields")
520         sub = col.column()
521         sub.active = rd.fields
522         sub.row().prop(rd, "field_order", expand=True)
523         sub.prop(rd, "fields_still", text="Still")
524
525
526         if wide_ui:
527             col = split.column()
528         else:
529             col.separator()
530         col.prop(rd, "edge")
531         sub = col.column()
532         sub.active = rd.edge
533         sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
534         sub.prop(rd, "edge_color", text="")
535
536         layout.separator()
537
538         split = layout.split()
539         col = split.column()
540         col.prop(rd, "freestyle", text="Freestyle")
541
542
543 class RENDER_PT_output(RenderButtonsPanel):
544     bl_label = "Output"
545     COMPAT_ENGINES = {'BLENDER_RENDER'}
546
547     def draw(self, context):
548         layout = self.layout
549
550         rd = context.scene.render
551         file_format = rd.file_format
552         wide_ui = context.region.width > narrowui
553
554         layout.prop(rd, "output_path", text="")
555
556         split = layout.split()
557         col = split.column()
558         col.prop(rd, "file_format", text="")
559         col.row().prop(rd, "color_mode", text="Color", expand=True)
560
561         if wide_ui:
562             col = split.column()
563         col.prop(rd, "use_file_extension")
564         col.prop(rd, "use_overwrite")
565         col.prop(rd, "use_placeholder")
566
567         if file_format in ('AVI_JPEG', 'JPEG'):
568             split = layout.split()
569             split.prop(rd, "file_quality", slider=True)
570         
571         if file_format == 'PNG':
572             split = layout.split()
573             split.prop(rd, "file_quality", slider=True, text="Compression")
574
575         elif file_format == 'MULTILAYER':
576             split = layout.split()
577
578             col = split.column()
579             col.label(text="Codec:")
580             col.prop(rd, "exr_codec", text="")
581             if wide_ui:
582                 col = split.column()
583
584         elif file_format == 'OPEN_EXR':
585             split = layout.split()
586
587             col = split.column()
588             col.label(text="Codec:")
589             col.prop(rd, "exr_codec", text="")
590
591             if wide_ui:
592                 subsplit = split.split()
593                 col = subsplit.column()
594             col.prop(rd, "exr_half")
595             col.prop(rd, "exr_zbuf")
596
597             if wide_ui:
598                 col = subsplit.column()
599             col.prop(rd, "exr_preview")
600
601         elif file_format == 'JPEG2000':
602             split = layout.split()
603             col = split.column()
604             col.label(text="Depth:")
605             col.row().prop(rd, "jpeg2k_depth", expand=True)
606
607             if wide_ui:
608                 col = split.column()
609             col.prop(rd, "jpeg2k_preset", text="")
610             col.prop(rd, "jpeg2k_ycc")
611
612         elif file_format in ('CINEON', 'DPX'):
613             split = layout.split()
614             col = split.column()
615             col.prop(rd, "cineon_log", text="Convert to Log")
616
617             if wide_ui:
618                 col = split.column(align=True)
619             col.active = rd.cineon_log
620             col.prop(rd, "cineon_black", text="Black")
621             col.prop(rd, "cineon_white", text="White")
622             col.prop(rd, "cineon_gamma", text="Gamma")
623
624         elif file_format == 'TIFF':
625             split = layout.split()
626             split.prop(rd, "tiff_bit")
627
628         elif file_format == 'QUICKTIME_CARBON':
629             split = layout.split()
630             split.operator("scene.render_data_set_quicktime_codec")
631
632         elif file_format == 'QUICKTIME_QTKIT':
633             split = layout.split()
634             col = split.column()
635             col.prop(rd, "quicktime_codec_type", text="Video Codec")
636             col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
637
638             # Audio
639             col.prop(rd, "quicktime_audiocodec_type", text="Audio Codec")
640             if rd.quicktime_audiocodec_type != 'No audio':
641                 split = layout.split()
642                 col = split.column()
643                 if rd.quicktime_audiocodec_type == 'LPCM':
644                     col.prop(rd, "quicktime_audio_bitdepth", text="")
645                 if wide_ui:
646                     col = split.column()
647                 col.prop(rd, "quicktime_audio_samplerate", text="")
648
649                 split = layout.split()
650                 col = split.column()
651                 if rd.quicktime_audiocodec_type == 'AAC':
652                     col.prop(rd, "quicktime_audio_bitrate")
653                 if wide_ui:
654                     subsplit = split.split()
655                     col = subsplit.column()
656                 if rd.quicktime_audiocodec_type == 'AAC':
657                     col.prop(rd, "quicktime_audio_codec_isvbr")
658                 if wide_ui:
659                     col = subsplit.column()
660                 col.prop(rd, "quicktime_audio_resampling_hq")
661
662
663 class RENDER_PT_encoding(RenderButtonsPanel):
664     bl_label = "Encoding"
665     bl_default_closed = True
666     COMPAT_ENGINES = {'BLENDER_RENDER'}
667
668     def poll(self, context):
669         rd = context.scene.render
670         return rd.file_format in ('FFMPEG', 'XVID', 'H264', 'THEORA')
671
672     def draw(self, context):
673         layout = self.layout
674
675         rd = context.scene.render
676         wide_ui = context.region.width > narrowui
677
678         layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
679
680         split = layout.split()
681
682         col = split.column()
683         col.prop(rd, "ffmpeg_format")
684         if rd.ffmpeg_format in ('AVI', 'QUICKTIME', 'MKV', 'OGG'):
685             if wide_ui:
686                 col = split.column()
687             col.prop(rd, "ffmpeg_codec")
688         else:
689             if wide_ui:
690                 split.label()
691
692         split = layout.split()
693
694         col = split.column()
695         col.prop(rd, "ffmpeg_video_bitrate")
696         if wide_ui:
697             col = split.column()
698         col.prop(rd, "ffmpeg_gopsize")
699
700         split = layout.split()
701
702         col = split.column()
703         col.label(text="Rate:")
704         col.prop(rd, "ffmpeg_minrate", text="Minimum")
705         col.prop(rd, "ffmpeg_maxrate", text="Maximum")
706         col.prop(rd, "ffmpeg_buffersize", text="Buffer")
707
708         if wide_ui:
709             col = split.column()
710
711         col.prop(rd, "ffmpeg_autosplit")
712         col.label(text="Mux:")
713         col.prop(rd, "ffmpeg_muxrate", text="Rate")
714         col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
715
716         # Audio:
717         sub = layout.column()
718
719         if rd.ffmpeg_format not in ('MP3'):
720             sub.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
721
722         sub.separator()
723
724         split = sub.split()
725
726         col = split.column()
727         col.prop(rd, "ffmpeg_audio_bitrate")
728         col.prop(rd, "ffmpeg_audio_mixrate")
729
730         if wide_ui:
731             col = split.column()
732         col.prop(rd, "ffmpeg_audio_volume", slider=True)
733
734
735 class RENDER_PT_antialiasing(RenderButtonsPanel):
736     bl_label = "Anti-Aliasing"
737     COMPAT_ENGINES = {'BLENDER_RENDER'}
738
739     def draw_header(self, context):
740         rd = context.scene.render
741
742         self.layout.prop(rd, "render_antialiasing", text="")
743
744     def draw(self, context):
745         layout = self.layout
746
747         rd = context.scene.render
748         wide_ui = context.region.width > narrowui
749         layout.active = rd.render_antialiasing
750
751         split = layout.split()
752
753         col = split.column()
754         col.row().prop(rd, "antialiasing_samples", expand=True)
755         sub = col.row()
756         sub.enabled = not rd.use_border
757         sub.prop(rd, "full_sample")
758
759         if wide_ui:
760             col = split.column()
761         col.prop(rd, "pixel_filter", text="")
762         col.prop(rd, "filter_size", text="Size")
763
764
765 class RENDER_PT_motion_blur(RenderButtonsPanel):
766     bl_label = "Full Sample Motion Blur"
767     bl_default_closed = True
768     COMPAT_ENGINES = {'BLENDER_RENDER'}
769
770     def draw_header(self, context):
771         rd = context.scene.render
772
773         self.layout.prop(rd, "motion_blur", text="")
774
775     def draw(self, context):
776         layout = self.layout
777
778         rd = context.scene.render
779         layout.active = rd.motion_blur
780
781         row = layout.row()
782         row.prop(rd, "motion_blur_samples")
783         row.prop(rd, "motion_blur_shutter")
784
785
786 class RENDER_PT_dimensions(RenderButtonsPanel):
787     bl_label = "Dimensions"
788     COMPAT_ENGINES = {'BLENDER_RENDER'}
789
790     def draw(self, context):
791         layout = self.layout
792
793         scene = context.scene
794         rd = scene.render
795         wide_ui = context.region.width > narrowui
796
797         row = layout.row(align=True)
798         row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
799         row.operator("render.preset_add", text="", icon="ZOOMIN")
800
801         split = layout.split()
802
803         col = split.column()
804         sub = col.column(align=True)
805         sub.label(text="Resolution:")
806         sub.prop(rd, "resolution_x", text="X")
807         sub.prop(rd, "resolution_y", text="Y")
808         sub.prop(rd, "resolution_percentage", text="")
809
810         sub.label(text="Aspect Ratio:")
811         sub.prop(rd, "pixel_aspect_x", text="X")
812         sub.prop(rd, "pixel_aspect_y", text="Y")
813
814         row = col.row()
815         row.prop(rd, "use_border", text="Border")
816         sub = row.row()
817         sub.active = rd.use_border
818         sub.prop(rd, "crop_to_border", text="Crop")
819
820         if wide_ui:
821             col = split.column()
822         sub = col.column(align=True)
823         sub.label(text="Frame Range:")
824         sub.prop(scene, "frame_start", text="Start")
825         sub.prop(scene, "frame_end", text="End")
826         sub.prop(scene, "frame_step", text="Step")
827
828         sub.label(text="Frame Rate:")
829         sub.prop(rd, "fps")
830         sub.prop(rd, "fps_base", text="/")
831
832
833 class RENDER_PT_stamp(RenderButtonsPanel):
834     bl_label = "Stamp"
835     bl_default_closed = True
836     COMPAT_ENGINES = {'BLENDER_RENDER'}
837
838     def draw_header(self, context):
839         rd = context.scene.render
840
841         self.layout.prop(rd, "render_stamp", text="")
842
843     def draw(self, context):
844         layout = self.layout
845
846         rd = context.scene.render
847         wide_ui = context.region.width > narrowui
848
849         layout.active = rd.render_stamp
850
851         split = layout.split()
852
853         col = split.column()
854         col.prop(rd, "stamp_time", text="Time")
855         col.prop(rd, "stamp_date", text="Date")
856         col.prop(rd, "stamp_render_time", text="RenderTime")
857         col.prop(rd, "stamp_frame", text="Frame")
858         col.prop(rd, "stamp_scene", text="Scene")
859         col.prop(rd, "stamp_camera", text="Camera")
860         col.prop(rd, "stamp_filename", text="Filename")
861         col.prop(rd, "stamp_marker", text="Marker")
862         col.prop(rd, "stamp_sequencer_strip", text="Seq. Strip")
863
864         if wide_ui:
865             col = split.column()
866         col.active = rd.render_stamp
867         col.prop(rd, "stamp_foreground", slider=True)
868         col.prop(rd, "stamp_background", slider=True)
869         col.separator()
870         col.prop(rd, "stamp_font_size", text="Font Size")
871
872         row = layout.split(percentage=0.2)
873         row.prop(rd, "stamp_note", text="Note")
874         sub = row.row()
875         sub.active = rd.stamp_note
876         sub.prop(rd, "stamp_note_text", text="")
877
878
879 class RENDER_PT_bake(RenderButtonsPanel):
880     bl_label = "Bake"
881     bl_default_closed = True
882     COMPAT_ENGINES = {'BLENDER_RENDER'}
883
884     def draw(self, context):
885         layout = self.layout
886
887         rd = context.scene.render
888         wide_ui = context.region.width > narrowui
889
890         layout.operator("object.bake_image", icon='RENDER_STILL')
891         
892         if wide_ui:
893             layout.prop(rd, "bake_type")
894         else:
895             layout.prop(rd, "bake_type", text="")
896         
897         if rd.bake_type == 'NORMALS':
898             if wide_ui:
899                 layout.prop(rd, "bake_normal_space")
900             else:
901                 layout.prop(rd, "bake_normal_space", text="")
902         elif rd.bake_type in ('DISPLACEMENT', 'AO'):
903             layout.prop(rd, "bake_normalized")
904         
905         # col.prop(rd, "bake_aa_mode")
906         # col.prop(rd, "bake_enable_aa")
907         
908         layout.separator()
909         
910         split = layout.split()
911
912         col = split.column()
913         col.prop(rd, "bake_clear")
914         col.prop(rd, "bake_margin")
915         col.prop(rd, "bake_quad_split", text="Split")
916         
917         if wide_ui:
918             col = split.column()
919         col.prop(rd, "bake_active")
920         sub = col.column()
921         sub.active = rd.bake_active
922         sub.prop(rd, "bake_distance")
923         sub.prop(rd, "bake_bias")
924
925         
926 classes = [
927     RENDER_MT_presets,
928     RENDER_MT_ffmpeg_presets,
929     RENDER_PT_render,
930     RENDER_PT_layers,
931     RENDER_PT_freestyle,
932     RENDER_PT_freestyle_linestyle,
933     RENDER_PT_dimensions,
934     RENDER_PT_antialiasing,
935     RENDER_PT_motion_blur,
936     RENDER_PT_shading,
937     RENDER_PT_output,
938     RENDER_PT_encoding,
939     RENDER_PT_performance,
940     RENDER_PT_post_processing,
941     RENDER_PT_stamp,
942     RENDER_PT_bake]
943
944
945 def register():
946     register = bpy.types.register
947     for cls in classes:
948         register(cls)
949
950
951 def unregister():
952     unregister = bpy.types.unregister
953     for cls in classes:
954         unregister(cls)
955
956 if __name__ == "__main__":
957     register()