Workbench: clean up the viewport shading code
[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         # Video:
464         layout.separator()
465         self.draw_vcodec(context)
466
467         # Audio:
468         layout.separator()
469         if ffmpeg.format != 'MP3':
470             layout.prop(ffmpeg, "audio_codec", text="Audio Codec")
471
472         if ffmpeg.audio_codec != 'NONE':
473             row = layout.row()
474             row.prop(ffmpeg, "audio_bitrate")
475             row.prop(ffmpeg, "audio_volume", slider=True)
476
477     def draw_vcodec(self, context):
478         """Video codec options."""
479         layout = self.layout
480         ffmpeg = context.scene.render.ffmpeg
481
482         needs_codec = ffmpeg.format in {'AVI', 'QUICKTIME', 'MKV', 'OGG', 'MPEG4'}
483         if needs_codec:
484             layout.prop(ffmpeg, "codec")
485
486         if needs_codec and ffmpeg.codec == 'NONE':
487             return
488
489         if ffmpeg.codec in {'DNXHD'}:
490             layout.prop(ffmpeg, "use_lossless_output")
491
492         # Output quality
493         use_crf = needs_codec and ffmpeg.codec in {'H264', 'MPEG4', 'WEBM'}
494         if use_crf:
495             layout.prop(ffmpeg, "constant_rate_factor")
496
497         # Encoding speed
498         layout.prop(ffmpeg, "ffmpeg_preset")
499         # I-frames
500         layout.prop(ffmpeg, "gopsize")
501         # B-Frames
502         row = layout.row()
503         row.prop(ffmpeg, "use_max_b_frames", text="Max B-frames")
504         pbox = row.split()
505         pbox.prop(ffmpeg, "max_b_frames", text="")
506         pbox.enabled = ffmpeg.use_max_b_frames
507
508         if not use_crf or ffmpeg.constant_rate_factor == 'NONE':
509             split = layout.split()
510             col = split.column()
511             col.label(text="Rate:")
512             col.prop(ffmpeg, "video_bitrate")
513             col.prop(ffmpeg, "minrate", text="Minimum")
514             col.prop(ffmpeg, "maxrate", text="Maximum")
515             col.prop(ffmpeg, "buffersize", text="Buffer")
516
517             col = split.column()
518             col.label(text="Mux:")
519             col.prop(ffmpeg, "muxrate", text="Rate")
520             col.prop(ffmpeg, "packetsize", text="Packet Size")
521
522
523 class RENDER_PT_bake(RenderButtonsPanel, Panel):
524     bl_label = "Bake"
525     bl_options = {'DEFAULT_CLOSED'}
526     COMPAT_ENGINES = {'BLENDER_RENDER'}
527
528     def draw(self, context):
529         layout = self.layout
530
531         rd = context.scene.render
532
533         layout.operator("object.bake_image", icon='RENDER_STILL')
534
535         layout.prop(rd, "bake_type")
536
537         multires_bake = False
538         if rd.bake_type in ['NORMALS', 'DISPLACEMENT', 'DERIVATIVE', 'AO']:
539             layout.prop(rd, "use_bake_multires")
540             multires_bake = rd.use_bake_multires
541
542         if not multires_bake:
543             if rd.bake_type == 'NORMALS':
544                 layout.prop(rd, "bake_normal_space")
545             elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
546                 layout.prop(rd, "use_bake_normalize")
547
548             # col.prop(rd, "bake_aa_mode")
549             # col.prop(rd, "use_bake_antialiasing")
550
551             layout.separator()
552
553             split = layout.split()
554
555             col = split.column()
556             col.prop(rd, "use_bake_to_vertex_color")
557             sub = col.column()
558             sub.active = not rd.use_bake_to_vertex_color
559             sub.prop(rd, "use_bake_clear")
560             sub.prop(rd, "bake_margin")
561             sub.prop(rd, "bake_quad_split", text="Split")
562
563             col = split.column()
564             col.prop(rd, "use_bake_selected_to_active")
565             sub = col.column()
566             sub.active = rd.use_bake_selected_to_active
567             sub.prop(rd, "bake_distance")
568             sub.prop(rd, "bake_bias")
569         else:
570             split = layout.split()
571
572             col = split.column()
573             col.prop(rd, "use_bake_clear")
574             col.prop(rd, "bake_margin")
575
576             if rd.bake_type == 'DISPLACEMENT':
577                 col = split.column()
578                 col.prop(rd, "use_bake_lores_mesh")
579
580             if rd.bake_type == 'AO':
581                 col = split.column()
582                 col.prop(rd, "bake_bias")
583                 col.prop(rd, "bake_samples")
584
585         if rd.bake_type == 'DERIVATIVE':
586             row = layout.row()
587             row.prop(rd, "use_bake_user_scale", text="")
588
589             sub = row.column()
590             sub.active = rd.use_bake_user_scale
591             sub.prop(rd, "bake_user_scale", text="User Scale")
592
593
594 class RENDER_PT_clay_layer_settings(RenderButtonsPanel, Panel):
595     bl_label = "Clay Layer Settings"
596     COMPAT_ENGINES = {'BLENDER_CLAY'}
597
598     def draw(self, context):
599         layout = self.layout
600         props = context.scene.layer_properties['BLENDER_CLAY']
601
602         col = layout.column()
603         col.prop(props, "ssao_samples")
604
605
606 class RENDER_PT_clay_collection_settings(RenderButtonsPanel, Panel):
607     bl_label = "Clay Collection Settings"
608     COMPAT_ENGINES = {'BLENDER_CLAY'}
609
610     def draw(self, context):
611         layout = self.layout
612         props = context.scene.collection_properties['BLENDER_CLAY']
613
614         col = layout.column()
615         col.template_icon_view(props, "matcap_icon")
616         col.prop(props, "matcap_rotation")
617         col.prop(props, "matcap_hue")
618         col.prop(props, "matcap_saturation")
619         col.prop(props, "matcap_value")
620         col.prop(props, "ssao_factor_cavity")
621         col.prop(props, "ssao_factor_edge")
622         col.prop(props, "ssao_distance")
623         col.prop(props, "ssao_attenuation")
624         col.prop(props, "hair_brightness_randomness")
625
626
627 class RENDER_PT_eevee_ambient_occlusion(RenderButtonsPanel, Panel):
628     bl_label = "Ambient Occlusion"
629     bl_options = {'DEFAULT_CLOSED'}
630     COMPAT_ENGINES = {'BLENDER_EEVEE'}
631
632     @classmethod
633     def poll(cls, context):
634         scene = context.scene
635         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
636
637     def draw_header(self, context):
638         scene = context.scene
639         props = scene.layer_properties['BLENDER_EEVEE']
640         self.layout.prop(props, "gtao_enable", text="")
641
642     def draw(self, context):
643         layout = self.layout
644         scene = context.scene
645         props = scene.layer_properties['BLENDER_EEVEE']
646
647         layout.active = props.gtao_enable
648         col = layout.column()
649         col.prop(props, "gtao_use_bent_normals")
650         col.prop(props, "gtao_bounce")
651         col.prop(props, "gtao_distance")
652         col.prop(props, "gtao_factor")
653         col.prop(props, "gtao_quality")
654
655
656 class RENDER_PT_eevee_motion_blur(RenderButtonsPanel, Panel):
657     bl_label = "Motion Blur"
658     bl_options = {'DEFAULT_CLOSED'}
659     COMPAT_ENGINES = {'BLENDER_EEVEE'}
660
661     @classmethod
662     def poll(cls, context):
663         scene = context.scene
664         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
665
666     def draw_header(self, context):
667         scene = context.scene
668         props = scene.layer_properties['BLENDER_EEVEE']
669         self.layout.prop(props, "motion_blur_enable", text="")
670
671     def draw(self, context):
672         layout = self.layout
673         scene = context.scene
674         props = scene.layer_properties['BLENDER_EEVEE']
675
676         layout.active = props.motion_blur_enable
677         col = layout.column()
678         col.prop(props, "motion_blur_samples")
679         col.prop(props, "motion_blur_shutter")
680
681
682 class RENDER_PT_eevee_depth_of_field(RenderButtonsPanel, Panel):
683     bl_label = "Depth of Field"
684     bl_options = {'DEFAULT_CLOSED'}
685     COMPAT_ENGINES = {'BLENDER_EEVEE'}
686
687     @classmethod
688     def poll(cls, context):
689         scene = context.scene
690         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
691
692     def draw_header(self, context):
693         scene = context.scene
694         props = scene.layer_properties['BLENDER_EEVEE']
695         self.layout.prop(props, "dof_enable", text="")
696
697     def draw(self, context):
698         layout = self.layout
699         scene = context.scene
700         props = scene.layer_properties['BLENDER_EEVEE']
701
702         layout.active = props.dof_enable
703         col = layout.column()
704         col.prop(props, "bokeh_max_size")
705         col.prop(props, "bokeh_threshold")
706
707
708 class RENDER_PT_eevee_bloom(RenderButtonsPanel, Panel):
709     bl_label = "Bloom"
710     bl_options = {'DEFAULT_CLOSED'}
711     COMPAT_ENGINES = {'BLENDER_EEVEE'}
712
713     @classmethod
714     def poll(cls, context):
715         scene = context.scene
716         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
717
718     def draw_header(self, context):
719         scene = context.scene
720         props = scene.layer_properties['BLENDER_EEVEE']
721         self.layout.prop(props, "bloom_enable", text="")
722
723     def draw(self, context):
724         layout = self.layout
725         scene = context.scene
726         props = scene.layer_properties['BLENDER_EEVEE']
727
728         layout.active = props.bloom_enable
729         col = layout.column()
730         col.prop(props, "bloom_threshold")
731         col.prop(props, "bloom_knee")
732         col.prop(props, "bloom_radius")
733         col.prop(props, "bloom_color")
734         col.prop(props, "bloom_intensity")
735         col.prop(props, "bloom_clamp")
736
737
738 class RENDER_PT_eevee_volumetric(RenderButtonsPanel, Panel):
739     bl_label = "Volumetric"
740     bl_options = {'DEFAULT_CLOSED'}
741     COMPAT_ENGINES = {'BLENDER_EEVEE'}
742
743     @classmethod
744     def poll(cls, context):
745         scene = context.scene
746         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
747
748     def draw_header(self, context):
749         scene = context.scene
750         props = scene.layer_properties['BLENDER_EEVEE']
751         self.layout.prop(props, "volumetric_enable", text="")
752
753     def draw(self, context):
754         layout = self.layout
755         scene = context.scene
756         props = scene.layer_properties['BLENDER_EEVEE']
757
758         layout.active = props.volumetric_enable
759         col = layout.column()
760         col.prop(props, "volumetric_start")
761         col.prop(props, "volumetric_end")
762         col.prop(props, "volumetric_tile_size")
763         col.prop(props, "volumetric_samples")
764         col.prop(props, "volumetric_sample_distribution")
765         col.prop(props, "volumetric_lights")
766         col.prop(props, "volumetric_light_clamp")
767         col.prop(props, "volumetric_shadows")
768         col.prop(props, "volumetric_shadow_samples")
769         col.prop(props, "volumetric_colored_transmittance")
770
771
772 class RENDER_PT_eevee_subsurface_scattering(RenderButtonsPanel, Panel):
773     bl_label = "Subsurface Scattering"
774     bl_options = {'DEFAULT_CLOSED'}
775     COMPAT_ENGINES = {'BLENDER_EEVEE'}
776
777     @classmethod
778     def poll(cls, context):
779         scene = context.scene
780         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
781
782     def draw_header(self, context):
783         scene = context.scene
784         props = scene.layer_properties['BLENDER_EEVEE']
785         self.layout.prop(props, "sss_enable", text="")
786
787     def draw(self, context):
788         layout = self.layout
789         scene = context.scene
790         props = scene.layer_properties['BLENDER_EEVEE']
791
792         col = layout.column()
793         col.prop(props, "sss_samples")
794         col.prop(props, "sss_jitter_threshold")
795         col.prop(props, "sss_separate_albedo")
796
797
798 class RENDER_PT_eevee_screen_space_reflections(RenderButtonsPanel, Panel):
799     bl_label = "Screen Space Reflections"
800     bl_options = {'DEFAULT_CLOSED'}
801     COMPAT_ENGINES = {'BLENDER_EEVEE'}
802
803     @classmethod
804     def poll(cls, context):
805         scene = context.scene
806         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
807
808     def draw_header(self, context):
809         scene = context.scene
810         props = scene.layer_properties['BLENDER_EEVEE']
811         self.layout.prop(props, "ssr_enable", text="")
812
813     def draw(self, context):
814         layout = self.layout
815         scene = context.scene
816         props = scene.layer_properties['BLENDER_EEVEE']
817
818         col = layout.column()
819         col.active = props.ssr_enable
820         col.prop(props, "ssr_refraction")
821         col.prop(props, "ssr_halfres")
822         col.prop(props, "ssr_quality")
823         col.prop(props, "ssr_max_roughness")
824         col.prop(props, "ssr_thickness")
825         col.prop(props, "ssr_border_fade")
826         col.prop(props, "ssr_firefly_fac")
827
828
829 class RENDER_PT_eevee_shadows(RenderButtonsPanel, Panel):
830     bl_label = "Shadows"
831     bl_options = {'DEFAULT_CLOSED'}
832     COMPAT_ENGINES = {'BLENDER_EEVEE'}
833
834     @classmethod
835     def poll(cls, context):
836         scene = context.scene
837         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
838
839     def draw(self, context):
840         layout = self.layout
841         scene = context.scene
842         props = scene.layer_properties['BLENDER_EEVEE']
843
844         col = layout.column()
845         col.prop(props, "shadow_method")
846         col.prop(props, "shadow_size")
847         col.prop(props, "shadow_high_bitdepth")
848
849
850 class RENDER_PT_eevee_sampling(RenderButtonsPanel, Panel):
851     bl_label = "Sampling"
852     bl_options = {'DEFAULT_CLOSED'}
853     COMPAT_ENGINES = {'BLENDER_EEVEE'}
854
855     @classmethod
856     def poll(cls, context):
857         scene = context.scene
858         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
859
860     def draw(self, context):
861         layout = self.layout
862         scene = context.scene
863         props = scene.layer_properties['BLENDER_EEVEE']
864
865         col = layout.column()
866         col.prop(props, "taa_samples")
867         col.prop(props, "taa_render_samples")
868
869
870 class RENDER_PT_eevee_indirect_lighting(RenderButtonsPanel, Panel):
871     bl_label = "Indirect Lighting"
872     bl_options = {'DEFAULT_CLOSED'}
873     COMPAT_ENGINES = {'BLENDER_EEVEE'}
874
875     @classmethod
876     def poll(cls, context):
877         scene = context.scene
878         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
879
880     def draw(self, context):
881         layout = self.layout
882         scene = context.scene
883         props = scene.layer_properties['BLENDER_EEVEE']
884
885         col = layout.column()
886         col.prop(props, "gi_diffuse_bounces")
887         col.prop(props, "gi_cubemap_resolution")
888         col.prop(props, "gi_visibility_resolution")
889
890
891 class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
892     bl_label = "Film"
893     bl_options = {'DEFAULT_CLOSED'}
894     COMPAT_ENGINES = {'BLENDER_EEVEE'}
895
896     @classmethod
897     def poll(cls, context):
898         scene = context.scene
899         return scene and (scene.view_render.engine in cls.COMPAT_ENGINES)
900
901     def draw(self, context):
902         layout = self.layout
903         scene = context.scene
904         rd = scene.render
905
906         split = layout.split()
907
908         col = split.column()
909         col.prop(rd, "filter_size")
910
911         col = split.column()
912         col.prop(rd, "alpha_mode", text="Alpha")
913
914
915 class RENDER_PT_workbench_collection_settings(RenderButtonsPanel, Panel):
916     bl_label = "Workbench Settings"
917     COMPAT_ENGINES = {'BLENDER_WORKBENCH', 'BLENDER_EEVEE', 'CYCLES'}
918
919     def draw(self, context):
920         layout = self.layout
921         props = context.scene.collection_properties['BLENDER_WORKBENCH']
922
923         col = layout.column()
924         col.prop(props, "object_color")
925
926
927 classes = (
928     RENDER_MT_presets,
929     RENDER_MT_ffmpeg_presets,
930     RENDER_MT_framerate_presets,
931     RENDER_PT_context,
932     RENDER_PT_render,
933     RENDER_PT_dimensions,
934     RENDER_PT_antialiasing,
935     RENDER_PT_motion_blur,
936     RENDER_PT_shading,
937     RENDER_PT_performance,
938     RENDER_PT_post_processing,
939     RENDER_PT_stamp,
940     RENDER_PT_output,
941     RENDER_PT_encoding,
942     RENDER_PT_bake,
943     RENDER_PT_clay_layer_settings,
944     RENDER_PT_clay_collection_settings,
945     RENDER_PT_eevee_sampling,
946     RENDER_PT_eevee_film,
947     RENDER_PT_eevee_shadows,
948     RENDER_PT_eevee_indirect_lighting,
949     RENDER_PT_eevee_subsurface_scattering,
950     RENDER_PT_eevee_screen_space_reflections,
951     RENDER_PT_eevee_ambient_occlusion,
952     RENDER_PT_eevee_volumetric,
953     RENDER_PT_eevee_motion_blur,
954     RENDER_PT_eevee_depth_of_field,
955     RENDER_PT_eevee_bloom,
956     RENDER_PT_workbench_collection_settings,
957 )
958
959 if __name__ == "__main__":  # only for live edit.
960     from bpy.utils import register_class
961     for cls in classes:
962         register_class(cls)