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