Cycles: option to specify camera aperture in radius or f/stop:
[blender.git] / intern / cycles / blender / addon / ui.py
1 #
2 # Copyright 2011, Blender Foundation.
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
19 # <pep8 compliant>
20
21 import bpy
22
23 from bpy.types import Panel, Menu
24
25 from . import enums, engine
26
27
28 class CYCLES_MT_integrator_presets(Menu):
29     bl_label = "Integrator Presets"
30     preset_subdir = "cycles/integrator"
31     preset_operator = "script.execute_preset"
32     COMPAT_ENGINES = {'CYCLES'}
33     draw = Menu.draw_preset
34
35
36 class CyclesButtonsPanel():
37     bl_space_type = "PROPERTIES"
38     bl_region_type = "WINDOW"
39     bl_context = "render"
40
41     @classmethod
42     def poll(cls, context):
43         rd = context.scene.render
44         return rd.engine == 'CYCLES'
45
46
47 class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
48     bl_label = "Integrator"
49     bl_options = {'DEFAULT_CLOSED'}
50
51     def draw(self, context):
52         layout = self.layout
53
54         scene = context.scene
55         cscene = scene.cycles
56
57         row = layout.row(align=True)
58         row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
59         row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
60         row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMOUT").remove_active = True
61
62         split = layout.split()
63
64         col = split.column()
65         sub = col.column(align=True)
66         sub.label(text="Samples:")
67         sub.prop(cscene, "samples", text="Render")
68         sub.prop(cscene, "preview_samples", text="Preview")
69         sub.prop(cscene, "seed")
70
71         sub = col.column(align=True)
72         sub.label("Transparency:")
73         sub.prop(cscene, "transparent_max_bounces", text="Max")
74         sub.prop(cscene, "transparent_min_bounces", text="Min")
75         sub.prop(cscene, "use_transparent_shadows", text="Shadows")
76
77         col = split.column()
78
79         sub = col.column(align=True)
80         sub.label(text="Bounces:")
81         sub.prop(cscene, "max_bounces", text="Max")
82         sub.prop(cscene, "min_bounces", text="Min")
83
84         sub = col.column(align=True)
85         sub.label(text="Light Paths:")
86         sub.prop(cscene, "diffuse_bounces", text="Diffuse")
87         sub.prop(cscene, "glossy_bounces", text="Glossy")
88         sub.prop(cscene, "transmission_bounces", text="Transmission")
89         sub.prop(cscene, "no_caustics")
90
91         #row = col.row()
92         #row.prop(cscene, "blur_caustics")
93         #row.active = not cscene.no_caustics
94
95
96 class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
97     bl_label = "Film"
98
99     def draw(self, context):
100         layout = self.layout
101
102         scene = context.scene
103         cscene = scene.cycles
104
105         split = layout.split()
106
107         col = split.column()
108         col.prop(cscene, "film_exposure")
109         col.prop(cscene, "film_transparent")
110
111         col = split.column()
112         sub = col.column(align=True)
113         sub.prop(cscene, "filter_type", text="")
114         if cscene.filter_type != 'BOX':
115             sub.prop(cscene, "filter_width", text="Width")
116
117
118 class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
119     bl_label = "Performance"
120     bl_options = {'DEFAULT_CLOSED'}
121
122     def draw(self, context):
123         layout = self.layout
124
125         scene = context.scene
126         rd = scene.render
127         cscene = scene.cycles
128
129         split = layout.split()
130
131         col = split.column(align=True)
132
133         col.label(text="Threads:")
134         col.row().prop(rd, "threads_mode", expand=True)
135         sub = col.column()
136         sub.enabled = rd.threads_mode == 'FIXED'
137         sub.prop(rd, "threads")
138
139         sub = col.column(align=True)
140         sub.label(text="Tiles:")
141         sub.prop(cscene, "debug_tile_size")
142         sub.prop(cscene, "debug_min_size")
143
144         col = split.column()
145
146         sub = col.column(align=True)
147         sub.label(text="Acceleration structure:")
148         sub.prop(cscene, "debug_bvh_type", text="")
149         sub.prop(cscene, "debug_use_spatial_splits")
150         sub.prop(cscene, "use_cache")
151
152
153 class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
154     bl_label = "Layers"
155     bl_options = {'DEFAULT_CLOSED'}
156     COMPAT_ENGINES = {'BLENDER_RENDER'}
157
158     def draw(self, context):
159         layout = self.layout
160
161         scene = context.scene
162         rd = scene.render
163
164         row = layout.row()
165         row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
166
167         col = row.column(align=True)
168         col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
169         col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
170
171         row = layout.row()
172         rl = rd.layers.active
173         row.prop(rl, "name")
174         row.prop(rd, "use_single_layer", text="", icon_only=True)
175
176         split = layout.split()
177
178         col = split.column()
179         col.prop(scene, "layers", text="Scene")
180         col.label(text="Material:")
181         col.prop(rl, "material_override", text="")
182
183         col = split.column()
184         col.prop(rl, "layers", text="Layer")
185         col.label(text="Mask Layers:")
186         col.prop(rl, "layers_zmask", text="")
187
188         split = layout.split()
189
190         col = split.column()
191         col.label(text="Passes:")
192         col.prop(rl, "use_pass_combined")
193         col.prop(rl, "use_pass_z")
194         col.prop(rl, "use_pass_normal")
195         col.prop(rl, "use_pass_object_index")
196         col.prop(rl, "use_pass_material_index")
197         col.prop(rl, "use_pass_emit")
198         col.prop(rl, "use_pass_environment")
199         col.prop(rl, "use_pass_ambient_occlusion")
200
201         col = split.column()
202         col.label()
203         col.label(text="Diffuse:")
204         row = col.row(align=True)
205         row.prop(rl, "use_pass_diffuse_direct", text="Direct", toggle=True)
206         row.prop(rl, "use_pass_diffuse_indirect", text="Indirect", toggle=True)
207         row.prop(rl, "use_pass_diffuse_color", text="Color", toggle=True)
208         col.label(text="Glossy:")
209         row = col.row(align=True)
210         row.prop(rl, "use_pass_glossy_direct", text="Direct", toggle=True)
211         row.prop(rl, "use_pass_glossy_indirect", text="Indirect", toggle=True)
212         row.prop(rl, "use_pass_glossy_color", text="Color", toggle=True)
213         col.label(text="Transmission:")
214         row = col.row(align=True)
215         row.prop(rl, "use_pass_transmission_direct", text="Direct", toggle=True)
216         row.prop(rl, "use_pass_transmission_indirect", text="Indirect", toggle=True)
217         row.prop(rl, "use_pass_transmission_color", text="Color", toggle=True)
218
219
220 class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
221     bl_label = "Post Processing"
222     bl_options = {'DEFAULT_CLOSED'}
223
224     def draw(self, context):
225         layout = self.layout
226
227         rd = context.scene.render
228
229         split = layout.split()
230
231         col = split.column()
232         col.prop(rd, "use_compositing")
233         col.prop(rd, "use_sequencer")
234
235         col = split.column()
236         col.prop(rd, "dither_intensity", text="Dither", slider=True)
237
238
239 class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
240     bl_label = "Depth of Field"
241     bl_context = "data"
242
243     @classmethod
244     def poll(cls, context):
245         return context.camera and CyclesButtonsPanel.poll(context)
246
247     def draw(self, context):
248         layout = self.layout
249
250         cam = context.camera
251         ccam = cam.cycles
252
253         split = layout.split()
254
255         col = split.column()
256         col.label("Focus:")
257         col.prop(cam, "dof_object", text="")
258
259         sub = col.row()
260         sub.active = cam.dof_object is None
261         sub.prop(cam, "dof_distance", text="Distance")
262
263         col = split.column()
264
265         col.label("Aperture:")
266         sub = col.column(align=True)
267         sub.prop(ccam, "aperture_type", text="")
268         if ccam.aperture_type == 'RADIUS':
269             sub.prop(ccam, "aperture_size", text="Size")
270         elif ccam.aperture_type == 'FSTOP':
271             sub.prop(ccam, "aperture_fstop", text="Number")
272
273         sub = col.column(align=True)
274         sub.prop(ccam, "aperture_blades", text="Blades")
275         sub.prop(ccam, "aperture_rotation", text="Rotation")
276
277
278 class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
279     bl_label = ""
280     bl_context = "material"
281     bl_options = {'HIDE_HEADER'}
282
283     @classmethod
284     def poll(cls, context):
285         return (context.material or context.object) and CyclesButtonsPanel.poll(context)
286
287     def draw(self, context):
288         layout = self.layout
289
290         mat = context.material
291         ob = context.object
292         slot = context.material_slot
293         space = context.space_data
294
295         if ob:
296             row = layout.row()
297
298             row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
299
300             col = row.column(align=True)
301             col.operator("object.material_slot_add", icon='ZOOMIN', text="")
302             col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
303
304             col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
305
306             if ob.mode == 'EDIT':
307                 row = layout.row(align=True)
308                 row.operator("object.material_slot_assign", text="Assign")
309                 row.operator("object.material_slot_select", text="Select")
310                 row.operator("object.material_slot_deselect", text="Deselect")
311
312         split = layout.split(percentage=0.65)
313
314         if ob:
315             split.template_ID(ob, "active_material", new="material.new")
316             row = split.row()
317
318             if slot:
319                 row.prop(slot, "link", text="")
320             else:
321                 row.label()
322         elif mat:
323             split.template_ID(space, "pin_id")
324             split.separator()
325
326
327 class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
328     bl_label = "Displacement"
329     bl_context = "data"
330
331     @classmethod
332     def poll(cls, context):
333         if CyclesButtonsPanel.poll(context):
334             if context.mesh or context.curve or context.meta_ball:
335                 if context.scene.cycles.feature_set == 'EXPERIMENTAL':
336                     return True
337
338         return False
339
340     def draw(self, context):
341         layout = self.layout
342
343         mesh = context.mesh
344         curve = context.curve
345         mball = context.meta_ball
346
347         if mesh:
348             cdata = mesh.cycles
349         elif curve:
350             cdata = curve.cycles
351         elif mball:
352             cdata = mball.cycles
353
354         layout.prop(cdata, "displacement_method", text="Method")
355         layout.prop(cdata, "use_subdivision")
356         layout.prop(cdata, "dicing_rate")
357
358
359 class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
360     bl_label = "Ray Visibility"
361     bl_context = "object"
362     bl_options = {'DEFAULT_CLOSED'}
363
364     @classmethod
365     def poll(cls, context):
366         ob = context.object
367         return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}  # todo: 'LAMP'
368
369     def draw(self, context):
370         layout = self.layout
371
372         ob = context.object
373         visibility = ob.cycles_visibility
374
375         flow = layout.column_flow()
376
377         flow.prop(visibility, "camera")
378         flow.prop(visibility, "diffuse")
379         flow.prop(visibility, "glossy")
380         flow.prop(visibility, "transmission")
381         flow.prop(visibility, "shadow")
382
383
384 def find_node(material, nodetype):
385     if material and material.node_tree:
386         ntree = material.node_tree
387
388         for node in ntree.nodes:
389             if getattr(node, "type", None) == nodetype:
390                 return node
391
392     return None
393
394
395 def find_node_input(node, name):
396     for input in node.inputs:
397         if input.name == name:
398             return input
399
400     return None
401
402
403 def panel_node_draw(layout, id_data, output_type, input_name):
404     if not id_data.node_tree:
405         layout.prop(id_data, "use_nodes", icon='NODETREE')
406         return False
407
408     ntree = id_data.node_tree
409
410     node = find_node(id_data, output_type)
411     if not node:
412         layout.label(text="No output node.")
413     else:
414         input = find_node_input(node, input_name)
415         layout.template_node_view(ntree, node, input)
416
417     return True
418
419
420 class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
421     bl_label = "Lamp"
422     bl_context = "data"
423
424     @classmethod
425     def poll(cls, context):
426         return context.lamp and CyclesButtonsPanel.poll(context)
427
428     def draw(self, context):
429         layout = self.layout
430
431         lamp = context.lamp
432         clamp = lamp.cycles
433
434         layout.prop(lamp, "type", expand=True)
435
436         split = layout.split()
437         col = split.column(align=True)
438
439         if lamp.type in {'POINT', 'SUN', 'SPOT'}:
440             col.prop(lamp, "shadow_soft_size", text="Size")
441         elif lamp.type == 'AREA':
442             col.prop(lamp, "shape", text="")
443             sub = col.column(align=True)
444
445             if lamp.shape == 'SQUARE':
446                 sub.prop(lamp, "size")
447             elif lamp.shape == 'RECTANGLE':
448                 sub.prop(lamp, "size", text="Size X")
449                 sub.prop(lamp, "size_y", text="Size Y")
450
451         col = split.column()
452         col.prop(clamp, "cast_shadow")
453
454         if lamp.type == 'SPOT':
455             layout.label(text="Not supported, interpreted as point lamp.")
456         elif lamp.type == 'HEMI':
457             layout.label(text="Not supported, interpreted as sun lamp.")
458
459
460 class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
461     bl_label = "Nodes"
462     bl_context = "data"
463
464     @classmethod
465     def poll(cls, context):
466         return context.lamp and CyclesButtonsPanel.poll(context)
467
468     def draw(self, context):
469         layout = self.layout
470
471         lamp = context.lamp
472         if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
473             layout.prop(lamp, "color")
474
475
476 class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
477     bl_label = "Surface"
478     bl_context = "world"
479
480     @classmethod
481     def poll(cls, context):
482         return context.world and CyclesButtonsPanel.poll(context)
483
484     def draw(self, context):
485         layout = self.layout
486
487         world = context.world
488
489         if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
490             layout.prop(world, "horizon_color", text="Color")
491
492 class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
493     bl_label = "Volume"
494     bl_context = "world"
495     bl_options = {'DEFAULT_CLOSED'}
496
497     @classmethod
498     def poll(cls, context):
499         # world = context.world
500         # world and world.node_tree and CyclesButtonsPanel.poll(context)
501         return False
502
503     def draw(self, context):
504         layout = self.layout
505         layout.active = False
506
507         world = context.world
508         panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
509
510 class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
511     bl_label = "Ambient Occlusion"
512     bl_context = "world"
513
514     @classmethod
515     def poll(cls, context):
516         return context.world and CyclesButtonsPanel.poll(context)
517
518     def draw_header(self, context):
519         light = context.world.light_settings
520         self.layout.prop(light, "use_ambient_occlusion", text="")
521
522     def draw(self, context):
523         layout = self.layout
524         light = context.world.light_settings
525
526         layout.active = light.use_ambient_occlusion
527
528         split = layout.split()
529         split.prop(light, "ao_factor", text="Factor")
530         split.prop(light, "distance", text="Distance")
531
532 class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
533     bl_label = "Settings"
534     bl_context = "world"
535     bl_options = {'DEFAULT_CLOSED'}
536
537     @classmethod
538     def poll(cls, context):
539         return context.world and CyclesButtonsPanel.poll(context)
540
541     def draw(self, context):
542         layout = self.layout
543
544         world = context.world
545         cworld = world.cycles
546
547         col = layout.column()
548
549         col.prop(cworld, "sample_as_light")
550         row = col.row()
551         row.active = cworld.sample_as_light
552         row.prop(cworld, "sample_map_resolution")
553
554 class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
555     bl_label = "Surface"
556     bl_context = "material"
557
558     @classmethod
559     def poll(cls, context):
560         return context.material and CyclesButtonsPanel.poll(context)
561
562     def draw(self, context):
563         layout = self.layout
564
565         mat = context.material
566         if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
567             layout.prop(mat, "diffuse_color")
568
569
570 class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
571     bl_label = "Volume"
572     bl_context = "material"
573     bl_options = {'DEFAULT_CLOSED'}
574
575     @classmethod
576     def poll(cls, context):
577         # mat = context.material
578         # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
579         return False
580
581     def draw(self, context):
582         layout = self.layout
583         layout.active = False
584
585         mat = context.material
586         cmat = mat.cycles
587
588         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
589
590         layout.prop(cmat, "homogeneous_volume")
591
592
593 class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
594     bl_label = "Displacement"
595     bl_context = "material"
596
597     @classmethod
598     def poll(cls, context):
599         mat = context.material
600         return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
601
602     def draw(self, context):
603         layout = self.layout
604
605         mat = context.material
606         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
607
608
609 class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
610     bl_label = "Settings"
611     bl_context = "material"
612     bl_options = {'DEFAULT_CLOSED'}
613
614     @classmethod
615     def poll(cls, context):
616         return context.material and CyclesButtonsPanel.poll(context)
617
618     def draw(self, context):
619         layout = self.layout
620
621         mat = context.material
622         cmat = mat.cycles
623
624         split = layout.split()
625
626         col = split.column()
627         col.prop(mat, "diffuse_color", text="Viewport Color")
628
629         col = split.column()
630         col.prop(cmat, "sample_as_light")
631         col.prop(mat, "pass_index")
632
633
634 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
635     bl_label = ""
636     bl_context = "texture"
637     bl_options = {'HIDE_HEADER'}
638     COMPAT_ENGINES = {'CYCLES'}
639
640     def draw(self, context):
641         layout = self.layout
642
643         tex = context.texture
644         space = context.space_data
645         pin_id = space.pin_id
646         use_pin_id = space.use_pin_id
647         user = context.texture_user
648         # node = context.texture_node
649
650         if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
651             pin_id = None
652
653         if not pin_id:
654             layout.template_texture_user()
655
656         if user:
657             layout.separator()
658
659             split = layout.split(percentage=0.65)
660             col = split.column()
661
662             if pin_id:
663                 col.template_ID(space, "pin_id")
664             elif user:
665                 col.template_ID(user, "texture", new="texture.new")
666
667             if tex:
668                 split = layout.split(percentage=0.2)
669                 split.label(text="Type:")
670                 split.prop(tex, "type", text="")
671
672
673 class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
674     bl_label = "Nodes"
675     bl_context = "texture"
676
677     @classmethod
678     def poll(cls, context):
679         tex = context.texture
680         return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
681
682     def draw(self, context):
683         layout = self.layout
684
685         tex = context.texture
686         panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
687
688
689 class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
690     bl_label = "Node"
691     bl_context = "texture"
692
693     @classmethod
694     def poll(cls, context):
695         node = context.texture_node
696         return node and CyclesButtonsPanel.poll(context)
697
698     def draw(self, context):
699         layout = self.layout
700
701         node = context.texture_node
702         ntree = node.id_data
703         layout.template_node_view(ntree, node, None)
704
705
706 class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
707     bl_label = "Mapping"
708     bl_context = "texture"
709
710     @classmethod
711     def poll(cls, context):
712         tex = context.texture
713         node = context.texture_node
714         return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
715
716     def draw(self, context):
717         layout = self.layout
718
719         # tex = context.texture
720         node = context.texture_node
721
722         mapping = node.texture_mapping
723
724         row = layout.row()
725
726         row.column().prop(mapping, "location")
727         row.column().prop(mapping, "rotation")
728         row.column().prop(mapping, "scale")
729
730         layout.label(text="Projection:")
731
732         row = layout.row()
733         row.prop(mapping, "mapping_x", text="")
734         row.prop(mapping, "mapping_y", text="")
735         row.prop(mapping, "mapping_z", text="")
736
737
738 class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
739     bl_label = "Color"
740     bl_context = "texture"
741     bl_options = {'DEFAULT_CLOSED'}
742
743     @classmethod
744     def poll(cls, context):
745         # tex = context.texture
746         # node = context.texture_node
747         return False
748         #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
749
750     def draw(self, context):
751         layout = self.layout
752
753         # tex = context.texture
754         node = context.texture_node
755
756         mapping = node.color_mapping
757
758         split = layout.split()
759
760         col = split.column()
761         col.label(text="Blend:")
762         col.prop(mapping, "blend_type", text="")
763         col.prop(mapping, "blend_factor", text="Factor")
764         col.prop(mapping, "blend_color", text="")
765
766         col = split.column()
767         col.label(text="Adjust:")
768         col.prop(mapping, "brightness")
769         col.prop(mapping, "contrast")
770         col.prop(mapping, "saturation")
771
772         layout.separator()
773
774         layout.prop(mapping, "use_color_ramp", text="Ramp")
775         if mapping.use_color_ramp:
776             layout.template_color_ramp(mapping, "color_ramp", expand=True)
777
778
779 def draw_device(self, context):
780     scene = context.scene
781     layout = self.layout
782
783     if scene.render.engine == 'CYCLES':
784         cscene = scene.cycles
785
786         layout.prop(cscene, "feature_set")
787
788         device_type = context.user_preferences.system.compute_device_type
789         if device_type == 'CUDA':
790             layout.prop(cscene, "device")
791         elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
792             layout.prop(cscene, "device")
793
794
795 def draw_pause(self, context):
796     layout = self.layout
797     scene = context.scene
798
799     if scene.render.engine == "CYCLES":
800         view = context.space_data
801
802         if view.viewport_shade == 'RENDERED':
803             cscene = scene.cycles
804             layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
805
806
807 def get_panels():
808     return (
809         bpy.types.RENDER_PT_render,
810         bpy.types.RENDER_PT_output,
811         bpy.types.RENDER_PT_encoding,
812         bpy.types.RENDER_PT_dimensions,
813         bpy.types.RENDER_PT_stamp,
814         bpy.types.SCENE_PT_scene,
815         bpy.types.SCENE_PT_audio,
816         bpy.types.SCENE_PT_unit,
817         bpy.types.SCENE_PT_keying_sets,
818         bpy.types.SCENE_PT_keying_set_paths,
819         bpy.types.SCENE_PT_physics,
820         bpy.types.WORLD_PT_context_world,
821         bpy.types.DATA_PT_context_mesh,
822         bpy.types.DATA_PT_context_camera,
823         bpy.types.DATA_PT_context_lamp,
824         bpy.types.DATA_PT_texture_space,
825         bpy.types.DATA_PT_curve_texture_space,
826         bpy.types.DATA_PT_mball_texture_space,
827         bpy.types.DATA_PT_vertex_groups,
828         bpy.types.DATA_PT_shape_keys,
829         bpy.types.DATA_PT_uv_texture,
830         bpy.types.DATA_PT_vertex_colors,
831         bpy.types.DATA_PT_camera,
832         bpy.types.DATA_PT_camera_display,
833         bpy.types.DATA_PT_lens,
834         bpy.types.DATA_PT_custom_props_mesh,
835         bpy.types.DATA_PT_custom_props_camera,
836         bpy.types.DATA_PT_custom_props_lamp,
837         bpy.types.TEXTURE_PT_clouds,
838         bpy.types.TEXTURE_PT_wood,
839         bpy.types.TEXTURE_PT_marble,
840         bpy.types.TEXTURE_PT_magic,
841         bpy.types.TEXTURE_PT_blend,
842         bpy.types.TEXTURE_PT_stucci,
843         bpy.types.TEXTURE_PT_image,
844         bpy.types.TEXTURE_PT_image_sampling,
845         bpy.types.TEXTURE_PT_image_mapping,
846         bpy.types.TEXTURE_PT_musgrave,
847         bpy.types.TEXTURE_PT_voronoi,
848         bpy.types.TEXTURE_PT_distortednoise,
849         bpy.types.TEXTURE_PT_voxeldata,
850         bpy.types.TEXTURE_PT_pointdensity,
851         bpy.types.TEXTURE_PT_pointdensity_turbulence,
852         bpy.types.PARTICLE_PT_context_particles,
853         bpy.types.PARTICLE_PT_emission,
854         bpy.types.PARTICLE_PT_hair_dynamics,
855         bpy.types.PARTICLE_PT_cache,
856         bpy.types.PARTICLE_PT_velocity,
857         bpy.types.PARTICLE_PT_rotation,
858         bpy.types.PARTICLE_PT_physics,
859         bpy.types.PARTICLE_PT_boidbrain,
860         bpy.types.PARTICLE_PT_render,
861         bpy.types.PARTICLE_PT_draw,
862         bpy.types.PARTICLE_PT_children,
863         bpy.types.PARTICLE_PT_field_weights,
864         bpy.types.PARTICLE_PT_force_fields,
865         bpy.types.PARTICLE_PT_vertexgroups,
866         bpy.types.PARTICLE_PT_custom_props,
867         )
868
869
870 def register():
871     bpy.types.RENDER_PT_render.append(draw_device)
872     bpy.types.VIEW3D_HT_header.append(draw_pause)
873
874     for panel in get_panels():
875         panel.COMPAT_ENGINES.add('CYCLES')
876
877
878 def unregister():
879     bpy.types.RENDER_PT_render.remove(draw_device)
880     bpy.types.VIEW3D_HT_header.remove(draw_pause)
881
882     for panel in get_panels():
883         panel.COMPAT_ENGINES.remove('CYCLES')