Merge branch 'master' into blender2.8
[blender.git] / intern / cycles / blender / addon / ui.py
1 #
2 # Copyright 2011-2013 Blender Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 # <pep8 compliant>
18
19 import bpy
20 from bpy_extras.node_utils import find_node_input
21 from bl_operators.presets import PresetMenu
22 import _cycles
23
24 from bpy.types import (
25     Panel,
26     Operator,
27 )
28
29
30 class CYCLES_PT_sampling_presets(PresetMenu):
31     bl_label = "Sampling Presets"
32     preset_subdir = "cycles/sampling"
33     preset_operator = "script.execute_preset"
34     preset_add_operator = "render.cycles_sampling_preset_add"
35     COMPAT_ENGINES = {'CYCLES'}
36
37
38 class CYCLES_PT_integrator_presets(PresetMenu):
39     bl_label = "Integrator Presets"
40     preset_subdir = "cycles/integrator"
41     preset_operator = "script.execute_preset"
42     preset_add_operator = "render.cycles_integrator_preset_add"
43     COMPAT_ENGINES = {'CYCLES'}
44
45
46 class CyclesButtonsPanel:
47     bl_space_type = "PROPERTIES"
48     bl_region_type = "WINDOW"
49     bl_context = "render"
50     COMPAT_ENGINES = {'CYCLES'}
51
52     @classmethod
53     def poll(cls, context):
54         return context.engine in cls.COMPAT_ENGINES
55
56
57 def get_device_type(context):
58     return context.user_preferences.addons[__package__].preferences.compute_device_type
59
60
61 def use_cpu(context):
62     cscene = context.scene.cycles
63
64     return (get_device_type(context) == 'NONE' or cscene.device == 'CPU')
65
66
67 def use_opencl(context):
68     cscene = context.scene.cycles
69
70     return (get_device_type(context) == 'OPENCL' and cscene.device == 'GPU')
71
72
73 def use_cuda(context):
74     cscene = context.scene.cycles
75
76     return (get_device_type(context) == 'CUDA' and cscene.device == 'GPU')
77
78
79 def use_branched_path(context):
80     cscene = context.scene.cycles
81
82     return (cscene.progressive == 'BRANCHED_PATH')
83
84
85 def use_sample_all_lights(context):
86     cscene = context.scene.cycles
87
88     return cscene.sample_all_lights_direct or cscene.sample_all_lights_indirect
89
90
91 def show_device_active(context):
92     cscene = context.scene.cycles
93     if cscene.device != 'GPU':
94         return True
95     return context.user_preferences.addons[__package__].preferences.has_active_device()
96
97
98 def draw_samples_info(layout, context):
99     cscene = context.scene.cycles
100     integrator = cscene.progressive
101
102     # Calculate sample values
103     if integrator == 'PATH':
104         aa = cscene.samples
105         if cscene.use_square_samples:
106             aa = aa * aa
107     else:
108         aa = cscene.aa_samples
109         d = cscene.diffuse_samples
110         g = cscene.glossy_samples
111         t = cscene.transmission_samples
112         ao = cscene.ao_samples
113         ml = cscene.mesh_light_samples
114         sss = cscene.subsurface_samples
115         vol = cscene.volume_samples
116
117         if cscene.use_square_samples:
118             aa = aa * aa
119             d = d * d
120             g = g * g
121             t = t * t
122             ao = ao * ao
123             ml = ml * ml
124             sss = sss * sss
125             vol = vol * vol
126
127     # Draw interface
128     # Do not draw for progressive, when Square Samples are disabled
129     if use_branched_path(context) or (cscene.use_square_samples and integrator == 'PATH'):
130         col = layout.column(align=True)
131         col.scale_y = 0.6
132         col.label(text="Total Samples:")
133         col.separator()
134         if integrator == 'PATH':
135             col.label(text="%s AA" % aa)
136         else:
137             col.label(text="%s AA, %s Diffuse, %s Glossy, %s Transmission" %
138                       (aa, d * aa, g * aa, t * aa))
139             col.separator()
140             col.label(text="%s AO, %s Mesh Light, %s Subsurface, %s Volume" %
141                       (ao * aa, ml * aa, sss * aa, vol * aa))
142
143
144 class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
145     bl_label = "Sampling"
146
147     def draw_header_preset(self, context):
148         CYCLES_PT_sampling_presets.draw_panel_header(self.layout)
149
150     def draw(self, context):
151         layout = self.layout
152
153         scene = context.scene
154         cscene = scene.cycles
155
156         layout.use_property_split = True
157         layout.use_property_decorate = False
158
159         layout.prop(cscene, "progressive")
160
161         if cscene.progressive == 'PATH' or use_branched_path(context) is False:
162             col = layout.column(align=True)
163             col.prop(cscene, "samples", text="Render")
164             col.prop(cscene, "preview_samples", text="Viewport")
165
166             draw_samples_info(layout, context)
167         else:
168             col = layout.column(align=True)
169             col.prop(cscene, "aa_samples", text="Render")
170             col.prop(cscene, "preview_aa_samples", text="Viewport")
171
172
173 class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel):
174     bl_label = "Sub Samples"
175     bl_parent_id = "CYCLES_RENDER_PT_sampling"
176
177     @classmethod
178     def poll(self, context):
179         scene = context.scene
180         cscene = scene.cycles
181         return cscene.progressive != 'PATH' and use_branched_path(context)
182
183     def draw(self, context):
184         layout = self.layout
185         layout.use_property_split = True
186         layout.use_property_decorate = False
187
188         scene = context.scene
189         cscene = scene.cycles
190
191         col = layout.column(align=True)
192         col.prop(cscene, "diffuse_samples", text="Diffuse")
193         col.prop(cscene, "glossy_samples", text="Glossy")
194         col.prop(cscene, "transmission_samples", text="Transmission")
195         col.prop(cscene, "ao_samples", text="AO")
196
197         sub = col.row(align=True)
198         sub.active = use_sample_all_lights(context)
199         sub.prop(cscene, "mesh_light_samples", text="Mesh Light")
200         col.prop(cscene, "subsurface_samples", text="Subsurface")
201         col.prop(cscene, "volume_samples", text="Volume")
202
203         draw_samples_info(layout, context)
204
205
206 class CYCLES_RENDER_PT_sampling_advanced(CyclesButtonsPanel, Panel):
207     bl_label = "Advanced"
208     bl_parent_id = "CYCLES_RENDER_PT_sampling"
209     bl_options = {'DEFAULT_CLOSED'}
210
211     def draw(self, context):
212         layout = self.layout
213         layout.use_property_split = True
214         layout.use_property_decorate = False
215
216         scene = context.scene
217         cscene = scene.cycles
218
219         row = layout.row(align=True)
220         row.prop(cscene, "seed")
221         row.prop(cscene, "use_animated_seed", text="", icon='TIME')
222
223         layout.prop(cscene, "sampling_pattern", text="Pattern")
224
225         layout.prop(cscene, "use_square_samples")
226
227         layout.separator()
228
229         col = layout.column(align=True)
230         col.prop(cscene, "light_sampling_threshold", text="Light Threshold")
231
232         if cscene.progressive != 'PATH' and use_branched_path(context):
233             col = layout.column(align=True)
234             col.prop(cscene, "sample_all_lights_direct")
235             col.prop(cscene, "sample_all_lights_indirect")
236
237
238 class CYCLES_RENDER_PT_sampling_total(CyclesButtonsPanel, Panel):
239     bl_label = "Total Samples"
240     bl_parent_id = "CYCLES_RENDER_PT_sampling"
241
242     @classmethod
243     def poll(self, context):
244         scene = context.scene
245         cscene = scene.cycles
246
247         if cscene.use_square_samples:
248             return True
249
250         return cscene.progressive != 'PATH' and use_branched_path(context)
251
252     def draw(self, context):
253         layout = self.layout
254         cscene = context.scene.cycles
255         integrator = cscene.progressive
256
257         # Calculate sample values
258         if integrator == 'PATH':
259             aa = cscene.samples
260             if cscene.use_square_samples:
261                 aa = aa * aa
262         else:
263             aa = cscene.aa_samples
264             d = cscene.diffuse_samples
265             g = cscene.glossy_samples
266             t = cscene.transmission_samples
267             ao = cscene.ao_samples
268             ml = cscene.mesh_light_samples
269             sss = cscene.subsurface_samples
270             vol = cscene.volume_samples
271
272             if cscene.use_square_samples:
273                 aa = aa * aa
274                 d = d * d
275                 g = g * g
276                 t = t * t
277                 ao = ao * ao
278                 ml = ml * ml
279                 sss = sss * sss
280                 vol = vol * vol
281
282         col = layout.column(align=True)
283         col.scale_y = 0.6
284         if integrator == 'PATH':
285             col.label(text="%s AA" % aa)
286         else:
287             col.label(text="%s AA, %s Diffuse, %s Glossy, %s Transmission" %
288                       (aa, d * aa, g * aa, t * aa))
289             col.separator()
290             col.label(text="%s AO, %s Mesh Light, %s Subsurface, %s Volume" %
291                       (ao * aa, ml * aa, sss * aa, vol * aa))
292
293
294 class CYCLES_RENDER_PT_subdivision(CyclesButtonsPanel, Panel):
295     bl_label = "Subdivision"
296     bl_options = {'DEFAULT_CLOSED'}
297
298     @classmethod
299     def poll(self, context):
300         return context.scene.cycles.feature_set == 'EXPERIMENTAL'
301
302     def draw(self, context):
303         layout = self.layout
304         layout.use_property_split = True
305         layout.use_property_decorate = False
306
307         scene = context.scene
308         cscene = scene.cycles
309
310         col = layout.column()
311         sub = col.column(align=True)
312         sub.prop(cscene, "dicing_rate", text="Dicing Rate Render")
313         sub.prop(cscene, "preview_dicing_rate", text="Preview")
314
315         col.separator()
316
317         col.prop(cscene, "offscreen_dicing_scale", text="Offscreen Scale")
318         col.prop(cscene, "max_subdivisions")
319
320         col.prop(cscene, "dicing_camera")
321
322
323 class CYCLES_RENDER_PT_hair(CyclesButtonsPanel, Panel):
324     bl_label = "Hair"
325     bl_options = {'DEFAULT_CLOSED'}
326
327     def draw_header(self, context):
328         layout = self.layout
329         scene = context.scene
330         ccscene = scene.cycles_curves
331
332         layout.prop(ccscene, "use_curves", text="")
333
334     def draw(self, context):
335         layout = self.layout
336         layout.use_property_split = True
337         layout.use_property_decorate = False
338
339         scene = context.scene
340         ccscene = scene.cycles_curves
341
342         layout.active = ccscene.use_curves
343
344         col = layout.column()
345         col.prop(ccscene, "minimum_width", text="Min Pixels")
346         col.prop(ccscene, "maximum_width", text="Max Extension")
347         col.prop(ccscene, "shape", text="Shape")
348         if not (ccscene.primitive in {'CURVE_SEGMENTS', 'LINE_SEGMENTS'} and ccscene.shape == 'RIBBONS'):
349             col.prop(ccscene, "cull_backfacing", text="Cull back-faces")
350         col.prop(ccscene, "primitive", text="Primitive")
351
352         if ccscene.primitive == 'TRIANGLES' and ccscene.shape == 'THICK':
353             col.prop(ccscene, "resolution", text="Resolution")
354         elif ccscene.primitive == 'CURVE_SEGMENTS':
355             col.prop(ccscene, "subdivisions", text="Curve subdivisions")
356
357
358 class CYCLES_RENDER_PT_volumes(CyclesButtonsPanel, Panel):
359     bl_label = "Volumes"
360     bl_options = {'DEFAULT_CLOSED'}
361
362     def draw(self, context):
363         layout = self.layout
364         layout.use_property_split = True
365         layout.use_property_decorate = False
366
367         scene = context.scene
368         cscene = scene.cycles
369
370         col = layout.column()
371         col.prop(cscene, "volume_step_size", text="Step Size")
372         col.prop(cscene, "volume_max_steps", text="Max Steps")
373
374
375 class CYCLES_RENDER_PT_light_paths(CyclesButtonsPanel, Panel):
376     bl_label = "Light Paths"
377     bl_options = {'DEFAULT_CLOSED'}
378
379     def draw_header_preset(self, context):
380         CYCLES_PT_integrator_presets.draw_panel_header(self.layout)
381
382     def draw(self, context):
383         pass
384
385
386 class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
387     bl_label = "Max Bounces"
388     bl_parent_id = "CYCLES_RENDER_PT_light_paths"
389
390     def draw(self, context):
391         layout = self.layout
392         layout.use_property_split = True
393         layout.use_property_decorate = False
394
395         scene = context.scene
396         cscene = scene.cycles
397
398         col = layout.column(align=True)
399         col.prop(cscene, "max_bounces", text="Total")
400
401         col = layout.column(align=True)
402         col.prop(cscene, "diffuse_bounces", text="Diffuse")
403         col.prop(cscene, "glossy_bounces", text="Glossy")
404         col.prop(cscene, "transparent_max_bounces", text="Transparency")
405         col.prop(cscene, "transmission_bounces", text="Transmission")
406         col.prop(cscene, "volume_bounces", text="Volume")
407
408
409 class CYCLES_RENDER_PT_light_paths_clamping(CyclesButtonsPanel, Panel):
410     bl_label = "Clamping"
411     bl_parent_id = "CYCLES_RENDER_PT_light_paths"
412
413     def draw(self, context):
414         layout = self.layout
415         layout.use_property_split = True
416         layout.use_property_decorate = False
417
418         scene = context.scene
419         cscene = scene.cycles
420
421         col = layout.column(align=True)
422         col.prop(cscene, "sample_clamp_direct", text="Direct Light")
423         col.prop(cscene, "sample_clamp_indirect", text="Indirect Light")
424
425
426 class CYCLES_RENDER_PT_light_paths_caustics(CyclesButtonsPanel, Panel):
427     bl_label = "Caustics"
428     bl_parent_id = "CYCLES_RENDER_PT_light_paths"
429
430     def draw(self, context):
431         layout = self.layout
432         layout.use_property_split = True
433         layout.use_property_decorate = False
434
435         scene = context.scene
436         cscene = scene.cycles
437
438         col = layout.column()
439         col.prop(cscene, "blur_glossy")
440         col.prop(cscene, "caustics_reflective")
441         col.prop(cscene, "caustics_refractive")
442
443
444 class CYCLES_RENDER_PT_motion_blur(CyclesButtonsPanel, Panel):
445     bl_label = "Motion Blur"
446     bl_options = {'DEFAULT_CLOSED'}
447
448     def draw_header(self, context):
449         rd = context.scene.render
450
451         self.layout.prop(rd, "use_motion_blur", text="")
452
453     def draw(self, context):
454         layout = self.layout
455         layout.use_property_split = True
456         layout.use_property_decorate = False
457
458         scene = context.scene
459         cscene = scene.cycles
460         rd = scene.render
461         layout.active = rd.use_motion_blur
462
463         col = layout.column()
464         col.prop(cscene, "motion_blur_position", text="Position")
465         col.prop(rd, "motion_blur_shutter")
466         col.separator()
467         col.prop(cscene, "rolling_shutter_type", text="Rolling Shutter")
468         sub = col.column()
469         sub.active = cscene.rolling_shutter_type != 'NONE'
470         sub.prop(cscene, "rolling_shutter_duration")
471
472
473 class CYCLES_RENDER_PT_motion_blur_curve(CyclesButtonsPanel, Panel):
474     bl_label = "Shutter Curve"
475     bl_parent_id = "CYCLES_RENDER_PT_motion_blur"
476     bl_options = {'DEFAULT_CLOSED'}
477
478     def draw(self, context):
479         layout = self.layout
480         layout.use_property_split = True
481         layout.use_property_decorate = False
482
483         scene = context.scene
484         rd = scene.render
485         layout.active = rd.use_motion_blur
486
487         col = layout.column()
488
489         col.template_curve_mapping(rd, "motion_blur_shutter_curve")
490
491         col = layout.column(align=True)
492         row = col.row(align=True)
493         row.operator("render.shutter_curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
494         row.operator("render.shutter_curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
495         row.operator("render.shutter_curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
496         row.operator("render.shutter_curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
497         row.operator("render.shutter_curve_preset", icon='LINCURVE', text="").shape = 'LINE'
498         row.operator("render.shutter_curve_preset", icon='NOCURVE', text="").shape = 'MAX'
499
500
501 class CYCLES_RENDER_PT_film(CyclesButtonsPanel, Panel):
502     bl_label = "Film"
503     bl_options = {'DEFAULT_CLOSED'}
504
505     def draw(self, context):
506         layout = self.layout
507         layout.use_property_split = True
508         layout.use_property_decorate = False
509         scene = context.scene
510         cscene = scene.cycles
511
512         col = layout.column()
513         col.prop(cscene, "film_exposure")
514
515
516 class CYCLES_RENDER_PT_film_transparency(CyclesButtonsPanel, Panel):
517     bl_label = "Transparency"
518     bl_parent_id = "CYCLES_RENDER_PT_film"
519
520     def draw_header(self, context):
521         layout = self.layout
522
523         scene = context.scene
524         cscene = scene.cycles
525
526         layout.prop(cscene, "film_transparent", text="")
527
528     def draw(self, context):
529         layout = self.layout
530         layout.use_property_split = True
531         layout.use_property_decorate = False
532         scene = context.scene
533         cscene = scene.cycles
534
535         layout.active = cscene.film_transparent
536
537         col = layout.column()
538         col.prop(cscene, "film_transparent_glass", text="Transparent Glass")
539
540         sub = col.column()
541         sub.active = cscene.film_transparent and cscene.film_transparent_glass
542         sub.prop(cscene, "film_transparent_roughness", text="Roughness Threshold")
543
544
545 class CYCLES_RENDER_PT_film_pixel_filter(CyclesButtonsPanel, Panel):
546     bl_label = "Pixel Filter"
547     bl_parent_id = "CYCLES_RENDER_PT_film"
548
549     def draw(self, context):
550         layout = self.layout
551         layout.use_property_split = True
552         layout.use_property_decorate = False
553         scene = context.scene
554         cscene = scene.cycles
555
556         col = layout.column()
557         col.prop(cscene, "pixel_filter_type", text="Type")
558         if cscene.pixel_filter_type != 'BOX':
559             col.prop(cscene, "filter_width", text="Width")
560
561
562 class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
563     bl_label = "Performance"
564     bl_options = {'DEFAULT_CLOSED'}
565
566     def draw(self, context):
567         pass
568
569
570 class CYCLES_RENDER_PT_performance_threads(CyclesButtonsPanel, Panel):
571     bl_label = "Threads"
572     bl_parent_id = "CYCLES_RENDER_PT_performance"
573
574     def draw(self, context):
575         layout = self.layout
576         layout.use_property_split = True
577         layout.use_property_decorate = False
578
579         scene = context.scene
580         rd = scene.render
581
582         col = layout.column()
583
584         col.prop(rd, "threads_mode")
585         sub = col.column(align=True)
586         sub.enabled = rd.threads_mode == 'FIXED'
587         sub.prop(rd, "threads")
588
589
590 class CYCLES_RENDER_PT_performance_tiles(CyclesButtonsPanel, Panel):
591     bl_label = "Tiles"
592     bl_parent_id = "CYCLES_RENDER_PT_performance"
593
594     def draw(self, context):
595         layout = self.layout
596         layout.use_property_split = True
597         layout.use_property_decorate = False
598
599         scene = context.scene
600         rd = scene.render
601         cscene = scene.cycles
602
603         col = layout.column()
604
605         sub = col.column(align=True)
606         sub.prop(rd, "tile_x", text="Tiles X")
607         sub.prop(rd, "tile_y", text="Y")
608         col.prop(cscene, "tile_order", text="Order")
609
610         sub = col.column()
611         sub.active = not rd.use_save_buffers
612         for view_layer in scene.view_layers:
613             if view_layer.cycles.use_denoising:
614                 sub.active = False
615         sub.prop(cscene, "use_progressive_refine")
616
617
618 class CYCLES_RENDER_PT_performance_acceleration_structure(CyclesButtonsPanel, Panel):
619     bl_label = "Acceleration Structure"
620     bl_parent_id = "CYCLES_RENDER_PT_performance"
621
622     def draw(self, context):
623         layout = self.layout
624         layout.use_property_split = True
625         layout.use_property_decorate = False
626
627         scene = context.scene
628         cscene = scene.cycles
629
630         col = layout.column()
631
632         if _cycles.with_embree:
633             row = col.row()
634             row.active = use_cpu(context)
635             row.prop(cscene, "use_bvh_embree")
636         col.prop(cscene, "debug_use_spatial_splits")
637         sub = col.column()
638         sub.active = not cscene.use_bvh_embree or not _cycles.with_embree
639         sub.prop(cscene, "debug_use_hair_bvh")
640         sub = col.column()
641         sub.active = not cscene.debug_use_spatial_splits and not cscene.use_bvh_embree
642         sub.prop(cscene, "debug_bvh_time_steps")
643
644
645 class CYCLES_RENDER_PT_performance_final_render(CyclesButtonsPanel, Panel):
646     bl_label = "Final Render"
647     bl_parent_id = "CYCLES_RENDER_PT_performance"
648
649     def draw(self, context):
650         layout = self.layout
651         layout.use_property_split = True
652         layout.use_property_decorate = False
653
654         scene = context.scene
655         rd = scene.render
656
657         col = layout.column()
658
659         col.prop(rd, "use_save_buffers")
660         col.prop(rd, "use_persistent_data", text="Persistent Images")
661
662
663 class CYCLES_RENDER_PT_performance_viewport(CyclesButtonsPanel, Panel):
664     bl_label = "Viewport"
665     bl_parent_id = "CYCLES_RENDER_PT_performance"
666
667     def draw(self, context):
668         layout = self.layout
669         layout.use_property_split = True
670         layout.use_property_decorate = False
671
672         scene = context.scene
673         rd = scene.render
674         cscene = scene.cycles
675
676         col = layout.column()
677         col.prop(rd, "preview_pixel_size", text="Pixel Size")
678         col.prop(cscene, "preview_start_resolution", text="Start Pixels")
679
680
681 class CYCLES_RENDER_PT_filter(CyclesButtonsPanel, Panel):
682     bl_label = "Filter"
683     bl_options = {'DEFAULT_CLOSED'}
684     bl_context = "view_layer"
685
686     def draw(self, context):
687         layout = self.layout
688         layout.use_property_split = True
689         layout.use_property_decorate = False
690
691         with_freestyle = bpy.app.build_options.freestyle
692
693         scene = context.scene
694         rd = scene.render
695         view_layer = context.view_layer
696
697         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
698
699         col = flow.column()
700         col.prop(view_layer, "use_sky", text="Environment")
701         col = flow.column()
702         col.prop(view_layer, "use_ao", text="Ambient Occlusion")
703         col = flow.column()
704         col.prop(view_layer, "use_solid", text="Surfaces")
705         col = flow.column()
706         col.prop(view_layer, "use_strand", text="Hair")
707         if with_freestyle:
708             col = flow.column()
709             col.prop(view_layer, "use_freestyle", text="Freestyle")
710             col.active = rd.use_freestyle
711
712
713 class CYCLES_RENDER_PT_passes(CyclesButtonsPanel, Panel):
714     bl_label = "Passes"
715     bl_context = "view_layer"
716     bl_options = {'DEFAULT_CLOSED'}
717
718     def draw(self, context):
719         pass
720
721
722 class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
723     bl_label = "Data"
724     bl_context = "view_layer"
725     bl_parent_id = "CYCLES_RENDER_PT_passes"
726
727     def draw(self, context):
728         layout = self.layout
729         layout.use_property_split = True
730         layout.use_property_decorate = False
731
732         scene = context.scene
733         rd = scene.render
734         view_layer = context.view_layer
735         cycles_view_layer = view_layer.cycles
736
737         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
738         col = flow.column()
739         col.prop(view_layer, "use_pass_combined")
740         col = flow.column()
741         col.prop(view_layer, "use_pass_z")
742         col = flow.column()
743         col.prop(view_layer, "use_pass_mist")
744         col = flow.column()
745         col.prop(view_layer, "use_pass_normal")
746         col = flow.column()
747         col.prop(view_layer, "use_pass_vector")
748         col.active = not rd.use_motion_blur
749         col = flow.column()
750         col.prop(view_layer, "use_pass_uv")
751         col = flow.column()
752         col.prop(view_layer, "use_pass_object_index")
753         col = flow.column()
754         col.prop(view_layer, "use_pass_material_index")
755
756         layout.separator()
757
758         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
759         col = flow.column()
760         col.prop(cycles_view_layer, "denoising_store_passes", text="Denoising Data")
761         col = flow.column()
762         col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
763
764         layout.separator()
765
766         layout.prop(view_layer, "pass_alpha_threshold")
767
768
769 class CYCLES_RENDER_PT_passes_light(CyclesButtonsPanel, Panel):
770     bl_label = "Light"
771     bl_context = "view_layer"
772     bl_parent_id = "CYCLES_RENDER_PT_passes"
773
774     def draw(self, context):
775         layout = self.layout
776         layout.use_property_split = True
777         layout.use_property_decorate = False
778
779         view_layer = context.view_layer
780         cycles_view_layer = view_layer.cycles
781
782         split = layout.split(factor=0.35)
783         split.use_property_split = False
784         split.label(text="Diffuse")
785         row = split.row(align=True)
786         row.prop(view_layer, "use_pass_diffuse_direct", text="Direct", toggle=True)
787         row.prop(view_layer, "use_pass_diffuse_indirect", text="Indirect", toggle=True)
788         row.prop(view_layer, "use_pass_diffuse_color", text="Color", toggle=True)
789
790         split = layout.split(factor=0.35)
791         split.use_property_split = False
792         split.label(text="Glossy")
793         row = split.row(align=True)
794         row.prop(view_layer, "use_pass_glossy_direct", text="Direct", toggle=True)
795         row.prop(view_layer, "use_pass_glossy_indirect", text="Indirect", toggle=True)
796         row.prop(view_layer, "use_pass_glossy_color", text="Color", toggle=True)
797
798         split = layout.split(factor=0.35)
799         split.use_property_split = False
800         split.label(text="Transmission")
801         row = split.row(align=True)
802         row.prop(view_layer, "use_pass_transmission_direct", text="Direct", toggle=True)
803         row.prop(view_layer, "use_pass_transmission_indirect", text="Indirect", toggle=True)
804         row.prop(view_layer, "use_pass_transmission_color", text="Color", toggle=True)
805
806         split = layout.split(factor=0.35)
807         split.use_property_split = False
808         split.label(text="Subsurface")
809         row = split.row(align=True)
810         row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
811         row.prop(view_layer, "use_pass_subsurface_indirect", text="Indirect", toggle=True)
812         row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
813
814         split = layout.split(factor=0.35)
815         split.use_property_split = False
816         split.label(text="Volume")
817         row = split.row(align=True)
818         row.prop(cycles_view_layer, "use_pass_volume_direct", text="Direct", toggle=True)
819         row.prop(cycles_view_layer, "use_pass_volume_indirect", text="Indirect", toggle=True)
820
821         col = layout.column(align=True)
822         col.prop(view_layer, "use_pass_emit", text="Emission")
823         col.prop(view_layer, "use_pass_environment")
824         col.prop(view_layer, "use_pass_shadow")
825         col.prop(view_layer, "use_pass_ambient_occlusion", text="Ambient Occlusion")
826
827
828 class CYCLES_RENDER_PT_passes_crypto(CyclesButtonsPanel, Panel):
829     bl_label = "Cryptomatte"
830     bl_context = "view_layer"
831     bl_parent_id = "CYCLES_RENDER_PT_passes"
832
833     def draw(self, context):
834         import _cycles
835
836         layout = self.layout
837         layout.use_property_split = True
838         layout.use_property_decorate = False
839
840         cycles_view_layer = context.view_layer.cycles
841
842         row = layout.row(align=True)
843         row.use_property_split = False
844         row.prop(cycles_view_layer, "use_pass_crypto_object", text="Object", toggle=True)
845         row.prop(cycles_view_layer, "use_pass_crypto_material", text="Material", toggle=True)
846         row.prop(cycles_view_layer, "use_pass_crypto_asset", text="Asset", toggle=True)
847
848         layout.prop(cycles_view_layer, "pass_crypto_depth", text="Levels")
849
850         row = layout.row(align=True)
851         row.active = use_cpu(context)
852         row.prop(cycles_view_layer, "pass_crypto_accurate", text="Accurate Mode")
853
854
855 class CYCLES_RENDER_PT_passes_debug(CyclesButtonsPanel, Panel):
856     bl_label = "Debug"
857     bl_context = "view_layer"
858     bl_parent_id = "CYCLES_RENDER_PT_passes"
859
860     @classmethod
861     def poll(cls, context):
862         import _cycles
863         return _cycles.with_cycles_debug
864
865     def draw(self, context):
866         layout = self.layout
867         layout.use_property_split = True
868         layout.use_property_decorate = False
869
870         cycles_view_layer = context.view_layer.cycles
871
872         layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_nodes")
873         layout.prop(cycles_view_layer, "pass_debug_bvh_traversed_instances")
874         layout.prop(cycles_view_layer, "pass_debug_bvh_intersections")
875         layout.prop(cycles_view_layer, "pass_debug_ray_bounces")
876
877
878 class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
879     bl_label = "Denoising"
880     bl_context = "view_layer"
881     bl_options = {'DEFAULT_CLOSED'}
882
883     def draw_header(self, context):
884         scene = context.scene
885         view_layer = context.view_layer
886         cycles_view_layer = view_layer.cycles
887         layout = self.layout
888
889         layout.prop(cycles_view_layer, "use_denoising", text="")
890
891     def draw(self, context):
892         layout = self.layout
893         layout.use_property_split = True
894         layout.use_property_decorate = False
895
896         scene = context.scene
897         view_layer = context.view_layer
898         cycles_view_layer = view_layer.cycles
899
900         split = layout.split()
901         split.active = cycles_view_layer.use_denoising
902
903         layout = layout.column(align=True)
904         layout.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
905         layout.prop(cycles_view_layer, "denoising_relative_pca")
906
907         layout.separator()
908
909         split = layout.split(factor=0.5)
910         split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
911
912         col = split.column()
913         col.alignment = 'RIGHT'
914         col.label(text="Diffuse")
915
916         row = split.row(align=True)
917         row.use_property_split = False
918         row.prop(cycles_view_layer, "denoising_diffuse_direct", text="Direct", toggle=True)
919         row.prop(cycles_view_layer, "denoising_diffuse_indirect", text="Indirect", toggle=True)
920
921         split = layout.split(factor=0.5)
922         split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
923
924         col = split.column()
925         col.alignment = 'RIGHT'
926         col.label(text="Glossy")
927
928         row = split.row(align=True)
929         row.use_property_split = False
930         row.prop(cycles_view_layer, "denoising_glossy_direct", text="Direct", toggle=True)
931         row.prop(cycles_view_layer, "denoising_glossy_indirect", text="Indirect", toggle=True)
932
933         split = layout.split(factor=0.5)
934         split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
935
936         col = split.column()
937         col.alignment = 'RIGHT'
938         col.label(text="Transmission")
939
940         row = split.row(align=True)
941         row.use_property_split = False
942         row.prop(cycles_view_layer, "denoising_transmission_direct", text="Direct", toggle=True)
943         row.prop(cycles_view_layer, "denoising_transmission_indirect", text="Indirect", toggle=True)
944
945         split = layout.split(factor=0.5)
946         split.active = cycles_view_layer.use_denoising or cycles_view_layer.denoising_store_passes
947
948         col = split.column()
949         col.alignment = 'RIGHT'
950         col.label(text="Subsurface")
951
952         row = split.row(align=True)
953         row.use_property_split = False
954         row.prop(cycles_view_layer, "denoising_subsurface_direct", text="Direct", toggle=True)
955         row.prop(cycles_view_layer, "denoising_subsurface_indirect", text="Indirect", toggle=True)
956
957
958 class CYCLES_PT_post_processing(CyclesButtonsPanel, Panel):
959     bl_label = "Post Processing"
960     bl_options = {'DEFAULT_CLOSED'}
961     bl_context = "output"
962
963     def draw(self, context):
964         layout = self.layout
965         layout.use_property_split = True
966         layout.use_property_decorate = False
967
968         rd = context.scene.render
969
970         col = layout.column(align=True)
971         col.prop(rd, "use_compositing")
972         col.prop(rd, "use_sequencer")
973
974         layout.prop(rd, "dither_intensity", text="Dither", slider=True)
975
976
977 class CYCLES_CAMERA_PT_dof(CyclesButtonsPanel, Panel):
978     bl_label = "Depth of Field"
979     bl_context = "data"
980
981     @classmethod
982     def poll(cls, context):
983         return context.camera and CyclesButtonsPanel.poll(context)
984
985     def draw(self, context):
986         layout = self.layout
987         layout.use_property_split = True
988
989         cam = context.camera
990
991         split = layout.split()
992
993         col = split.column()
994         col.prop(cam, "dof_object", text="Focus Object")
995
996         sub = col.row()
997         sub.active = cam.dof_object is None
998         sub.prop(cam, "dof_distance", text="Distance")
999
1000
1001 class CYCLES_CAMERA_PT_dof_aperture(CyclesButtonsPanel, Panel):
1002     bl_label = "Aperture"
1003     bl_parent_id = "CYCLES_CAMERA_PT_dof"
1004
1005     @classmethod
1006     def poll(cls, context):
1007         return context.camera and CyclesButtonsPanel.poll(context)
1008
1009     def draw(self, context):
1010         layout = self.layout
1011         layout.use_property_split = True
1012         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
1013
1014         cam = context.camera
1015         ccam = cam.cycles
1016
1017         col = flow.column()
1018         col.prop(ccam, "aperture_type")
1019         if ccam.aperture_type == 'RADIUS':
1020             col.prop(ccam, "aperture_size", text="Size")
1021         elif ccam.aperture_type == 'FSTOP':
1022             col.prop(ccam, "aperture_fstop", text="Number")
1023         col.separator()
1024
1025         col = flow.column()
1026         col.prop(ccam, "aperture_blades", text="Blades")
1027         col.prop(ccam, "aperture_rotation", text="Rotation")
1028         col.prop(ccam, "aperture_ratio", text="Ratio")
1029
1030
1031 class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel):
1032     bl_label = "Viewport"
1033     bl_parent_id = "CYCLES_CAMERA_PT_dof"
1034
1035     @classmethod
1036     def poll(cls, context):
1037         return context.camera and CyclesButtonsPanel.poll(context)
1038
1039     def draw(self, context):
1040         layout = self.layout
1041         layout.use_property_split = True
1042         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
1043
1044         cam = context.camera
1045         dof_options = cam.gpu_dof
1046
1047         sub = flow.column(align=True)
1048         sub.prop(dof_options, "fstop")
1049         sub.prop(dof_options, "blades")
1050
1051
1052 class CYCLES_PT_context_material(CyclesButtonsPanel, Panel):
1053     bl_label = ""
1054     bl_context = "material"
1055     bl_options = {'HIDE_HEADER'}
1056
1057     @classmethod
1058     def poll(cls, context):
1059         if context.active_object and context.active_object.type == 'GPENCIL':
1060             return False
1061         else:
1062             return (context.material or context.object) and CyclesButtonsPanel.poll(context)
1063
1064     def draw(self, context):
1065         layout = self.layout
1066
1067         mat = context.material
1068         ob = context.object
1069         slot = context.material_slot
1070         space = context.space_data
1071
1072         if ob:
1073             is_sortable = len(ob.material_slots) > 1
1074             rows = 1
1075             if (is_sortable):
1076                 rows = 4
1077
1078             row = layout.row()
1079
1080             row.template_list("MATERIAL_UL_matslots", "", ob, "material_slots", ob, "active_material_index", rows=rows)
1081
1082             col = row.column(align=True)
1083             col.operator("object.material_slot_add", icon='ADD', text="")
1084             col.operator("object.material_slot_remove", icon='REMOVE', text="")
1085
1086             col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
1087
1088             if is_sortable:
1089                 col.separator()
1090
1091                 col.operator("object.material_slot_move", icon='TRIA_UP', text="").direction = 'UP'
1092                 col.operator("object.material_slot_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
1093
1094             if ob.mode == 'EDIT':
1095                 row = layout.row(align=True)
1096                 row.operator("object.material_slot_assign", text="Assign")
1097                 row.operator("object.material_slot_select", text="Select")
1098                 row.operator("object.material_slot_deselect", text="Deselect")
1099
1100         split = layout.split(factor=0.65)
1101
1102         if ob:
1103             split.template_ID(ob, "active_material", new="material.new")
1104             row = split.row()
1105
1106             if slot:
1107                 row.prop(slot, "link", text="")
1108             else:
1109                 row.label()
1110         elif mat:
1111             split.template_ID(space, "pin_id")
1112             split.separator()
1113
1114
1115 class CYCLES_OBJECT_PT_motion_blur(CyclesButtonsPanel, Panel):
1116     bl_label = "Motion Blur"
1117     bl_context = "object"
1118     bl_options = {'DEFAULT_CLOSED'}
1119
1120     @classmethod
1121     def poll(cls, context):
1122         ob = context.object
1123         if CyclesButtonsPanel.poll(context) and ob:
1124             if ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META', 'CAMERA'}:
1125                 return True
1126             if ob.instance_type == 'COLLECTION' and ob.instance_collection:
1127                 return True
1128             # TODO(sergey): More duplicator types here?
1129         return False
1130
1131     def draw_header(self, context):
1132         layout = self.layout
1133
1134         rd = context.scene.render
1135         # scene = context.scene
1136
1137         layout.active = rd.use_motion_blur
1138
1139         ob = context.object
1140         cob = ob.cycles
1141
1142         layout.prop(cob, "use_motion_blur", text="")
1143
1144     def draw(self, context):
1145         layout = self.layout
1146
1147         rd = context.scene.render
1148         # scene = context.scene
1149
1150         ob = context.object
1151         cob = ob.cycles
1152
1153         layout.active = (rd.use_motion_blur and cob.use_motion_blur)
1154
1155         row = layout.row()
1156         if ob.type != 'CAMERA':
1157             row.prop(cob, "use_deform_motion", text="Deformation")
1158         row.prop(cob, "motion_steps", text="Steps")
1159
1160
1161 class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
1162     bl_label = "Cycles Settings"
1163     bl_context = "object"
1164     bl_options = {'DEFAULT_CLOSED'}
1165
1166     @classmethod
1167     def poll(cls, context):
1168         ob = context.object
1169         return (CyclesButtonsPanel.poll(context) and
1170                 ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
1171                         (ob.instance_type == 'COLLECTION' and ob.instance_collection)))
1172
1173     def draw(self, context):
1174         pass
1175
1176
1177 class CYCLES_OBJECT_PT_cycles_settings_ray_visibility(CyclesButtonsPanel, Panel):
1178     bl_label = "Ray Visibility"
1179     bl_parent_id = "CYCLES_OBJECT_PT_cycles_settings"
1180     bl_context = "object"
1181
1182     def draw(self, context):
1183         layout = self.layout
1184         layout.use_property_split = True
1185         layout.use_property_decorate = False
1186
1187         scene = context.scene
1188         ob = context.object
1189         cob = ob.cycles
1190         visibility = ob.cycles_visibility
1191
1192         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
1193
1194         col = flow.column()
1195         col.prop(visibility, "camera")
1196         col = flow.column()
1197         col.prop(visibility, "diffuse")
1198         col = flow.column()
1199         col.prop(visibility, "glossy")
1200         col = flow.column()
1201         col.prop(visibility, "transmission")
1202         col = flow.column()
1203         col.prop(visibility, "scatter")
1204
1205         if ob.type != 'LIGHT':
1206             col = flow.column()
1207             col.prop(visibility, "shadow")
1208
1209         layout.separator()
1210
1211         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
1212
1213         col = flow.column()
1214         col.prop(cob, "is_shadow_catcher")
1215         col = flow.column()
1216         col.prop(cob, "is_holdout")
1217
1218
1219 class CYCLES_OBJECT_PT_cycles_settings_performance(CyclesButtonsPanel, Panel):
1220     bl_label = "Performance"
1221     bl_parent_id = "CYCLES_OBJECT_PT_cycles_settings"
1222     bl_context = "object"
1223
1224
1225     def draw(self, context):
1226         layout = self.layout
1227         layout.use_property_split = True
1228         layout.use_property_decorate = False
1229
1230         scene = context.scene
1231         cscene = scene.cycles
1232         ob = context.object
1233         cob = ob.cycles
1234
1235         flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
1236
1237         col = flow.column()
1238         col.active = scene.render.use_simplify and cscene.use_camera_cull
1239         col.prop(cob, "use_camera_cull")
1240
1241         col = flow.column()
1242         col.active = scene.render.use_simplify and cscene.use_distance_cull
1243         col.prop(cob, "use_distance_cull")
1244
1245
1246 class CYCLES_OT_use_shading_nodes(Operator):
1247     """Enable nodes on a material, world or light"""
1248     bl_idname = "cycles.use_shading_nodes"
1249     bl_label = "Use Nodes"
1250
1251     @classmethod
1252     def poll(cls, context):
1253         return (getattr(context, "material", False) or getattr(context, "world", False) or
1254                 getattr(context, "light", False))
1255
1256     def execute(self, context):
1257         if context.material:
1258             context.material.use_nodes = True
1259         elif context.world:
1260             context.world.use_nodes = True
1261         elif context.light:
1262             context.light.use_nodes = True
1263
1264         return {'FINISHED'}
1265
1266
1267 def panel_node_draw(layout, id_data, output_type, input_name):
1268     if not id_data.use_nodes:
1269         layout.operator("cycles.use_shading_nodes", icon='NODETREE')
1270         return False
1271
1272     ntree = id_data.node_tree
1273
1274     node = ntree.get_output_node('CYCLES')
1275     if node:
1276         input = find_node_input(node, input_name)
1277         if input:
1278             layout.template_node_view(ntree, node, input)
1279         else:
1280             layout.label(text="Incompatible output node")
1281     else:
1282         layout.label(text="No output node")
1283
1284     return True
1285
1286
1287 class CYCLES_LIGHT_PT_preview(CyclesButtonsPanel, Panel):
1288     bl_label = "Preview"
1289     bl_context = "data"
1290     bl_options = {'DEFAULT_CLOSED'}
1291
1292     @classmethod
1293     def poll(cls, context):
1294         return (
1295             context.light and
1296             not (
1297                 context.light.type == 'AREA' and
1298                 context.light.cycles.is_portal
1299             ) and
1300             CyclesButtonsPanel.poll(context)
1301         )
1302
1303     def draw(self, context):
1304         self.layout.template_preview(context.light)
1305
1306
1307 class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
1308     bl_label = "Light"
1309     bl_context = "data"
1310
1311     @classmethod
1312     def poll(cls, context):
1313         return context.light and CyclesButtonsPanel.poll(context)
1314
1315     def draw(self, context):
1316         layout = self.layout
1317
1318         light = context.light
1319         clamp = light.cycles
1320         # cscene = context.scene.cycles
1321
1322         layout.prop(light, "type", expand=True)
1323
1324         layout.use_property_split = True
1325         layout.use_property_decorate = False
1326
1327         col = layout.column()
1328
1329         if light.type in {'POINT', 'SUN', 'SPOT'}:
1330             col.prop(light, "shadow_soft_size", text="Size")
1331         elif light.type == 'AREA':
1332             col.prop(light, "shape", text="Shape")
1333             sub = col.column(align=True)
1334
1335             if light.shape in {'SQUARE', 'DISK'}:
1336                 sub.prop(light, "size")
1337             elif light.shape in {'RECTANGLE', 'ELLIPSE'}:
1338                 sub.prop(light, "size", text="Size X")
1339                 sub.prop(light, "size_y", text="Y")
1340
1341         if not (light.type == 'AREA' and clamp.is_portal):
1342             sub = col.column()
1343             if use_branched_path(context):
1344                 subsub = sub.row(align=True)
1345                 subsub.active = use_sample_all_lights(context)
1346                 subsub.prop(clamp, "samples")
1347             sub.prop(clamp, "max_bounces")
1348
1349         sub = col.column(align=True)
1350         sub.active = not (light.type == 'AREA' and clamp.is_portal)
1351         sub.prop(clamp, "cast_shadow")
1352         sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
1353
1354         if light.type == 'AREA':
1355             col.prop(clamp, "is_portal", text="Portal")
1356
1357
1358 class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
1359     bl_label = "Nodes"
1360     bl_context = "data"
1361
1362     @classmethod
1363     def poll(cls, context):
1364         return context.light and not (context.light.type == 'AREA' and
1365                                       context.light.cycles.is_portal) and \
1366             CyclesButtonsPanel.poll(context)
1367
1368     def draw(self, context):
1369         layout = self.layout
1370
1371         light = context.light
1372         if not panel_node_draw(layout, light, 'OUTPUT_LIGHT', 'Surface'):
1373             layout.prop(light, "color")
1374
1375
1376 class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
1377     bl_label = "Spot Shape"
1378     bl_context = "data"
1379
1380     @classmethod
1381     def poll(cls, context):
1382         light = context.light
1383         return (light and light.type == 'SPOT') and CyclesButtonsPanel.poll(context)
1384
1385     def draw(self, context):
1386         layout = self.layout
1387         light = context.light
1388         layout.use_property_split = True
1389         layout.use_property_decorate = False
1390
1391         col = layout.column()
1392         col.prop(light, "spot_size", text="Size")
1393         col.prop(light, "spot_blend", text="Blend", slider=True)
1394         col.prop(light, "show_cone")
1395
1396
1397 class CYCLES_WORLD_PT_preview(CyclesButtonsPanel, Panel):
1398     bl_label = "Preview"
1399     bl_context = "world"
1400     bl_options = {'DEFAULT_CLOSED'}
1401
1402     @classmethod
1403     def poll(cls, context):
1404         return context.world and CyclesButtonsPanel.poll(context)
1405
1406     def draw(self, context):
1407         self.layout.template_preview(context.world)
1408
1409
1410 class CYCLES_WORLD_PT_surface(CyclesButtonsPanel, Panel):
1411     bl_label = "Surface"
1412     bl_context = "world"
1413
1414     @classmethod
1415     def poll(cls, context):
1416         return context.world and CyclesButtonsPanel.poll(context)
1417
1418     def draw(self, context):
1419         layout = self.layout
1420
1421         world = context.world
1422
1423         if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
1424             layout.prop(world, "color")
1425
1426
1427 class CYCLES_WORLD_PT_volume(CyclesButtonsPanel, Panel):
1428     bl_label = "Volume"
1429     bl_context = "world"
1430     bl_options = {'DEFAULT_CLOSED'}
1431
1432     @classmethod
1433     def poll(cls, context):
1434         world = context.world
1435         return world and world.node_tree and CyclesButtonsPanel.poll(context)
1436
1437     def draw(self, context):
1438         layout = self.layout
1439
1440         world = context.world
1441         panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
1442
1443
1444 class CYCLES_WORLD_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
1445     bl_label = "Ambient Occlusion"
1446     bl_context = "world"
1447     bl_options = {'DEFAULT_CLOSED'}
1448
1449     @classmethod
1450     def poll(cls, context):
1451         return context.world and CyclesButtonsPanel.poll(context)
1452
1453     def draw_header(self, context):
1454         light = context.world.light_settings
1455         self.layout.prop(light, "use_ambient_occlusion", text="")
1456
1457     def draw(self, context):
1458         layout = self.layout
1459         layout.use_property_split = True
1460         layout.use_property_decorate = False
1461
1462         light = context.world.light_settings
1463         scene = context.scene
1464
1465         col = layout.column()
1466         sub = col.column()
1467         sub.active = light.use_ambient_occlusion or scene.render.use_simplify
1468         sub.prop(light, "ao_factor", text="Factor")
1469         col.prop(light, "distance", text="Distance")
1470
1471
1472 class CYCLES_WORLD_PT_mist(CyclesButtonsPanel, Panel):
1473     bl_label = "Mist Pass"
1474     bl_context = "world"
1475     bl_options = {'DEFAULT_CLOSED'}
1476
1477     @classmethod
1478     def poll(cls, context):
1479         if CyclesButtonsPanel.poll(context):
1480             if context.world:
1481                 for view_layer in context.scene.view_layers:
1482                     if view_layer.use_pass_mist:
1483                         return True
1484
1485         return False
1486
1487     def draw(self, context):
1488         layout = self.layout
1489
1490         world = context.world
1491
1492         split = layout.split(align=True)
1493         split.prop(world.mist_settings, "start")
1494         split.prop(world.mist_settings, "depth")
1495
1496         layout.prop(world.mist_settings, "falloff")
1497
1498
1499 class CYCLES_WORLD_PT_ray_visibility(CyclesButtonsPanel, Panel):
1500     bl_label = "Ray Visibility"
1501     bl_context = "world"
1502     bl_options = {'DEFAULT_CLOSED'}
1503
1504     @classmethod
1505     def poll(cls, context):
1506         return CyclesButtonsPanel.poll(context) and context.world
1507
1508     def draw(self, context):
1509         layout = self.layout
1510
1511         world = context.world
1512         visibility = world.cycles_visibility
1513
1514         flow = layout.column_flow()
1515
1516         flow.prop(visibility, "camera")
1517         flow.prop(visibility, "diffuse")
1518         flow.prop(visibility, "glossy")
1519         flow.prop(visibility, "transmission")
1520         flow.prop(visibility, "scatter")
1521
1522
1523 class CYCLES_WORLD_PT_settings(CyclesButtonsPanel, Panel):
1524     bl_label = "Settings"
1525     bl_context = "world"
1526     bl_options = {'DEFAULT_CLOSED'}
1527
1528     @classmethod
1529     def poll(cls, context):
1530         return context.world and CyclesButtonsPanel.poll(context)
1531
1532     def draw(self, context):
1533         layout = self.layout
1534         layout.use_property_split = True
1535         layout.use_property_decorate = False
1536
1537         layout.column()
1538
1539
1540 class CYCLES_WORLD_PT_settings_surface(CyclesButtonsPanel, Panel):
1541     bl_label = "Surface"
1542     bl_parent_id = "CYCLES_WORLD_PT_settings"
1543     bl_context = "world"
1544
1545     @classmethod
1546     def poll(cls, context):
1547         return context.world and CyclesButtonsPanel.poll(context)
1548
1549     def draw(self, context):
1550         layout = self.layout
1551         layout.use_property_split = True
1552         layout.use_property_decorate = False
1553
1554         world = context.world
1555         cworld = world.cycles
1556
1557         col = layout.column()
1558         col.prop(cworld, "sampling_method", text="Sampling")
1559
1560         sub = col.column()
1561         sub.active = cworld.sampling_method != 'NONE'
1562         subsub = sub.row(align=True)
1563         subsub.active = cworld.sampling_method == 'MANUAL'
1564         subsub.prop(cworld, "sample_map_resolution")
1565         if use_branched_path(context):
1566             subsub = sub.column(align=True)
1567             subsub.active = use_sample_all_lights(context)
1568             subsub.prop(cworld, "samples")
1569         sub.prop(cworld, "max_bounces")
1570
1571
1572 class CYCLES_WORLD_PT_settings_volume(CyclesButtonsPanel, Panel):
1573     bl_label = "Volume"
1574     bl_parent_id = "CYCLES_WORLD_PT_settings"
1575     bl_context = "world"
1576
1577     @classmethod
1578     def poll(cls, context):
1579         return context.world and CyclesButtonsPanel.poll(context)
1580
1581     def draw(self, context):
1582         layout = self.layout
1583         layout.use_property_split = True
1584         layout.use_property_decorate = False
1585
1586         world = context.world
1587         cworld = world.cycles
1588
1589         col = layout.column()
1590
1591         sub = col.column()
1592         sub.active = use_cpu(context)
1593         sub.prop(cworld, "volume_sampling", text="Sampling")
1594         col.prop(cworld, "volume_interpolation", text="Interpolation")
1595         col.prop(cworld, "homogeneous_volume", text="Homogeneous")
1596
1597
1598 class CYCLES_MATERIAL_PT_preview(CyclesButtonsPanel, Panel):
1599     bl_label = "Preview"
1600     bl_context = "material"
1601     bl_options = {'DEFAULT_CLOSED'}
1602
1603     @classmethod
1604     def poll(cls, context):
1605         return context.material and CyclesButtonsPanel.poll(context)
1606
1607     def draw(self, context):
1608         self.layout.template_preview(context.material)
1609
1610
1611 class CYCLES_MATERIAL_PT_surface(CyclesButtonsPanel, Panel):
1612     bl_label = "Surface"
1613     bl_context = "material"
1614
1615     @classmethod
1616     def poll(cls, context):
1617         return context.material and CyclesButtonsPanel.poll(context)
1618
1619     def draw(self, context):
1620         layout = self.layout
1621
1622         mat = context.material
1623         if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
1624             layout.prop(mat, "diffuse_color")
1625
1626
1627 class CYCLES_MATERIAL_PT_volume(CyclesButtonsPanel, Panel):
1628     bl_label = "Volume"
1629     bl_context = "material"
1630     bl_options = {'DEFAULT_CLOSED'}
1631
1632     @classmethod
1633     def poll(cls, context):
1634         mat = context.material
1635         return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
1636
1637     def draw(self, context):
1638         layout = self.layout
1639
1640         mat = context.material
1641         # cmat = mat.cycles
1642
1643         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
1644
1645
1646 class CYCLES_MATERIAL_PT_displacement(CyclesButtonsPanel, Panel):
1647     bl_label = "Displacement"
1648     bl_context = "material"
1649
1650     @classmethod
1651     def poll(cls, context):
1652         mat = context.material
1653         return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
1654
1655     def draw(self, context):
1656         layout = self.layout
1657
1658         mat = context.material
1659         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
1660
1661
1662 class CYCLES_MATERIAL_PT_settings(CyclesButtonsPanel, Panel):
1663     bl_label = "Settings"
1664     bl_context = "material"
1665     bl_options = {'DEFAULT_CLOSED'}
1666
1667     @classmethod
1668     def poll(cls, context):
1669         return context.material and CyclesButtonsPanel.poll(context)
1670
1671     def draw(self, context):
1672         layout = self.layout
1673         layout.use_property_split = True
1674         layout.use_property_decorate = False
1675
1676         mat = context.material
1677
1678         layout.prop(mat, "pass_index")
1679
1680
1681 class CYCLES_MATERIAL_PT_settings_surface(CyclesButtonsPanel, Panel):
1682     bl_label = "Surface"
1683     bl_parent_id = "CYCLES_MATERIAL_PT_settings"
1684     bl_context = "material"
1685
1686     @classmethod
1687     def poll(cls, context):
1688         return context.material and CyclesButtonsPanel.poll(context)
1689
1690     def draw(self, context):
1691         layout = self.layout
1692         layout.use_property_split = True
1693         layout.use_property_decorate = False
1694
1695         mat = context.material
1696         cmat = mat.cycles
1697
1698         col = layout.column()
1699         col.prop(cmat, "sample_as_light", text="Multiple Importance")
1700         col.prop(cmat, "use_transparent_shadow")
1701         col.prop(cmat, "displacement_method", text="Displacement Method")
1702
1703
1704 class CYCLES_MATERIAL_PT_settings_volume(CyclesButtonsPanel, Panel):
1705     bl_label = "Volume"
1706     bl_parent_id = "CYCLES_MATERIAL_PT_settings"
1707     bl_context = "material"
1708
1709     @classmethod
1710     def poll(cls, context):
1711         return context.material and CyclesButtonsPanel.poll(context)
1712
1713     def draw(self, context):
1714         layout = self.layout
1715         layout.use_property_split = True
1716         layout.use_property_decorate = False
1717
1718         mat = context.material
1719         cmat = mat.cycles
1720
1721         col = layout.column()
1722         sub = col.column()
1723         sub.active = use_cpu(context)
1724         sub.prop(cmat, "volume_sampling", text="Sampling")
1725         col.prop(cmat, "volume_interpolation", text="Interpolation")
1726         col.prop(cmat, "homogeneous_volume", text="Homogeneous")
1727
1728
1729 class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
1730     bl_label = "Bake"
1731     bl_context = "render"
1732     bl_options = {'DEFAULT_CLOSED'}
1733     COMPAT_ENGINES = {'CYCLES'}
1734
1735     def draw(self, context):
1736         layout = self.layout
1737         layout.use_property_split = True
1738         layout.use_property_decorate = False  # No animation.
1739
1740         scene = context.scene
1741         cscene = scene.cycles
1742         cbk = scene.render.bake
1743         rd = scene.render
1744
1745         col = layout.column()
1746         col.prop(rd, "use_bake_multires")
1747         if rd.use_bake_multires:
1748             col.prop(rd, "bake_type")
1749
1750             col = layout.column()
1751             col.prop(rd, "bake_margin")
1752             col.prop(rd, "use_bake_clear")
1753
1754             if rd.bake_type == 'DISPLACEMENT':
1755                 col.prop(rd, "use_bake_lores_mesh")
1756
1757             col.operator("object.bake_image", icon='RENDER_STILL')
1758
1759         else:
1760             col.prop(cscene, "bake_type")
1761
1762             col = layout.column()
1763
1764             if cscene.bake_type == 'NORMAL':
1765                 col.prop(cbk, "normal_space", text="Space")
1766
1767                 sub = col.column(align=True)
1768                 sub.prop(cbk, "normal_r", text="Swizzle R")
1769                 sub.prop(cbk, "normal_g", text="G")
1770                 sub.prop(cbk, "normal_b", text="B")
1771
1772             elif cscene.bake_type == 'COMBINED':
1773                 row = col.row(align=True)
1774                 row.use_property_split = False
1775                 row.prop(cbk, "use_pass_direct", toggle=True)
1776                 row.prop(cbk, "use_pass_indirect", toggle=True)
1777
1778                 col = col.column()
1779                 col.active = cbk.use_pass_direct or cbk.use_pass_indirect
1780                 col.prop(cbk, "use_pass_diffuse")
1781                 col.prop(cbk, "use_pass_glossy")
1782                 col.prop(cbk, "use_pass_transmission")
1783                 col.prop(cbk, "use_pass_subsurface")
1784                 col.prop(cbk, "use_pass_ambient_occlusion")
1785                 col.prop(cbk, "use_pass_emit")
1786
1787             elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
1788                 row = col.row(align=True)
1789                 row.use_property_split = False
1790                 row.prop(cbk, "use_pass_direct", toggle=True)
1791                 row.prop(cbk, "use_pass_indirect", toggle=True)
1792                 row.prop(cbk, "use_pass_color", toggle=True)
1793
1794             layout.separator()
1795
1796             col = layout.column()
1797             col.prop(cbk, "margin")
1798             col.prop(cbk, "use_clear", text="Clear Image")
1799
1800             col.separator()
1801
1802             col.prop(cbk, "use_selected_to_active")
1803             sub = col.column()
1804             sub.active = cbk.use_selected_to_active
1805             sub.prop(cbk, "use_cage", text="Cage")
1806             if cbk.use_cage:
1807                 sub.prop(cbk, "cage_extrusion", text="Extrusion")
1808                 sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
1809             else:
1810                 sub.prop(cbk, "cage_extrusion", text="Ray Distance")
1811
1812             layout.separator()
1813
1814             layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
1815
1816
1817 class CYCLES_RENDER_PT_debug(CyclesButtonsPanel, Panel):
1818     bl_label = "Debug"
1819     bl_context = "render"
1820     bl_options = {'DEFAULT_CLOSED'}
1821     COMPAT_ENGINES = {'CYCLES'}
1822
1823     @classmethod
1824     def poll(cls, context):
1825         return CyclesButtonsPanel.poll(context) and bpy.app.debug_value == 256
1826
1827     def draw(self, context):
1828         layout = self.layout
1829
1830         scene = context.scene
1831         cscene = scene.cycles
1832
1833         col = layout.column()
1834
1835         col.label(text="CPU Flags:")
1836         row = col.row(align=True)
1837         row.prop(cscene, "debug_use_cpu_sse2", toggle=True)
1838         row.prop(cscene, "debug_use_cpu_sse3", toggle=True)
1839         row.prop(cscene, "debug_use_cpu_sse41", toggle=True)
1840         row.prop(cscene, "debug_use_cpu_avx", toggle=True)
1841         row.prop(cscene, "debug_use_cpu_avx2", toggle=True)
1842         col.prop(cscene, "debug_bvh_layout")
1843         col.prop(cscene, "debug_use_cpu_split_kernel")
1844
1845         col.separator()
1846
1847         col = layout.column()
1848         col.label(text="CUDA Flags:")
1849         col.prop(cscene, "debug_use_cuda_adaptive_compile")
1850         col.prop(cscene, "debug_use_cuda_split_kernel")
1851
1852         col.separator()
1853
1854         col = layout.column()
1855         col.label(text="OpenCL Flags:")
1856         col.prop(cscene, "debug_opencl_kernel_type", text="Kernel")
1857         col.prop(cscene, "debug_opencl_device_type", text="Device")
1858         col.prop(cscene, "debug_opencl_kernel_single_program", text="Single Program")
1859         col.prop(cscene, "debug_use_opencl_debug", text="Debug")
1860         col.prop(cscene, "debug_opencl_mem_limit")
1861
1862         col.separator()
1863
1864         col = layout.column()
1865         col.prop(cscene, "debug_bvh_type")
1866
1867
1868 class CYCLES_RENDER_PT_simplify(CyclesButtonsPanel, Panel):
1869     bl_label = "Simplify"
1870     bl_context = "render"
1871     bl_options = {'DEFAULT_CLOSED'}
1872     COMPAT_ENGINES = {'CYCLES'}
1873
1874     def draw_header(self, context):
1875         rd = context.scene.render
1876         self.layout.prop(rd, "use_simplify", text="")
1877
1878     def draw(self, context):
1879         pass
1880
1881
1882 class CYCLES_RENDER_PT_simplify_viewport(CyclesButtonsPanel, Panel):
1883     bl_label = "Viewport"
1884     bl_context = "render"
1885     bl_parent_id = "CYCLES_RENDER_PT_simplify"
1886     COMPAT_ENGINES = {'CYCLES'}
1887
1888     def draw(self, context):
1889         layout = self.layout
1890         layout.use_property_split = True
1891         layout.use_property_decorate = False
1892
1893         scene = context.scene
1894         rd = scene.render
1895         cscene = scene.cycles
1896
1897         layout.active = rd.use_simplify
1898
1899         col = layout.column()
1900         col.prop(rd, "simplify_subdivision", text="Max Subdivision")
1901         col.prop(rd, "simplify_child_particles", text="Child Particles")
1902         col.prop(cscene, "texture_limit", text="Texture Limit")
1903         col.prop(cscene, "ao_bounces", text="AO Bounces")
1904
1905
1906 class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel):
1907     bl_label = "Render"
1908     bl_context = "render"
1909     bl_parent_id = "CYCLES_RENDER_PT_simplify"
1910     COMPAT_ENGINES = {'CYCLES'}
1911
1912     def draw(self, context):
1913         layout = self.layout
1914         layout.use_property_split = True
1915         layout.use_property_decorate = False
1916
1917         scene = context.scene
1918         rd = scene.render
1919         cscene = scene.cycles
1920
1921         layout.active = rd.use_simplify
1922
1923         col = layout.column()
1924
1925         col.prop(rd, "simplify_subdivision_render", text="Max Subdivision")
1926         col.prop(rd, "simplify_child_particles_render", text="Child Particles")
1927         col.prop(cscene, "texture_limit_render", text="Texture Limit")
1928         col.prop(cscene, "ao_bounces_render", text="AO Bounces")
1929
1930
1931 class CYCLES_RENDER_PT_simplify_culling(CyclesButtonsPanel, Panel):
1932     bl_label = "Culling"
1933     bl_context = "render"
1934     bl_parent_id = "CYCLES_RENDER_PT_simplify"
1935     bl_options = {'DEFAULT_CLOSED'}
1936     COMPAT_ENGINES = {'CYCLES'}
1937
1938     def draw(self, context):
1939         layout = self.layout
1940         layout.use_property_split = True
1941         layout.use_property_decorate = False
1942
1943         scene = context.scene
1944         rd = scene.render
1945         cscene = scene.cycles
1946
1947         layout.active = rd.use_simplify
1948
1949         col = layout.column()
1950         col.prop(cscene, "use_camera_cull")
1951         sub = col.column()
1952         sub.active = cscene.use_camera_cull
1953         sub.prop(cscene, "camera_cull_margin")
1954
1955         col = layout.column()
1956         col.prop(cscene, "use_distance_cull")
1957         sub = col.column()
1958         sub.active = cscene.use_distance_cull
1959         sub.prop(cscene, "distance_cull_margin", text="Distance")
1960
1961
1962 def draw_device(self, context):
1963     scene = context.scene
1964     layout = self.layout
1965     layout.use_property_split = True
1966     layout.use_property_decorate = False
1967
1968     if context.engine == 'CYCLES':
1969         from . import engine
1970         cscene = scene.cycles
1971
1972         col = layout.column()
1973         col.prop(cscene, "feature_set")
1974
1975         scene = context.scene
1976
1977         col = layout.column()
1978         col.active = show_device_active(context)
1979         col.prop(cscene, "device")
1980
1981         from . import engine
1982         if engine.with_osl() and use_cpu(context):
1983             col.prop(cscene, "shading_system")
1984
1985
1986 def draw_pause(self, context):
1987     layout = self.layout
1988     scene = context.scene
1989
1990     if context.engine == "CYCLES":
1991         view = context.space_data
1992
1993         if view.shading.type == 'RENDERED':
1994             cscene = scene.cycles
1995             layout.prop(cscene, "preview_pause", icon='PAUSE', text="")
1996
1997
1998 def get_panels():
1999     exclude_panels = {
2000         'DATA_PT_area',
2001         'DATA_PT_camera_dof',
2002         'DATA_PT_falloff_curve',
2003         'DATA_PT_light',
2004         'DATA_PT_preview',
2005         'DATA_PT_spot',
2006         'MATERIAL_PT_context_material',
2007         'MATERIAL_PT_preview',
2008         'VIEWLAYER_PT_filter',
2009         'VIEWLAYER_PT_layer_passes',
2010         'RENDER_PT_post_processing',
2011         'RENDER_PT_simplify',
2012     }
2013
2014     panels = []
2015     for panel in bpy.types.Panel.__subclasses__():
2016         if hasattr(panel, 'COMPAT_ENGINES') and 'BLENDER_RENDER' in panel.COMPAT_ENGINES:
2017             if panel.__name__ not in exclude_panels:
2018                 panels.append(panel)
2019
2020     return panels
2021
2022
2023 classes = (
2024     CYCLES_PT_sampling_presets,
2025     CYCLES_PT_integrator_presets,
2026     CYCLES_RENDER_PT_sampling,
2027     CYCLES_RENDER_PT_sampling_sub_samples,
2028     CYCLES_RENDER_PT_sampling_advanced,
2029     CYCLES_RENDER_PT_light_paths,
2030     CYCLES_RENDER_PT_light_paths_max_bounces,
2031     CYCLES_RENDER_PT_light_paths_clamping,
2032     CYCLES_RENDER_PT_light_paths_caustics,
2033     CYCLES_RENDER_PT_volumes,
2034     CYCLES_RENDER_PT_subdivision,
2035     CYCLES_RENDER_PT_hair,
2036     CYCLES_RENDER_PT_simplify,
2037     CYCLES_RENDER_PT_simplify_viewport,
2038     CYCLES_RENDER_PT_simplify_render,
2039     CYCLES_RENDER_PT_simplify_culling,
2040     CYCLES_RENDER_PT_motion_blur,
2041     CYCLES_RENDER_PT_motion_blur_curve,
2042     CYCLES_RENDER_PT_film,
2043     CYCLES_RENDER_PT_film_pixel_filter,
2044     CYCLES_RENDER_PT_film_transparency,
2045     CYCLES_RENDER_PT_performance,
2046     CYCLES_RENDER_PT_performance_threads,
2047     CYCLES_RENDER_PT_performance_tiles,
2048     CYCLES_RENDER_PT_performance_acceleration_structure,
2049     CYCLES_RENDER_PT_performance_final_render,
2050     CYCLES_RENDER_PT_performance_viewport,
2051     CYCLES_RENDER_PT_filter,
2052     CYCLES_RENDER_PT_passes,
2053     CYCLES_RENDER_PT_passes_data,
2054     CYCLES_RENDER_PT_passes_light,
2055     CYCLES_RENDER_PT_passes_crypto,
2056     CYCLES_RENDER_PT_passes_debug,
2057     CYCLES_RENDER_PT_denoising,
2058     CYCLES_PT_post_processing,
2059     CYCLES_CAMERA_PT_dof,
2060     CYCLES_CAMERA_PT_dof_aperture,
2061     CYCLES_CAMERA_PT_dof_viewport,
2062     CYCLES_PT_context_material,
2063     CYCLES_OBJECT_PT_motion_blur,
2064     CYCLES_OBJECT_PT_cycles_settings,
2065     CYCLES_OBJECT_PT_cycles_settings_ray_visibility,
2066     CYCLES_OBJECT_PT_cycles_settings_performance,
2067     CYCLES_OT_use_shading_nodes,
2068     CYCLES_LIGHT_PT_preview,
2069     CYCLES_LIGHT_PT_light,
2070     CYCLES_LIGHT_PT_nodes,
2071     CYCLES_LIGHT_PT_spot,
2072     CYCLES_WORLD_PT_preview,
2073     CYCLES_WORLD_PT_surface,
2074     CYCLES_WORLD_PT_volume,
2075     CYCLES_WORLD_PT_ambient_occlusion,
2076     CYCLES_WORLD_PT_mist,
2077     CYCLES_WORLD_PT_ray_visibility,
2078     CYCLES_WORLD_PT_settings,
2079     CYCLES_WORLD_PT_settings_surface,
2080     CYCLES_WORLD_PT_settings_volume,
2081     CYCLES_MATERIAL_PT_preview,
2082     CYCLES_MATERIAL_PT_surface,
2083     CYCLES_MATERIAL_PT_volume,
2084     CYCLES_MATERIAL_PT_displacement,
2085     CYCLES_MATERIAL_PT_settings,
2086     CYCLES_MATERIAL_PT_settings_surface,
2087     CYCLES_MATERIAL_PT_settings_volume,
2088     CYCLES_RENDER_PT_bake,
2089     CYCLES_RENDER_PT_debug,
2090 )
2091
2092
2093 def register():
2094     from bpy.utils import register_class
2095
2096     bpy.types.RENDER_PT_context.append(draw_device)
2097     bpy.types.VIEW3D_HT_header.append(draw_pause)
2098
2099     for panel in get_panels():
2100         panel.COMPAT_ENGINES.add('CYCLES')
2101
2102     for cls in classes:
2103         register_class(cls)
2104
2105
2106 def unregister():
2107     from bpy.utils import unregister_class
2108
2109     bpy.types.RENDER_PT_context.remove(draw_device)
2110     bpy.types.VIEW3D_HT_header.remove(draw_pause)
2111
2112     for panel in get_panels():
2113         if 'CYCLES' in panel.COMPAT_ENGINES:
2114             panel.COMPAT_ENGINES.remove('CYCLES')
2115
2116     for cls in classes:
2117         unregister_class(cls)