Merge branch 'master' into blender2.8
[blender.git] / release / scripts / startup / bl_ui / properties_render.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2
3 #
4 #  This program is free software; you can redistribute it and/or
5 #  modify it under the terms of the GNU General Public License
6 #  as published by the Free Software Foundation; either version 2
7 #  of the License, or (at your option) any later version.
8 #
9 #  This program is distributed in the hope that it will be useful,
10 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #  GNU General Public License for more details.
13 #
14 #  You should have received a copy of the GNU General Public License
15 #  along with this program; if not, write to the Free Software Foundation,
16 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18 # ##### END GPL LICENSE BLOCK #####
19
20 # <pep8 compliant>
21 import bpy
22 from bpy.types import Menu, Panel
23
24
25 class RENDER_MT_presets(Menu):
26     bl_label = "Render Presets"
27     preset_subdir = "render"
28     preset_operator = "script.execute_preset"
29     draw = Menu.draw_preset
30
31
32 class RENDER_MT_ffmpeg_presets(Menu):
33     bl_label = "FFMPEG Presets"
34     preset_subdir = "ffmpeg"
35     preset_operator = "script.python_file_run"
36     draw = Menu.draw_preset
37
38
39 class RENDER_MT_framerate_presets(Menu):
40     bl_label = "Frame Rate Presets"
41     preset_subdir = "framerate"
42     preset_operator = "script.execute_preset"
43     draw = Menu.draw_preset
44
45
46 class RenderButtonsPanel:
47     bl_space_type = 'PROPERTIES'
48     bl_region_type = 'WINDOW'
49     bl_context = "render"
50     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
51
52     @classmethod
53     def poll(cls, context):
54         scene = context.scene
55         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
56
57
58 class RENDER_PT_context(Panel):
59     bl_space_type = 'PROPERTIES'
60     bl_region_type = 'WINDOW'
61     bl_context = "render"
62     bl_options = {'HIDE_HEADER'}
63     bl_label = ""
64
65     @classmethod
66     def poll(cls, context):
67         return context.scene
68
69     def draw(self, context):
70         layout = self.layout
71
72         scene = context.scene
73         view_render = scene.view_render
74
75         if view_render.has_multiple_engines:
76             layout.prop(view_render, "engine", text="")
77
78
79 class RENDER_PT_render(RenderButtonsPanel, Panel):
80     bl_label = "Render"
81     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
82
83     def draw(self, context):
84         layout = self.layout
85
86         rd = context.scene.render
87
88         row = layout.row(align=True)
89         row.operator("render.render", text="Render", icon='RENDER_STILL')
90         row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
91         row.operator("sound.mixdown", text="Audio", icon='PLAY_AUDIO')
92
93         split = layout.split(percentage=0.33)
94
95         split.label(text="Display:")
96         row = split.row(align=True)
97         row.prop(rd, "display_mode", text="")
98         row.prop(rd, "use_lock_interface", icon_only=True)
99
100
101 class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
102     bl_label = "Dimensions"
103     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
104
105     _frame_rate_args_prev = None
106     _preset_class = None
107
108     @staticmethod
109     def _draw_framerate_label(*args):
110         # avoids re-creating text string each draw
111         if RENDER_PT_dimensions._frame_rate_args_prev == args:
112             return RENDER_PT_dimensions._frame_rate_ret
113
114         fps, fps_base, preset_label = args
115
116         if fps_base == 1.0:
117             fps_rate = round(fps)
118         else:
119             fps_rate = round(fps / fps_base, 2)
120
121         # TODO: Change the following to iterate over existing presets
122         custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
123
124         if custom_framerate is True:
125             fps_label_text = "Custom (%r fps)" % fps_rate
126             show_framerate = True
127         else:
128             fps_label_text = "%r fps" % fps_rate
129             show_framerate = (preset_label == "Custom")
130
131         RENDER_PT_dimensions._frame_rate_args_prev = args
132         RENDER_PT_dimensions._frame_rate_ret = args = (fps_label_text, show_framerate)
133         return args
134
135     @staticmethod
136     def draw_framerate(sub, rd):
137         if RENDER_PT_dimensions._preset_class is None:
138             RENDER_PT_dimensions._preset_class = bpy.types.RENDER_MT_framerate_presets
139
140         args = rd.fps, rd.fps_base, RENDER_PT_dimensions._preset_class.bl_label
141         fps_label_text, show_framerate = RENDER_PT_dimensions._draw_framerate_label(*args)
142
143         sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
144
145         if show_framerate:
146             sub.prop(rd, "fps")
147             sub.prop(rd, "fps_base", text="/")
148
149     def draw(self, context):
150         layout = self.layout
151
152         scene = context.scene
153         rd = scene.render
154
155         row = layout.row(align=True)
156         row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
157         row.operator("render.preset_add", text="", icon='ZOOMIN')
158         row.operator("render.preset_add", text="", icon='ZOOMOUT').remove_active = True
159
160         split = layout.split()
161
162         col = split.column()
163         sub = col.column(align=True)
164         sub.label(text="Resolution:")
165         sub.prop(rd, "resolution_x", text="X")
166         sub.prop(rd, "resolution_y", text="Y")
167         sub.prop(rd, "resolution_percentage", text="")
168
169         sub.label(text="Aspect Ratio:")
170         sub.prop(rd, "pixel_aspect_x", text="X")
171         sub.prop(rd, "pixel_aspect_y", text="Y")
172
173         row = col.row()
174         row.prop(rd, "use_border", text="Border")
175         sub = row.row()
176         sub.active = rd.use_border
177         sub.prop(rd, "use_crop_to_border", text="Crop")
178
179         col = split.column()
180         sub = col.column(align=True)
181         sub.label(text="Frame Range:")
182         sub.prop(scene, "frame_start")
183         sub.prop(scene, "frame_end")
184         sub.prop(scene, "frame_step")
185
186         sub.label(text="Frame Rate:")
187
188         self.draw_framerate(sub, rd)
189
190         subrow = sub.row(align=True)
191         subrow.label(text="Time Remapping:")
192         subrow = sub.row(align=True)
193         subrow.prop(rd, "frame_map_old", text="Old")
194         subrow.prop(rd, "frame_map_new", text="New")
195
196
197 class RENDER_PT_antialiasing(RenderButtonsPanel, Panel):
198     bl_label = "Anti-Aliasing"
199     COMPAT_ENGINES = {'BLENDER_RENDER'}
200
201     def draw_header(self, context):
202         rd = context.scene.render
203
204         self.layout.prop(rd, "use_antialiasing", text="")
205
206     def draw(self, context):
207         layout = self.layout
208
209         rd = context.scene.render
210         layout.active = rd.use_antialiasing
211
212         split = layout.split()
213
214         col = split.column()
215         col.row().prop(rd, "antialiasing_samples", expand=True)
216         sub = col.row()
217         sub.prop(rd, "use_full_sample")
218
219         col = split.column()
220         col.prop(rd, "pixel_filter_type", text="")
221         col.prop(rd, "filter_size", text="Size")
222
223
224 class RENDER_PT_motion_blur(RenderButtonsPanel, Panel):
225     bl_label = "Sampled Motion Blur"
226     bl_options = {'DEFAULT_CLOSED'}
227     COMPAT_ENGINES = {'BLENDER_RENDER'}
228
229     @classmethod
230     def poll(cls, context):
231         scene = context.scene
232         rd = scene.render
233         view_render = scene.view_render
234         return not rd.use_full_sample and (view_render.engine in cls.COMPAT_ENGINES)
235
236     def draw_header(self, context):
237         rd = context.scene.render
238
239         self.layout.prop(rd, "use_motion_blur", text="")
240
241     def draw(self, context):
242         layout = self.layout
243
244         rd = context.scene.render
245         layout.active = rd.use_motion_blur
246
247         row = layout.row()
248         row.prop(rd, "motion_blur_samples")
249         row.prop(rd, "motion_blur_shutter")
250
251
252 class RENDER_PT_shading(RenderButtonsPanel, Panel):
253     bl_label = "Shading"
254     bl_options = {'DEFAULT_CLOSED'}
255     COMPAT_ENGINES = {'BLENDER_RENDER'}
256
257     def draw(self, context):
258         layout = self.layout
259
260         rd = context.scene.render
261
262         split = layout.split()
263
264         col = split.column()
265         col.prop(rd, "use_textures", text="Textures")
266         col.prop(rd, "use_shadows", text="Shadows")
267         col.prop(rd, "use_sss", text="Subsurface Scattering")
268         col.prop(rd, "use_envmaps", text="Environment Map")
269
270         col = split.column()
271         col.prop(rd, "use_raytrace", text="Ray Tracing")
272         col.prop(rd, "alpha_mode", text="Alpha")
273         col.prop(rd, "use_world_space_shading", text="World Space Shading")
274
275
276 class RENDER_PT_performance(RenderButtonsPanel, Panel):
277     bl_label = "Performance"
278     bl_options = {'DEFAULT_CLOSED'}
279     COMPAT_ENGINES = {'BLENDER_RENDER'}
280
281     def draw(self, context):
282         layout = self.layout
283
284         rd = context.scene.render
285
286         split = layout.split()
287
288         col = split.column(align=True)
289         col.label(text="Threads:")
290         col.row(align=True).prop(rd, "threads_mode", expand=True)
291         sub = col.column(align=True)
292         sub.enabled = rd.threads_mode == 'FIXED'
293         sub.prop(rd, "threads")
294
295         col.label(text="Tile Size:")
296         col.prop(rd, "tile_x", text="X")
297         col.prop(rd, "tile_y", text="Y")
298
299         col.separator()
300         col.prop(rd, "preview_start_resolution")
301         col.prop(rd, "preview_pixel_size", text="")
302
303         col = split.column()
304         col.label(text="Memory:")
305         sub = col.column()
306         sub.enabled = not rd.use_full_sample
307         sub.prop(rd, "use_save_buffers")
308         sub = col.column()
309         sub.active = rd.use_compositing
310         sub.prop(rd, "use_free_image_textures")
311         sub = col.column()
312         sub.active = rd.use_raytrace
313         sub.label(text="Acceleration Structure:")
314         sub.prop(rd, "raytrace_method", text="")
315         if rd.raytrace_method == 'OCTREE':
316             sub.prop(rd, "octree_resolution", text="Resolution")
317         else:
318             sub.prop(rd, "use_instances", text="Instances")
319         sub.prop(rd, "use_local_coords", text="Local Coordinates")
320
321
322 class RENDER_PT_post_processing(RenderButtonsPanel, Panel):
323     bl_label = "Post Processing"
324     bl_options = {'DEFAULT_CLOSED'}
325     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
326
327     def draw(self, context):
328         layout = self.layout
329
330         rd = context.scene.render
331
332         split = layout.split()
333
334         col = split.column()
335         col.prop(rd, "use_compositing")
336         col.prop(rd, "use_sequencer")
337
338         split.prop(rd, "dither_intensity", text="Dither", slider=True)
339
340         if context.scene.view_render.engine == 'BLENDER_EEVEE':
341             return
342
343         layout.separator()
344
345         split = layout.split()
346
347         col = split.column()
348         col.prop(rd, "use_fields", text="Fields")
349         sub = col.column()
350         sub.active = rd.use_fields
351         sub.row().prop(rd, "field_order", expand=True)
352         sub.prop(rd, "use_fields_still", text="Still")
353
354         col = split.column()
355         col.prop(rd, "use_edge_enhance")
356         sub = col.column()
357         sub.active = rd.use_edge_enhance
358         sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
359         sub.prop(rd, "edge_color", text="")
360
361
362 class RENDER_PT_stamp(RenderButtonsPanel, Panel):
363     bl_label = "Metadata"
364     bl_options = {'DEFAULT_CLOSED'}
365     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
366
367     def draw(self, context):
368         layout = self.layout
369
370         rd = context.scene.render
371
372         layout.prop(rd, "use_stamp")
373         col = layout.column()
374         col.active = rd.use_stamp
375         row = col.row()
376         row.prop(rd, "stamp_font_size", text="Font Size")
377         row.prop(rd, "use_stamp_labels", text="Draw Labels")
378
379         row = col.row()
380         row.column().prop(rd, "stamp_foreground", slider=True)
381         row.column().prop(rd, "stamp_background", slider=True)
382
383         layout.label("Enabled Metadata")
384         split = layout.split()
385
386         col = split.column()
387         col.prop(rd, "use_stamp_time", text="Time")
388         col.prop(rd, "use_stamp_date", text="Date")
389         col.prop(rd, "use_stamp_render_time", text="RenderTime")
390         col.prop(rd, "use_stamp_frame", text="Frame")
391         col.prop(rd, "use_stamp_scene", text="Scene")
392         col.prop(rd, "use_stamp_memory", text="Memory")
393
394         col = split.column()
395         col.prop(rd, "use_stamp_camera", text="Camera")
396         col.prop(rd, "use_stamp_lens", text="Lens")
397         col.prop(rd, "use_stamp_filename", text="Filename")
398         col.prop(rd, "use_stamp_frame_range", text="Frame range")
399         col.prop(rd, "use_stamp_marker", text="Marker")
400         col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
401
402         row = layout.split(percentage=0.2)
403         row.prop(rd, "use_stamp_note", text="Note")
404         sub = row.row()
405         sub.active = rd.use_stamp_note
406         sub.prop(rd, "stamp_note_text", text="")
407         if rd.use_sequencer:
408             layout.label("Sequencer:")
409             layout.prop(rd, "use_stamp_strip_meta")
410
411
412 class RENDER_PT_output(RenderButtonsPanel, Panel):
413     bl_label = "Output"
414     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
415
416     def draw(self, context):
417         layout = self.layout
418
419         rd = context.scene.render
420         image_settings = rd.image_settings
421         file_format = image_settings.file_format
422
423         layout.prop(rd, "filepath", text="")
424
425         split = layout.split()
426
427         col = split.column()
428         col.active = not rd.is_movie_format
429         col.prop(rd, "use_overwrite")
430         col.prop(rd, "use_placeholder")
431
432         col = split.column()
433         col.prop(rd, "use_file_extension")
434         col.prop(rd, "use_render_cache")
435
436         layout.template_image_settings(image_settings, color_management=False)
437         if rd.use_multiview:
438             layout.template_image_views(image_settings)
439
440
441 class RENDER_PT_encoding(RenderButtonsPanel, Panel):
442     bl_label = "Encoding"
443     bl_options = {'DEFAULT_CLOSED'}
444     COMPAT_ENGINES = {'BLENDER_RENDER'}
445
446     @classmethod
447     def poll(cls, context):
448         rd = context.scene.render
449         return rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
450
451     def draw(self, context):
452         layout = self.layout
453
454         rd = context.scene.render
455         ffmpeg = rd.ffmpeg
456
457         layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
458
459         split = layout.split()
460         split.prop(rd.ffmpeg, "format")
461         split.prop(ffmpeg, "use_autosplit")
462
463         layout.separator()
464
465         needs_codec = ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4'}
466         if needs_codec:
467             layout.prop(ffmpeg, "codec")
468
469         if ffmpeg.codec in {'DNXHD'}:
470             layout.prop(ffmpeg, "use_lossless_output")
471
472         # Output quality
473         use_crf = needs_codec and ffmpeg.codec in {'H264', 'MPEG4'}
474         if use_crf:
475             layout.prop(ffmpeg, "constant_rate_factor")
476
477         # Encoding speed
478         layout.prop(ffmpeg, "ffmpeg_preset")
479         # I-frames
480         layout.prop(ffmpeg, "gopsize")
481         # B-Frames
482         row = layout.row()
483         row.prop(ffmpeg, "use_max_b_frames", text="Max B-frames")
484         pbox = row.split()
485         pbox.prop(ffmpeg, "max_b_frames", text="")
486         pbox.enabled = ffmpeg.use_max_b_frames
487
488         if not use_crf or ffmpeg.constant_rate_factor == 'NONE':
489             split = layout.split()
490             col = split.column()
491             col.label(text="Rate:")
492             col.prop(ffmpeg, "video_bitrate")
493             col.prop(ffmpeg, "minrate", text="Minimum")
494             col.prop(ffmpeg, "maxrate", text="Maximum")
495             col.prop(ffmpeg, "buffersize", text="Buffer")
496
497             col = split.column()
498             col.label(text="Mux:")
499             col.prop(ffmpeg, "muxrate", text="Rate")
500             col.prop(ffmpeg, "packetsize", text="Packet Size")
501
502         layout.separator()
503
504         # Audio:
505         if ffmpeg.format != 'MP3':
506             layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
507
508         if ffmpeg.audio_codec != 'NONE':
509             row = layout.row()
510             row.prop(ffmpeg, "audio_bitrate")
511             row.prop(ffmpeg, "audio_volume", slider=True)
512
513
514 class RENDER_PT_bake(RenderButtonsPanel, Panel):
515     bl_label = "Bake"
516     bl_options = {'DEFAULT_CLOSED'}
517     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
518
519     def draw(self, context):
520         layout = self.layout
521
522         rd = context.scene.render
523
524         layout.operator("object.bake_image", icon='RENDER_STILL')
525
526         layout.prop(rd, "bake_type")
527
528         multires_bake = False
529         if rd.bake_type in ['NORMALS', 'DISPLACEMENT', 'DERIVATIVE', 'AO']:
530             layout.prop(rd, "use_bake_multires")
531             multires_bake = rd.use_bake_multires
532
533         if not multires_bake:
534             if rd.bake_type == 'NORMALS':
535                 layout.prop(rd, "bake_normal_space")
536             elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
537                 layout.prop(rd, "use_bake_normalize")
538
539             # col.prop(rd, "bake_aa_mode")
540             # col.prop(rd, "use_bake_antialiasing")
541
542             layout.separator()
543
544             split = layout.split()
545
546             col = split.column()
547             col.prop(rd, "use_bake_to_vertex_color")
548             sub = col.column()
549             sub.active = not rd.use_bake_to_vertex_color
550             sub.prop(rd, "use_bake_clear")
551             sub.prop(rd, "bake_margin")
552             sub.prop(rd, "bake_quad_split", text="Split")
553
554             col = split.column()
555             col.prop(rd, "use_bake_selected_to_active")
556             sub = col.column()
557             sub.active = rd.use_bake_selected_to_active
558             sub.prop(rd, "bake_distance")
559             sub.prop(rd, "bake_bias")
560         else:
561             split = layout.split()
562
563             col = split.column()
564             col.prop(rd, "use_bake_clear")
565             col.prop(rd, "bake_margin")
566
567             if rd.bake_type == 'DISPLACEMENT':
568                 col = split.column()
569                 col.prop(rd, "use_bake_lores_mesh")
570
571             if rd.bake_type == 'AO':
572                 col = split.column()
573                 col.prop(rd, "bake_bias")
574                 col.prop(rd, "bake_samples")
575
576         if rd.bake_type == 'DERIVATIVE':
577             row = layout.row()
578             row.prop(rd, "use_bake_user_scale", text="")
579
580             sub = row.column()
581             sub.active = rd.use_bake_user_scale
582             sub.prop(rd, "bake_user_scale", text="User Scale")
583
584
585 class RENDER_PT_clay_layer_settings(RenderButtonsPanel, Panel):
586     bl_label = "Clay Layer Settings"
587     COMPAT_ENGINES = {'BLENDER_CLAY'}
588
589     def draw(self, context):
590         layout = self.layout
591         props = context.scene.layer_properties['BLENDER_CLAY']
592
593         col = layout.column()
594         col.prop(props, "ssao_samples")
595
596
597 class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel):
598     bl_label = "Clay Collection Settings"
599     COMPAT_ENGINES = {'BLENDER_CLAY'}
600
601     def draw(self, context):
602         layout = self.layout
603         props = context.scene.collection_properties['BLENDER_CLAY']
604
605         col = layout.column()
606         col.template_icon_view(props, "matcap_icon")
607         col.prop(props, "matcap_rotation")
608         col.prop(props, "matcap_hue")
609         col.prop(props, "matcap_saturation")
610         col.prop(props, "matcap_value")
611         col.prop(props, "ssao_factor_cavity")
612         col.prop(props, "ssao_factor_edge")
613         col.prop(props, "ssao_distance")
614         col.prop(props, "ssao_attenuation")
615         col.prop(props, "hair_brightness_randomness")
616
617
618 class RENDER_PT_eevee_ambient_occlusion(RenderButtonsPanel, Panel):
619     bl_label = "Ambient Occlusion"
620     bl_options = {'DEFAULT_CLOSED'}
621     COMPAT_ENGINES = {'BLENDER_EEVEE'}
622
623     @classmethod
624     def poll(cls, context):
625         scene = context.scene
626         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
627
628     def draw_header(self, context):
629         scene = context.scene
630         props = scene.layer_properties['BLENDER_EEVEE']
631         self.layout.prop(props, "gtao_enable", text="")
632
633     def draw(self, context):
634         layout = self.layout
635         scene = context.scene
636         props = scene.layer_properties['BLENDER_EEVEE']
637
638         layout.active = props.gtao_enable
639         col = layout.column()
640         col.prop(props, "gtao_use_bent_normals")
641         col.prop(props, "gtao_bounce")
642         col.prop(props, "gtao_distance")
643         col.prop(props, "gtao_factor")
644         col.prop(props, "gtao_quality")
645
646
647 class RENDER_PT_eevee_motion_blur(RenderButtonsPanel, Panel):
648     bl_label = "Motion Blur"
649     bl_options = {'DEFAULT_CLOSED'}
650     COMPAT_ENGINES = {'BLENDER_EEVEE'}
651
652     @classmethod
653     def poll(cls, context):
654         scene = context.scene
655         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
656
657     def draw_header(self, context):
658         scene = context.scene
659         props = scene.layer_properties['BLENDER_EEVEE']
660         self.layout.prop(props, "motion_blur_enable", text="")
661
662     def draw(self, context):
663         layout = self.layout
664         scene = context.scene
665         props = scene.layer_properties['BLENDER_EEVEE']
666
667         layout.active = props.motion_blur_enable
668         col = layout.column()
669         col.prop(props, "motion_blur_samples")
670         col.prop(props, "motion_blur_shutter")
671
672
673 class RENDER_PT_eevee_depth_of_field(RenderButtonsPanel, Panel):
674     bl_label = "Depth of Field"
675     bl_options = {'DEFAULT_CLOSED'}
676     COMPAT_ENGINES = {'BLENDER_EEVEE'}
677
678     @classmethod
679     def poll(cls, context):
680         scene = context.scene
681         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
682
683     def draw_header(self, context):
684         scene = context.scene
685         props = scene.layer_properties['BLENDER_EEVEE']
686         self.layout.prop(props, "dof_enable", text="")
687
688     def draw(self, context):
689         layout = self.layout
690         scene = context.scene
691         props = scene.layer_properties['BLENDER_EEVEE']
692
693         layout.active = props.dof_enable
694         col = layout.column()
695         col.prop(props, "bokeh_max_size")
696         col.prop(props, "bokeh_threshold")
697
698
699 class RENDER_PT_eevee_bloom(RenderButtonsPanel, Panel):
700     bl_label = "Bloom"
701     bl_options = {'DEFAULT_CLOSED'}
702     COMPAT_ENGINES = {'BLENDER_EEVEE'}
703
704     @classmethod
705     def poll(cls, context):
706         scene = context.scene
707         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
708
709     def draw_header(self, context):
710         scene = context.scene
711         props = scene.layer_properties['BLENDER_EEVEE']
712         self.layout.prop(props, "bloom_enable", text="")
713
714     def draw(self, context):
715         layout = self.layout
716         scene = context.scene
717         props = scene.layer_properties['BLENDER_EEVEE']
718
719         layout.active = props.bloom_enable
720         col = layout.column()
721         col.prop(props, "bloom_threshold")
722         col.prop(props, "bloom_knee")
723         col.prop(props, "bloom_radius")
724         col.prop(props, "bloom_color")
725         col.prop(props, "bloom_intensity")
726         col.prop(props, "bloom_clamp")
727
728
729 class RENDER_PT_eevee_volumetric(RenderButtonsPanel, Panel):
730     bl_label = "Volumetric"
731     bl_options = {'DEFAULT_CLOSED'}
732     COMPAT_ENGINES = {'BLENDER_EEVEE'}
733
734     @classmethod
735     def poll(cls, context):
736         scene = context.scene
737         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
738
739     def draw_header(self, context):
740         scene = context.scene
741         props = scene.layer_properties['BLENDER_EEVEE']
742         self.layout.prop(props, "volumetric_enable", text="")
743
744     def draw(self, context):
745         layout = self.layout
746         scene = context.scene
747         props = scene.layer_properties['BLENDER_EEVEE']
748
749         layout.active = props.volumetric_enable
750         col = layout.column()
751         col.prop(props, "volumetric_start")
752         col.prop(props, "volumetric_end")
753         col.prop(props, "volumetric_tile_size")
754         col.prop(props, "volumetric_samples")
755         col.prop(props, "volumetric_sample_distribution")
756         col.prop(props, "volumetric_lights")
757         col.prop(props, "volumetric_light_clamp")
758         col.prop(props, "volumetric_shadows")
759         col.prop(props, "volumetric_shadow_samples")
760         col.prop(props, "volumetric_colored_transmittance")
761
762
763 class RENDER_PT_eevee_subsurface_scattering(RenderButtonsPanel, Panel):
764     bl_label = "Subsurface Scattering"
765     bl_options = {'DEFAULT_CLOSED'}
766     COMPAT_ENGINES = {'BLENDER_EEVEE'}
767
768     @classmethod
769     def poll(cls, context):
770         scene = context.scene
771         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
772
773     def draw_header(self, context):
774         scene = context.scene
775         props = scene.layer_properties['BLENDER_EEVEE']
776         self.layout.prop(props, "sss_enable", text="")
777
778     def draw(self, context):
779         layout = self.layout
780         scene = context.scene
781         props = scene.layer_properties['BLENDER_EEVEE']
782
783         col = layout.column()
784         col.prop(props, "sss_samples")
785         col.prop(props, "sss_jitter_threshold")
786         col.prop(props, "sss_separate_albedo")
787
788
789 class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
790     bl_label = "Screen Space Reflections"
791     bl_options = {'DEFAULT_CLOSED'}
792     COMPAT_ENGINES = {'BLENDER_EEVEE'}
793
794     @classmethod
795     def poll(cls, context):
796         scene = context.scene
797         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
798
799     def draw_header(self, context):
800         scene = context.scene
801         props = scene.layer_properties['BLENDER_EEVEE']
802         self.layout.prop(props, "ssr_enable", text="")
803
804     def draw(self, context):
805         layout = self.layout
806         scene = context.scene
807         props = scene.layer_properties['BLENDER_EEVEE']
808
809         col = layout.column()
810         col.active = props.ssr_enable
811         col.prop(props, "ssr_refraction")
812         col.prop(props, "ssr_halfres")
813         col.prop(props, "ssr_quality")
814         col.prop(props, "ssr_max_roughness")
815         col.prop(props, "ssr_thickness")
816         col.prop(props, "ssr_border_fade")
817         col.prop(props, "ssr_firefly_fac")
818
819
820 class RENDER_PT_eevee_shadows(RenderButtonsPanel, Panel):
821     bl_label = "Shadows"
822     bl_options = {'DEFAULT_CLOSED'}
823     COMPAT_ENGINES = {'BLENDER_EEVEE'}
824
825     @classmethod
826     def poll(cls, context):
827         scene = context.scene
828         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
829
830     def draw(self, context):
831         layout = self.layout
832         scene = context.scene
833         props = scene.layer_properties['BLENDER_EEVEE']
834
835         col = layout.column()
836         col.prop(props, "shadow_method")
837         col.prop(props, "shadow_size")
838         col.prop(props, "shadow_high_bitdepth")
839
840
841 class RENDER_PT_eevee_sampling(RenderButtonsPanel, Panel):
842     bl_label = "Sampling"
843     bl_options = {'DEFAULT_CLOSED'}
844     COMPAT_ENGINES = {'BLENDER_EEVEE'}
845
846     @classmethod
847     def poll(cls, context):
848         scene = context.scene
849         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
850
851     def draw(self, context):
852         layout = self.layout
853         scene = context.scene
854         props = scene.layer_properties['BLENDER_EEVEE']
855
856         col = layout.column()
857         col.prop(props, "taa_samples")
858         col.prop(props, "taa_render_samples")
859
860
861 class RENDER_PT_eevee_indirect_lighting(RenderButtonsPanel, Panel):
862     bl_label = "Indirect Lighting"
863     bl_options = {'DEFAULT_CLOSED'}
864     COMPAT_ENGINES = {'BLENDER_EEVEE'}
865
866     @classmethod
867     def poll(cls, context):
868         scene = context.scene
869         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
870
871     def draw(self, context):
872         layout = self.layout
873         scene = context.scene
874         props = scene.layer_properties['BLENDER_EEVEE']
875
876         col = layout.column()
877         col.prop(props, "gi_diffuse_bounces")
878         col.prop(props, "gi_cubemap_resolution")
879         col.prop(props, "gi_visibility_resolution")
880
881
882 class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
883     bl_label = "Film"
884     bl_options = {'DEFAULT_CLOSED'}
885     COMPAT_ENGINES = {'BLENDER_EEVEE'}
886
887     @classmethod
888     def poll(cls, context):
889         scene = context.scene
890         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
891
892     def draw(self, context):
893         layout = self.layout
894         scene = context.scene
895         rd = scene.render
896
897         split = layout.split()
898
899         col = split.column()
900         col.prop(rd, "filter_size")
901
902         col = split.column()
903         col.prop(rd, "alpha_mode", text="Alpha")
904
905
906 classes = (
907     RENDER_MT_presets,
908     RENDER_MT_ffmpeg_presets,
909     RENDER_MT_framerate_presets,
910     RENDER_PT_context,
911     RENDER_PT_render,
912     RENDER_PT_dimensions,
913     RENDER_PT_antialiasing,
914     RENDER_PT_motion_blur,
915     RENDER_PT_shading,
916     RENDER_PT_performance,
917     RENDER_PT_post_processing,
918     RENDER_PT_stamp,
919     RENDER_PT_output,
920     RENDER_PT_encoding,
921     RENDER_PT_bake,
922     RENDER_PT_clay_layer_settings,
923     RENDER_PT_clay_collection_settings,
924     RENDER_PT_eevee_sampling,
925     RENDER_PT_eevee_film,
926     RENDER_PT_eevee_shadows,
927     RENDER_PT_eevee_indirect_lighting,
928     RENDER_PT_eevee_subsurface_scattering,
929     RENDER_PT_eevee_screen_space_reflections,
930     RENDER_PT_eevee_ambient_occlusion,
931     RENDER_PT_eevee_volumetric,
932     RENDER_PT_eevee_motion_blur,
933     RENDER_PT_eevee_depth_of_field,
934     RENDER_PT_eevee_bloom,
935 )
936
937 if __name__ == "__main__":  # only for live edit.
938     from bpy.utils import register_class
939     for cls in classes:
940         register_class(cls)